DocumentTargetCollection Object
Description
The DocumentTargetCollection contains a collection of targets.
Syntax
DocumentTargetCollectionExamples
The following example demonstrates DocumentTargetCollection in a practical document-editing workflow. The DocumentTargetCollection contains a collection of targets.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
TXTextControl.textParts.getMainText(function(mainText) {
const documentTargets = mainText.documentTargets;
documentTargets.getCanAdd(
function(result) {
if (result) {
console.log("get can add is available.");
} else {
console.warn("get can add is not available in the current document state.");
}
},
onTxError
);
}, onTxError);Members
Methods
| Method | Description |
|---|---|
| add | Adds a new document target to the collection. |
| clear | Removes all document targets from the collection. |
| elementAt | Returns the element at a specified index in the collection. (Inherited from Collection.) |
| forEach | Executes a callback function for each element. (Inherited from Collection.) |
| getCanAdd | Gets a value indicating whether a new document target can be inserted at the current input position. |
| getCount | Gets the number of elements contained in the collection. (Inherited from Collection.) |
| getItem | Gets the document target at the current text input position or the document target with the specified id. |
| remove | Removes the target from the collection. |