AddRow
Adds a new row to the current table.
Syntax
expression.AddRow(oCell, isBefore);
expression
- A variable that represents a ApiTable class.
Parameters
Name | Required/Optional | Data type | Default | Description |
---|---|---|---|---|
oCell | Optional | ApiTableCell | If not specified, a new row will be added to the end of the table. | |
isBefore | Optional | boolean | false | Adds a new row before or after the specified cell. If no cell is specified, then this parameter will be ignored. |
Returns
Example
This example adds a new row to the table.
- Code
- Result
// How to insert a row to the table.
// Create a 2x4 table, set its position and then insert a row to it.
const presentation = Api.GetPresentation();
const table = Api.CreateTable(2, 4);
table.AddRow(1, true);
const row = table.GetRow(1);
const cell = row.GetCell(0);
const content = cell.GetContent();
const paragraph = Api.CreateParagraph();
paragraph.AddText("New row was added here.");
content.Push(paragraph);
const slide = presentation.GetSlideByIndex(0);
slide.RemoveAllObjects();
slide.AddObject(table);