Skip to main content

AddRows

Adds the new rows to the current table.

Syntax​

expression.AddRows(oCell, nCount, isBefore);

expression - A variable that represents an ApiTable class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
oCellOptionalApiTableCellThe cell after which the new rows will be added. If not specified, the new rows will be added at the end of the table.
nCountRequiredNumberCount of rows to be added.
isBeforeOptionalbooleanfalseAdds the new rows before (true) or after (false) the specified cell.

Returns​

ApiTable

Example​

Add new rows to a table in a PDF.

// Insert several rows into a table at once in a PDF.

// Create a table and add two rows after the first cell in a PDF.

const doc = Api.GetDocument();
const page = doc.GetPage(0);

const table = Api.CreateTable(2, 2);
const cell = table.GetCell(0, 0);
table.AddRows(cell, 2);
const paragraph = Api.CreateParagraph();
paragraph.AddText('Two rows were added. Total rows: ' + table.GetRowsCount());
cell.GetContent().Push(paragraph);

page.AddObject(table);