DS Server

ApplicationFieldCollection Object

Object|Introduced in 28.0

Description

Contains all created or imported Microsoft Word fields represented through objects of the type ApplicationField.

Syntax

ApplicationFieldCollection

Examples

The following example demonstrates ApplicationFieldCollection in a practical document-editing workflow. It contains all created or imported Microsoft Word fields represented through objects of the type ApplicationField.

function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

TXTextControl.textParts.getMainText(function(mainText) {
    const applicationFields = mainText.applicationFields;
    applicationFields.getItem(
        function(field) {
            if (!field) {
                console.warn("No application field was returned.");
                return;
            }
            
            console.log("get item result:", field);
        },
        onTxError
    );
}, onTxError);

Members

Methods

MethodDescription
addInserts a new application field at the current input position.
getCanAddGets a value indicating whether a new text field can be inserted at the current input position. (Inherited from TextFieldCollectionBase.)
getItemGets the field at the current input position or null, if there is no such field at the current input position.
removeRemoves a field of the type ApplicationField from a TX Text Control document. The visible text is deleted depending on the keepText parameter.