跳到主要内容

CreateTable

创建具有指定行数和列数的新表格。

语法

expression.CreateTable(cols, rows);

expression - 表示 Api 类的变量。

参数

名称必需/可选数据类型默认值描述
cols必需number列数。
rows必需number行数。

返回值

ApiTable

示例

此示例创建一个 3x3 的表格并将其插入到文档中。

// Creates a table, adds it to the document, and sets its width to 100%.

// How to create the ApiTable object and add it to the ApiDocument class.

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