TX Text Control .NET Server

Javascript: TextPartCollection.getMainText Method

Method|Introduced in 28.0

Description

Gets the main text part of the document.

Syntax

<void> TextPartCollection.getMainText([<RequestTextPartCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Optional. Receives the main text textpart object.

errorCallback

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

Examples

The following example demonstrates TextPartCollection.getMainText in a practical document-editing workflow. It gets the main text part of the document.

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

TXTextControl.textParts.getMainText(
    function(textPart) {
        if (!textPart) {
            console.warn("No formatted text was returned.");
            return;
        }
        
        console.log("get main text result:", textPart);
    },
    onTxError
);