跳到主要内容

MergeCells

合并当前行中的单元格。

语法

expression.MergeCells();

expression - 表示 ApiTableRow 类的变量。

参数

此方法没有任何参数。

返回值

ApiTableCell | null

示例

此示例合并行中的单元格。

// Merge cells of the entire row.

// Combine the entire row cells.

let doc = Api.GetDocument();
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
let table = Api.CreateTable(3, 3);
table.SetStyle(tableStyle);
let row = table.GetRow(0);
table.SetWidth("percent", 100);
row.MergeCells();
doc.Push(table);