Skip to main content

AddRows

Adds the new rows to the current table.

Syntax​

expression.AddRows(nCount, isBefore);

expression - A variable that represents an ApiTableCell class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
nCountRequiredNumberCount of rows to be added.
isBeforeOptionalbooleanfalseSpecifies if the new rows will be added before or after the current cell.

Returns​

ApiTable | null

Example​

Add new rows to the table via a cell in a presentation.

// Useful for inserting rows after a specific cell.

// Add two rows after the first cell.

const presentation = Api.GetPresentation();
const slide = presentation.GetSlideByIndex(0);
const table = Api.CreateTable(2, 3);
const cell = table.GetRow(0).GetCell(0);
cell.GetContent().Push(Api.CreateParagraph().AddText("Two new rows added after this cell."));
cell.AddRows(2, false);
slide.RemoveAllObjects();
slide.AddObject(table);