Get Started
Usage API
More information

AddRows

AddRows([oCell], nCount, [isBefore]) → { ApiTable }

Add the new rows to the current table.

Parameters:

Name Type Default Description
oCell ApiTableCell null

The cell after which the new rows will be added. If not specified, the new rows will be added at the end of the table.

nCount Number

Count of rows to be added.

isBefore boolean false

Add a new rows before or after the specified cell. If no cell is specified then this parameter will be ignored.

Returns:

Type
ApiTable

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered - Accent 5"));
oTable = Api.CreateTable(3, 3);
oTable.SetWidth("percent", 100);
oTable.SetStyle(oTableStyle);
oDocument.Push(oTable);
oCell = oTable.GetCell(0, 0).GetContent().GetElement(0).AddText("Two new rows were added after this cell.");
oTable.AddRows(oCell, 2, false);
builder.SaveFile("docx", "AddRows.docx");
builder.CloseFile();

Resulting document