Skip to main content

MergeCells

Merges the cells in the current row.

Syntax

expression.MergeCells();

expression - A variable that represents a ApiTableRow class.

Parameters

This method doesn't have any parameters.

Returns

ApiTableCell | null

Example

Combine all cells in a table row into a single cell in a document.

// How do I join every cell across a row so they become one in a document?

// Collapse a row's individual cells into one unified cell to span the full width 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.SetStyle(tableStyle);
let row = table.GetRow(0);
table.SetWidth("percent", 100);
row.MergeCells();
doc.Push(table);