DocumentTarget Object
Description
The DocumentTarget object represents a text position in a Text Control document that is a target of a document link.
Syntax
DocumentTargetExamples
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
| Method | Description |
|---|---|
| getAutoGenerationType | 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. |
| getDeleteable | Gets whether a document target can be deleted by the end-user while a TX Text Control document is being edited. |
| getID | Gets an identifier for a document target. |
| getName | Relates a user-defined name to a document target. |
| getNumber | Gets the one-based number of the document target in the document. |
| getStart | Gets the first character position (one-based) of a document target. |
| getTargetName | Gets the name of the document target. |
| scrollTo | Sets the current input position to the beginning of the document target and scrolls it into the visible part of the document. |
| setDeleteable | Sets whether a document target can be deleted by the end-user while a TX Text Control document is being edited. |
| setID | Sets an identifier for the document target. |
| setName | Sets the name of a document target. |
| setTargetName | Sets the name of the document target. |