跳到主要内容

Split

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

语法

expression.Split(nRow, nCol);

expression - 表示 ApiTableCell 类的变量。

参数

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

返回值

ApiTable | null

示例

在文档中将表格单元格分割为多行多列。

// How do I split one table cell into several smaller cells in a document?

// Break a single cell apart into a grid of cells to reorganize a table in a document.

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);
cell.Split(2, 2);