跳到主要内容

Split

将单元格拆分为指定数量的行和列。

语法

expression.Split(oCell, nRow, nCol);

expression - 表示 ApiTable 类的变量。

参数

名称必需/可选数据类型默认值描述
oCell可选ApiTableCell将被拆分的单元格。
nRow可选Number1单元格将拆分成的行数。
nCol可选Number1单元格将拆分成的列数。

返回值

ApiTable | null

示例

此示例将单元格拆分为指定数量的行和列。

// How to divide the table cell.

// Split the table cell into specific number of rows and columns.

let doc = Api.GetDocument();
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
let table = Api.CreateTable(3, 3);
table.SetWidth("percent", 100);
table.SetStyle(tableStyle);
doc.Push(table);
let cell = table.GetCell(0, 0);
table.Split(cell, 2, 2);