AddRows

function AddRows(oCell: ApiTableCell = null, nCount: Number = null, isBefore: boolean = false): ApiTable

Description

Adds the new rows to the current table.

Parameters

oCellApiTableCelldefault: 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.

nCountNumberdefault: null

Count of rows to be added.

isBeforebooleandefault: false

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

Returns

ApiTable

Try It

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);
var oCell = oTable.GetCell(0, 0).GetContent().GetElement(0).AddText("Two new rows were added after this cell.");
oTable.AddRows(oCell, 2, false);

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).