TX Text Control .NET Server

Javascript: TableCellFormat.getNumberFormat Method

Method|Introduced in 28.0

Description

Gets a number format for the table cell. The number format is used, when a formula is defined and the table cell's text is automatically calculated. When a number format is not defined, the property's value is an empty string. The number format string has a format as described in Office Open XML File Formats - ISO/IEC 29500 - 1, Chapter: 18.8.31 Number Formats.

Syntax

<void> TableCellFormat.getNumberFormat(<RequestNumberFormatCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Receives the number format for the cell.

errorCallback

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

Examples

The following example demonstrates TableCellFormat.getNumberFormat in a practical document-editing workflow. It gets a number format for the table cell. The number format is used, when a formula is defined and the table cell's text is automatically calculated. When a number format is not defined, the property's value is an empty string. The number format string has a format as described in Office Open XML File Formats - ISO/IEC 29500 - 1, Chapter: 18.8.31 Number Formats.

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

function inspectNumberFormat(tableCellFormat) {
    tableCellFormat.getNumberFormat(
        function(result) {
            if (!result) {
                console.warn("No number format was returned.");
                return;
            }
            
            console.log("get number format result:", result);
        },
        onTxError
    );
}