AddRows

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

Adds the new rows to the current table.

Parameters:

Name Type Default Description
nCount Number

Count of rows to be added.

isBefore boolean false

Specifies if the new rows will be added before or after the current cell.

Returns:

Type
ApiTable | null

Example

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

Resulting document