TX Text Control .NET Server

Javascript: Paragraph.getStartLine Method

Method|Introduced in 28.0

Description

Gets the number (one-based) of the paragraph's first line.

Syntax

<void> Paragraph.getStartLine(<RequestNumberCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Receives the number (one-based) of the paragraph's first line.

errorCallback

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

Examples

The following example demonstrates Paragraph.getStartLine in a practical document-editing workflow. It gets the number (one-based) of the paragraph's first line.

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

TXTextControl.textParts.getMainText(function(mainText) {
    const paragraphs = mainText.paragraphs;
    paragraphs.getItem(function(paragraph) {
        if (!paragraph) {
            console.warn("No paragraph is available at the current input position.");
            return;
        }
    
        paragraph.getStartLine(
            function(result) {
                console.log("get start line result:", result);
            },
            onTxError
        );
    }, onTxError);
}, onTxError);