TX Text Control .NET Server

Javascript: CommentedText.getNumber Method

Method|Introduced in 30.0

Description

Gets the comment's number. The first comment in the document has the number 1. The number is defined through the textflow. Commented text with a smaller start position has a smaller comment number.

Syntax

<void> CommentedText.getNumber(<RequestNumberCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Receives the property value.

errorCallback

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

Examples

The following example demonstrates CommentedText.getNumber in a practical document-editing workflow. It gets the comment's number. The first comment in the document has the number 1. The number is defined through the textflow. Commented text with a smaller start position has a smaller comment number.

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

TXTextControl.textParts.getMainText(function(mainText) {
    const comments = mainText.comments;
    comments.getItem(function(commentedText) {
        if (!commentedText) {
            console.warn("No commented text is available at the current input position.");
            return;
        }
    
        commentedText.getNumber(
            function(result) {
                console.log("get number result:", result);
            },
            onTxError
        );
    }, onTxError);
}, onTxError);