跳到主要内容

CreateTable

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

语法

expression.CreateTable(cols, rows);

expression - 表示 Api 类的变量。

参数

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

返回值

ApiTable

示例

创建 3x3 表格并将其插入文档。

// 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);