Skip to main content

AddRow

Adds a new row to the current table.

Syntax

expression.AddRow(oCell, isBefore);

expression - A variable that represents a ApiTable class.

Parameters

NameRequired/OptionalData typeDefaultDescription
oCellOptionalApiTableCellIf not specified, a new row will be added to the end of the table.
isBeforeOptionalbooleanfalseAdds a new row before or after the specified cell. If no cell is specified, then this parameter will be ignored.

Returns

ApiTableRow

Example

This example adds a new row to the table.

// 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);