DS Server

Javascript: TableCellFormat.getTextType Method

Method|Introduced in 28.0

Description

Gets the text type of the table cell which determines whether the cell's text is interpreted as a number or as text When the type is Text, the cell's text is interpreted as text and it is displayed as it is. When the type is Number, the cell's text is interpreted as a number. The period character (.) is defined as decimal separator, the comma character (,) is defined as thousands separator.

Syntax

<void> TableCellFormat.getTextType(<RequestTextTypeCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Receives the cell's set text type.

errorCallback

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

Examples

The following example demonstrates TableCellFormat.getTextType in a practical document-editing workflow. It gets the text type of the table cell which determines whether the cell's text is interpreted as a number or as text When the type is Text, the cell's text is interpreted as text and it is displayed as it is. When the type is Number, the cell's text is interpreted as a number. The period character (.) is defined as decimal separator, the comma character (,) is defined as thousands separator.

function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

function inspectTextType(tableCellFormat) {
    tableCellFormat.getTextType(
        function(textType) {
            if (!textType) {
                console.warn("No text type was returned.");
                return;
            }
            
            console.log("get text type result:", textType);
        },
        onTxError
    );
}