Skip to main content

CreateTable

Creates a table.

Breaking Change

Starting from version 9.4.0, the parameter order has been changed from Api.CreateTable(cols, rows) to Api.CreateTable(rows, cols).

Syntax

expression.CreateTable(rows, cols);

expression - A variable that represents a Api class.

Parameters

NameRequired/OptionalData typeDefaultDescription
rowsRequiredNumber of rows.
colsRequiredNumber of columns.

Returns

ApiTable

Example

Add a table with multiple rows and columns to a presentation.

// How do I insert a table with specific dimensions in a presentation?

// Create a table with 2 rows and 4 columns and place it on a slide in a presentation.

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