TX Text Control .NET Server

Javascript: DocumentTarget.getAutoGenerationType Method

Method|Introduced in 29.0

Description

Gets the type of auto-generation. A document target which is the target of an entry in a table of contents is automatically generated when the table of contents is inserted into the document.

Syntax

<void> DocumentTarget.getAutoGenerationType(<RequestNumberCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Receives the document target's auto generation type.

errorCallback

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

Examples

The following example demonstrates DocumentTarget.getAutoGenerationType in a practical document-editing workflow. It gets the type of auto-generation. A document target which is the target of an entry in a table of contents is automatically generated when the table of contents is inserted into the document.

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

TXTextControl.textParts.getMainText(function(mainText) {
    const documentTargets = mainText.documentTargets;
    documentTargets.getItem(function(documentTarget) {
        if (!documentTarget) {
            console.warn("No document target is available at the current input position.");
            return;
        }
    
        documentTarget.getAutoGenerationType(
            function(result) {
                console.log("get auto generation type result:", result);
            },
            onTxError
        );
    }, onTxError);
}, onTxError);