Javascript: Table.splitCells Method
Description
Splits all selected table cells in this table. Only previously merged cells can be split. The getCanSplitCells method can be used to determine, if table cells can be split or not.
Syntax
<void> Table.splitCells([<RequestBooleanCallback> callback], [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| callback | Optional. Receives whether the cells could be split. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates Table.splitCells in a practical document-editing workflow. It splits all selected table cells in this table. Only previously merged cells can be split. The getCanSplitCells method can be used to determine, if table cells can be split or not.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
TXTextControl.textParts.getMainText(function(mainText) {
const tables = mainText.tables;
tables.getItem(function(table) {
if (!table) {
console.warn("No table is available at the current input position.");
return;
}
table.splitCells(
function(result) {
if (result) {
console.log("split cells is available.");
} else {
console.warn("split cells is not available in the current document state.");
}
},
onTxError
);
}, onTxError);
}, onTxError);