AddRows
Adds the new rows to the current table.
Syntax
expression.AddRows(oCell, nCount, isBefore);
expression - A variable that represents an ApiTable class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| oCell | Optional | ApiTableCell | The cell before or after which the new rows will be added. If not specified, the new rows will be added at the end of the table. | |
| nCount | Required | Number | Count of rows to be added. | |
| isBefore | Optional | boolean | false | Adds the new rows before (true) or after (false) the specified cell. If no cell is specified, then this parameter will be ignored. |
Returns
Example
Insert multiple rows into a table at once in a document.
// Reserve space for several new entries below an existing row of a table in a document.
// Grow a table by placing a batch of new rows after a selected cell in a document.
let doc = Api.GetDocument();
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
let table = Api.CreateTable(3, 3);
table.SetWidth("percent", 100);
table.SetStyle(tableStyle);
doc.Push(table);
let cell = table.Cells[0][0];
cell.GetContent().GetElement(0).AddText("Two new rows were added after this cell.");
table.AddRows(cell, 2, false);