TX Text Control .NET Server

Javascript: Table.getCanSplit Method

Method|Introduced in 28.0

Description

Checks whether this table can be split. A table can only be split if it contains the current input position and no further text is selected.

Syntax

<void> Table.getCanSplit(<RequestBooleanCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Receives whether this table can be split.

errorCallback

Optional. Is called when the operation failed with an error.

Examples

The following example demonstrates Table.getCanSplit in a practical document-editing workflow. It checks whether this table can be split. A table can only be split if it contains the current input position and no further text is selected.

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.getCanSplit(
            function(result) {
                if (result) {
                    console.log("get can split is available.");
                } else {
                    console.warn("get can split is not available in the current document state.");
                }
            },
            onTxError
        );
    }, onTxError);
}, onTxError);