TX Text Control .NET Server

SubTextPartCollection Object

Object|Introduced in 28.0

Description

The SubTextPartCollection object represents a collection of subtextparts.

Syntax

SubTextPartCollection

Examples

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

MethodDescription
addAdds a new SubTextPart to the collection.
clearRemoves all subtextparts from a Text Control document.
elementAtReturns the element at a specified index in the collection. (Inherited from Collection.)
forEachExecutes a callback function for each element. (Inherited from Collection.)
getCountGets the number of elements contained in the collection. (Inherited from Collection.)
getItemGets the subtextpart at the current text input position.
removeRemoves a subtextpart from the collection including all its nested subtextparts.

Enumerations

EnumerationDescription
AddResultSpecifies the result when a subtextpart has been added to the document.