Skip to main content

CreateTable

Creates a new table with a specified number of rows and columns.

Syntax

expression.CreateTable(cols, rows);

expression - A variable that represents a Api class.

Parameters

NameRequired/OptionalData typeDefaultDescription
colsRequirednumberNumber of columns.
rowsRequirednumberNumber of rows.

Returns

ApiTable

Example

Create a 3x3 table and insert it into the document.

// Create a table, add it to the document, and set its width to 100%.

// How to create the table object and add it to the document class.

let doc = Api.GetDocument();
let table = Api.CreateTable(3, 3);
doc.Push(table);
table.SetWidth("percent", 100);