TX Text Control .NET Server

DocumentTarget Object

Object|Introduced in 28.0

Description

The DocumentTarget object represents a text position in a Text Control document that is a target of a document link.

Syntax

DocumentTarget

Examples

The following example demonstrates DocumentTarget in a practical document-editing workflow. The DocumentTarget object represents a text position in a Text Control document that is a target of a document link.

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.getID(
            function(result) {
                console.log("get id result:", result);
            },
            onTxError
        );
    }, onTxError);
}, onTxError);

Members

Methods

MethodDescription
getAutoGenerationTypeGets 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.
getDeleteableGets whether a document target can be deleted by the end-user while a TX Text Control document is being edited.
getIDGets an identifier for a document target.
getNameRelates a user-defined name to a document target.
getNumberGets the one-based number of the document target in the document.
getStartGets the first character position (one-based) of a document target.
getTargetNameGets the name of the document target.
scrollToSets the current input position to the beginning of the document target and scrolls it into the visible part of the document.
setDeleteableSets whether a document target can be deleted by the end-user while a TX Text Control document is being edited.
setIDSets an identifier for the document target.
setNameSets the name of a document target.
setTargetNameSets the name of the document target.