TX Text Control .NET Server

Javascript: Table.selectCells Method

Method|Introduced in 28.0

Description

Selects the part of the table defined through two table cells.

Syntax

<void> Table.selectCells(<number> startRow, <number> startColumn, <number> stopRow, <number> stopColumn, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
startRow

Specifies the row number where the selection begins.

startColumn

Specifies the column number where the selection begins.

stopRow

Specifies the row number where the selection ends.

stopColumn

Specifies the column number where the selection ends.

callback

Optional. Is called when the operation completed.

errorCallback

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

Examples

The following example demonstrates Table.selectCells in a practical document-editing workflow. It selects the part of the table defined through two table cells.

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.selectCells(
            1,
            1,
            3,
            3,
            function() {
                console.log("select cells completed.");
            },
            onTxError
        );
    }, onTxError);
}, onTxError);