ApiExamples.ExTable.CreateTable C# (CSharp) Метод

CreateTable() приватный Метод

Creates a new table in the document with the given dimensions and text in each cell.
private CreateTable ( Document doc, int rowCount, int cellCount, string cellText ) : Table
doc Document
rowCount int
cellCount int
cellText string
Результат Table
        private Table CreateTable(Document doc, int rowCount, int cellCount, string cellText)
        {
            Table table = new Table(doc);

            // Create the specified number of rows.
            for (int rowId = 1; rowId <= rowCount; rowId++)
            {
                Row row = new Row(doc);
                table.AppendChild(row);

                // Create the specified number of cells for each row.
                for (int cellId = 1; cellId <= cellCount; cellId++)
                {
                    Cell cell = new Cell(doc);
                    row.AppendChild(cell);
                    // Add a blank paragraph to the cell.
                    cell.AppendChild(new Paragraph(doc));

                    // Add the text.
                    cell.FirstParagraph.AppendChild(new Run(doc, cellText));
                }
            }

            return table;
        }
        //ExEnd