DocumentLink Object
Description
The DocumentLink object represents a text position in a Text Control document that is a target of a document link.
Syntax
DocumentLinkExamples
The following example demonstrates DocumentLink in a practical document-editing workflow. The DocumentLink 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 documentLinks = mainText.documentLinks;
documentLinks.getItem(function(documentLink) {
if (!documentLink) {
console.warn("No document link is available at the current input position.");
return;
}
documentLink.getAutoGenerationType(
function(result) {
console.log("get auto generation type result:", result);
},
onTxError
);
}, onTxError);
}, onTxError);Members
Methods
| Method | Description |
|---|---|
| getAutoGenerationType | Gets the type of auto-generation. A document link in a table of contents is automatically generated when the table of contents is inserted into the document. |
| getBounds | Gets the bounding rectangle of a text field. (Inherited from TextField.) |
| getContainsInputPosition | Returns true, if the Textfield contains the current text input position. (Inherited from TextField.) |
| getDeleteable | Gets whether a text field can be deleted by the end-user while a TX Text Control document is being edited. (Inherited from TextField.) |
| getDescriptiveText | Gets the document link's descriptive text. An empty string indicates that the link has no such text. |
| getDocumentTarget | Gets an object of the type DocumentTarget specifying to where the link points. |
| getDoubledInputPosition | Sets whether a text field has a doubled input position in front of its first character and behind its last character. (Inherited from TextField.) |
| getEditable | Gets whether the text of a text field can be changed by the end-user while a TX Text Control document is being edited. (Inherited from TextField.) |
| getFormattingBounds | Gets the formatting rectangle of a text field. (Inherited from TextField.) |
| getHighlightColor | Gets the highlight color for the text field. (Inherited from TextField.) |
| getHighlightMode | Gets a value indicating when the text field is highlighted. (Inherited from TextField.) |
| getID | Gets an identifier for a text field. (Inherited from TextField.) |
| getIsSpellCheckingEnabled | Gets whether a text field's text is checked on misspelled words. (Inherited from TextField.) |
| getLength | Gets the number of characters in a text field. (Inherited from TextField.) |
| getName | Relates a user-defined name to a text field. (Inherited from TextField.) |
| getStart | Gets the first character position (one-based) of a text field. (Inherited from TextField.) |
| getText | Gets the text which is contained within a text field. (Inherited from TextField.) |
| scrollTo | Sets the current input position to the beginning of a text field and scrolls it into the visible part of the document. (Inherited from TextField.) |
| setDeleteable | Sets whether a text field can be deleted by the end-user while a TX Text Control document is being edited. (Inherited from TextField.) |
| setDescriptiveText | Sets the document link's descriptive text. An empty string or null can be used to delete a previously set text. |
| setDocumentTarget | Sets an object of the type DocumentTarget specifying to where the link points. |
| setDoubledInputPosition | Gets whether a text field has a doubled input position in front of its first character and behind its last character. (Inherited from TextField.) |
| setEditable | Sets whether the text of a text field can be changed by the end-user while a TX Text Control document is being edited. (Inherited from TextField.) |
| setHighlightColor | Sets the highlight color for the text field. (Inherited from TextField.) |
| setHighlightMode | Sets a value indicating when the text field is highlighted. (Inherited from TextField.) |
| setID | Sets an identifier for the text field. (Inherited from TextField.) |
| setIsSpellCheckingEnabled | Gets whether a text field's text is checked on misspelled words. (Inherited from TextField.) |
| setName | Sets the name of a text field. (Inherited from TextField.) |
| setText | Sets the text which is contained within a text field. (Inherited from TextField.) |