TX Text Control .NET Server

ApplicationField Object

Object|Introduced in 28.0

Description

The ApplicationField object supports text field formats of applications such as Microsoft Word. The object only provides an interface to retrieve and change the data and parameters of such fields. The field logic itself is not implemented. Currently supported applications and components are Microsoft Word and Heiler HeighEdit.

Syntax

ApplicationField

Examples

The following example demonstrates ApplicationField in a practical document-editing workflow. The ApplicationField object supports text field formats of applications such as Microsoft Word. The object only provides an interface to retrieve and change the data and parameters of such fields. The field logic itself is not implemented. Currently supported applications and components are Microsoft Word and Heiler HeighEdit.

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(applicationField) {
        if (!applicationField) {
            console.warn("No application field is available at the current input position.");
            return;
        }
    
        applicationField.getFormat(
            function(result) {
                console.log("get format result:", result);
            },
            onTxError
        );
    }, onTxError);
}, onTxError);

Members

Methods

MethodDescription
getBoundsGets the bounding rectangle of a text field. (Inherited from TextField.)
getContainsInputPositionReturns true, if the Textfield contains the current text input position. (Inherited from TextField.)
getDeleteableGets whether a text field can be deleted by the end-user while a TX Text Control document is being edited. (Inherited from TextField.)
getDoubledInputPositionSets whether a text field has a doubled input position in front of its first character and behind its last character. (Inherited from TextField.)
getEditableGets 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.)
getFormatGets the field's format.
getFormattingBoundsGets the formatting rectangle of a text field. (Inherited from TextField.)
getHighlightColorGets the highlight color for the text field. (Inherited from TextField.)
getHighlightModeGets a value indicating when the text field is highlighted. (Inherited from TextField.)
getIDGets an identifier for a text field. (Inherited from TextField.)
getIsSpellCheckingEnabledGets whether a text field's text is checked on misspelled words. (Inherited from TextField.)
getLengthGets the number of characters in a text field. (Inherited from TextField.)
getNameRelates a user-defined name to a text field. (Inherited from TextField.)
getParametersGets the field' parameters. The order and format of the strings depend on the field's format. For example a Microsoft Word MergeField has the following format: MERGEFIELD FieldName [switches]. In this case the first string of the array is the FieldName and the following strings are possible switches. The string MERGEFIELD is the type name of the field and can be obtained through getTypeName. If a field has no parameters, this array is null.
getStartGets the first character position (one-based) of a text field. (Inherited from TextField.)
getTextGets the text which is contained within a text field. (Inherited from TextField.)
getTypeNameGets the field's type name. The type name of a Microsoft Word MergeField is MERGEFIELD, for example. If the type name of the field is changed, its parameters must also be changed.
scrollToSets the current input position to the beginning of a text field and scrolls it into the visible part of the document. (Inherited from TextField.)
setDeleteableSets whether a text field can be deleted by the end-user while a TX Text Control document is being edited. (Inherited from TextField.)
setDoubledInputPositionGets whether a text field has a doubled input position in front of its first character and behind its last character. (Inherited from TextField.)
setEditableSets 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.)
setFormatSets the field's format.
setHighlightColorSets the highlight color for the text field. (Inherited from TextField.)
setHighlightModeSets a value indicating when the text field is highlighted. (Inherited from TextField.)
setIDSets an identifier for the text field. (Inherited from TextField.)
setIsSpellCheckingEnabledGets whether a text field's text is checked on misspelled words. (Inherited from TextField.)
setNameSets the name of a text field. (Inherited from TextField.)
setParametersSets the field's parameters.
setTextSets the text which is contained within a text field. (Inherited from TextField.)
setTypeNameSets the field's type name. The type name of a Microsoft Word MergeField is MERGEFIELD, for example. If the type name of the field is changed, its parameters must also be changed.