# FormattedText Object

> Represents a part of the document.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Object
- **Introduced:** 28.0
- **Path:** DS Server > Reference > JavaScript API > FormattedText Object
- **1201 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/formattedtext/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/formattedtext/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/formattedtext/llms-full.txt

---

### Description

Represents a part of the document.

### Syntax

```javascript
FormattedText
```

### Examples

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

```javascript
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);
```

---

## In This Section

- [Javascript: FormattedText.applicationFields Property](https://docs.textcontrol.com/ds-server/reference/javascript/formattedtext/applicationfields-property/llms-full.txt): Gets a collection of all Microsoft Word fields that have been created or imported from a Microsoft Word or RTF document.
- [Javascript: FormattedText.comments Property](https://docs.textcontrol.com/ds-server/reference/javascript/formattedtext/comments-property/llms-full.txt): Gets a collection of all comments in this text part.
- [Javascript: FormattedText.documentLinks Property](https://docs.textcontrol.com/ds-server/reference/javascript/formattedtext/documentlinks-property/llms-full.txt): Gets a collection of all links which point to targets in the same document.
- [Javascript: FormattedText.documentTargets Property](https://docs.textcontrol.com/ds-server/reference/javascript/formattedtext/documenttargets-property/llms-full.txt): Gets a collection of all document targets.
- [Javascript: FormattedText.editableRegions Property](https://docs.textcontrol.com/ds-server/reference/javascript/formattedtext/editableregions-property/llms-full.txt): Gets a collection of all editable regions.
- [Javascript: FormattedText.find Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattedtext/find-method/llms-full.txt): Finds a text string. The search starts at the specified position.
- [Javascript: FormattedText.formFields Property](https://docs.textcontrol.com/ds-server/reference/javascript/formattedtext/formfields-property/llms-full.txt): Gets a collection of all form fields in the text part.
- [Javascript: FormattedText.frames Property](https://docs.textcontrol.com/ds-server/reference/javascript/formattedtext/frames-property/llms-full.txt): Gets a collection of all frames in the document.
- [Javascript: FormattedText.getTextFieldsByType Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattedtext/gettextfieldsbytype-method/llms-full.txt): Returns an array of static text field information objects.
- [Javascript: FormattedText.hypertextLinks Property](https://docs.textcontrol.com/ds-server/reference/javascript/formattedtext/hypertextlinks-property/llms-full.txt): Gets a collection of all hypertext links.
- [Javascript: FormattedText.lines Property](https://docs.textcontrol.com/ds-server/reference/javascript/formattedtext/lines-property/llms-full.txt): Gets a collection of all text lines.
- [Javascript: FormattedText.misspelledWords Property](https://docs.textcontrol.com/ds-server/reference/javascript/formattedtext/misspelledwords-property/llms-full.txt): Gets a collection of all misspelled words.
- [Javascript: FormattedText.paragraphs Property](https://docs.textcontrol.com/ds-server/reference/javascript/formattedtext/paragraphs-property/llms-full.txt): Gets a collection of all paragraphs.
- [Javascript: FormattedText.selection Property](https://docs.textcontrol.com/ds-server/reference/javascript/formattedtext/selection-property/llms-full.txt): Gets the current selection.
- [Javascript: FormattedText.subTextParts Property](https://docs.textcontrol.com/ds-server/reference/javascript/formattedtext/subtextparts-property/llms-full.txt): Gets the current subtextparts.
- [Javascript: FormattedText.tables Property](https://docs.textcontrol.com/ds-server/reference/javascript/formattedtext/tables-property/llms-full.txt): Gets a collection of all tables.
- [Javascript: FormattedText.tablesOfContents Property](https://docs.textcontrol.com/ds-server/reference/javascript/formattedtext/tablesofcontents-property/llms-full.txt): Gets the current tables of contents.
- [Javascript: FormattedText.textChars Property](https://docs.textcontrol.com/ds-server/reference/javascript/formattedtext/textchars-property/llms-full.txt): Gets a collection of all text characters.
- [Javascript: FormattedText.textFields Property](https://docs.textcontrol.com/ds-server/reference/javascript/formattedtext/textfields-property/llms-full.txt): Gets a collection of all standard text fields.
- [Javascript: FormattedText.textPartType Property](https://docs.textcontrol.com/ds-server/reference/javascript/formattedtext/textparttype-property/llms-full.txt): Gets the Text part type. Possible values are "mainText", "headerFooter" and "textFrame".
- [Javascript: FormattedText.trackedChanges Property](https://docs.textcontrol.com/ds-server/reference/javascript/formattedtext/trackedchanges-property/llms-full.txt): Gets a collection of all tracked changes.

---

## Nearby

- **Previous:** [ForEachCallback Function](https://docs.textcontrol.com/ds-server/reference/javascript/foreachcallback/llms-full.txt)
- **Next:** [Javascript: FormattedText.applicationFields Property](https://docs.textcontrol.com/ds-server/reference/javascript/formattedtext/applicationfields-property/llms-full.txt)
