# TextPartCollection Object

> Contains all text parts in a TX Text Control document.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Object
- **Introduced:** 28.0
- **Path:** TX Text Control .NET Server > Reference > JavaScript API > TextPartCollection Object
- **614 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/textpartcollection/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/textpartcollection/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/textpartcollection/llms-full.txt

---

### Description

Contains all text parts in a TX Text Control document.

### Syntax

```javascript
TextPartCollection
```

### Examples

The following example demonstrates `TextPartCollection` in a practical document-editing workflow. It contains all text parts in a TX Text Control document.

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

TXTextControl.textParts.getItem(
    function(subTextPart) {
        if (!subTextPart) {
            console.warn("No sub text part was returned.");
            return;
        }
        
        console.log("get item result:", subTextPart);
    },
    onTxError
);
```

---

## In This Section

- [Javascript: TextPartCollection.activate Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/textpartcollection/activate-method/llms-full.txt): Sets the input focus to the specified text part. If the activated text part is not in the visible part of the document, the document is scrolled.
- [Javascript: TextPartCollection.getItem Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/textpartcollection/getitem-method/llms-full.txt): Gets the text part with the input focus.
- [Javascript: TextPartCollection.getMainText Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/textpartcollection/getmaintext-method/llms-full.txt): Gets the main text part of the document.

---

## Nearby

- **Previous:** [Javascript: TextPart.type Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/textpart/type-property/llms-full.txt)
- **Next:** [Javascript: TextPartCollection.activate Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/textpartcollection/activate-method/llms-full.txt)
