SubTextPartCollection Object
Description
The SubTextPartCollection object represents a collection of subtextparts.
Syntax
SubTextPartCollectionExamples
The following example demonstrates SubTextPartCollection in a practical document-editing workflow. The SubTextPartCollection object represents a collection of subtextparts.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
TXTextControl.textParts.getMainText(function(mainText) {
const subTextParts = mainText.subTextParts;
subTextParts.getItem(
function(subTextPart) {
if (!subTextPart) {
console.warn("No sub text part was returned.");
return;
}
console.log("get item result:", subTextPart);
},
onTxError
);
}, onTxError);Members
Methods
| Method | Description |
|---|---|
| add | Adds a new SubTextPart to the collection. |
| clear | Removes all subtextparts from a Text Control document. |
| 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.) |
| getCount | Gets the number of elements contained in the collection. (Inherited from Collection.) |
| getItem | Gets the subtextpart at the current text input position. |
| remove | Removes a subtextpart from the collection including all its nested subtextparts. |
Enumerations
| Enumeration | Description |
|---|---|
| AddResult | Specifies the result when a subtextpart has been added to the document. |