跳到主要内容

CreateTable

Creates a table.

Syntax

expression.CreateTable(nCols, nRows);

expression - A variable that represents a Api class.

Parameters

NameRequired/OptionalData typeDefaultDescription
nColsRequiredNumber of columns.
nRowsRequiredNumber of rows.

Returns

ApiTable

Example

This example creates a 2x4 table and inserts it into the presentation.

// How to create new table with two rows and four columns.

// Add a table to the presentation.

const presentation = Api.GetPresentation();
const slide = presentation.GetSlideByIndex(0);
const table = Api.CreateTable(2, 4);
slide.RemoveAllObjects();
slide.AddObject(table);