DS Server

FormattedText Object

Object|Introduced in 28.0

Description

Represents a part of the document.

Syntax

FormattedText

Examples

The following example demonstrates FormattedText in a practical document-editing workflow. It represents a part of the document.

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

TXTextControl.textParts.getMainText(function(formattedText) {
    formattedText.getTextFieldsByType(
        TXTextControl.TextFieldType.ApplicationField,
        function(textFields) {
            if (!textFields) {
                console.warn("No text field info was returned.");
                return;
            }
            
            console.log("get text fields by type result:", textFields);
        },
        onTxError
    );
}, onTxError);

Members

Properties

PropertyDescription
applicationFieldsGets a collection of all Microsoft Word fields that have been created or imported from a Microsoft Word or RTF document.
commentsGets a collection of all comments in this text part.
documentLinksGets a collection of all links which point to targets in the same document.
documentTargetsGets a collection of all document targets.
editableRegionsGets a collection of all editable regions.
formFieldsGets a collection of all form fields in the text part.
framesGets a collection of all frames in the document.
hypertextLinksGets a collection of all hypertext links.
linesGets a collection of all text lines.
misspelledWordsGets a collection of all misspelled words.
paragraphsGets a collection of all paragraphs.
selectionGets the current selection.
subTextPartsGets the current subtextparts.
tablesGets a collection of all tables.
tablesOfContentsGets the current tables of contents.
textCharsGets a collection of all text characters.
textFieldsGets a collection of all standard text fields.
textPartTypeGets the Text part type. Possible values are "mainText", "headerFooter" and "textFrame".
trackedChangesGets a collection of all tracked changes.

Methods

MethodDescription
findFinds a text string. The search starts at the specified position.
getTextFieldsByTypeReturns an array of static text field information objects.