Get Started
Documentation

AddRow

AddRow(oCellopt, isBeforeopt) → {ApiTableRow}

Add a new row to the current table.

Parameters:

Name Type Attributes Default Description
oCell ApiTableCell <optional>
The cell after which the new row will be added. If not specified the new row will be added at the end of the table.
isBefore boolean <optional>
false Add a new row before or after the specified cell. If no cell is specified then this parameter will be ignored.

Returns:

Type
ApiTableRow

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph, oTable, oTableStyle;
oParagraph = oDocument.GetElement(0);
oParagraph.AddText("We create a 2x2 table and add a new row, so that it becomes 2x3:");
oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered - Accent 5"));
oTable = Api.CreateTable(2, 2);
oTable.SetWidth("percent", 100);
oTable.SetStyle(oTableStyle);
oTable.AddRow(oTable.GetRow(1).GetCell(0), true);
oDocument.Push(oTable);
builder.SaveFile("docx", "AddRow.docx");
builder.CloseFile();

Resulting document