AddRow

function AddRow(oCell: ApiTableCell = null, isBefore: boolean = false): ApiTableRow

Description

Adds a new row to the current table.

Parameters

oCellApiTableCelldefault: null

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

isBeforebooleandefault: false

Adds a new row before (false) or after (true) the specified cell. If no cell is specified, then this parameter will be ignored.

Returns

ApiTableRow

Try It

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

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).