# TextPartCollection Class

> An instance of the Web.TextPartCollection class contains all text parts in a TX Text Control document. A text part can either be the document's main text, a text frame or a header or footer. A text frame is represented through a Web.TextFrame object, a header or footer through a Web.HeaderFooter object and the document's main text is represented through a Web.MainText object. A Web.TextPartCollection object contains all these objects in a geometric order. The first object in the collection is the main text, followed by all text frames in geometric order. At the end of the collection all headers and footers are contained also geometrically ordered. All objects in a text part collection implement the Web.IFormattedText interface. The collection can be obtained with the Web.TextControl.TextParts property. The Web.TextPartCollection class implements the interface ICollection<Web.IFormattedText>.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Class
- **Introduced:** 22.0
- **Namespace:** `TXTextControl.Web`
- **Package:** `TXTextControl.Web` (assembly `TXTextControl.Web.DocumentEditor.dll`, from nuget.org, the private NuGet feed or Text Control Offline Packages)
- **Implements:** `System.Collections.Generic.ICollection<TXTextControl.Web.IFormattedText>`, `System.Collections.Generic.IEnumerable<TXTextControl.Web.IFormattedText>`, `System.Collections.IEnumerable`
- **Path:** TX Text Control .NET Server > Reference > TXTextControl.Web > TextPartCollection Class
- **1053 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web/textpartcollection/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web/textpartcollection/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web/textpartcollection/llms-full.txt

---

### Description

An instance of the Web.TextPartCollection class contains all text parts in a TX Text Control document. A text part can either be the document's main text, a text frame or a header or footer. A text frame is represented through a [Web.TextFrame](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web/textframe/llms-full.txt) object, a header or footer through a [Web.HeaderFooter](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web/headerfooter/llms-full.txt) object and the document's main text is represented through a [Web.MainText](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web/maintext/llms-full.txt) object. A Web.TextPartCollection object contains all these objects in a geometric order. The first object in the collection is the main text, followed by all text frames in geometric order. At the end of the collection all headers and footers are contained also geometrically ordered. All objects in a text part collection implement the [Web.IFormattedText](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web/iformattedtext/llms-full.txt) interface. The collection can be obtained with the [Web.TextControl.TextParts](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web/textcontrol/textparts-property/llms-full.txt) property. The Web.TextPartCollection class implements the interface ICollection<Web.IFormattedText>.

### Syntax

```csharp
public class TextPartCollection : ICollection<IFormattedText>, IEnumerable<IFormattedText>, IEnumerable
```

```vbnet
Public Class TextPartCollection
    Implements ICollection(Of IFormattedText), IEnumerable(Of IFormattedText), IEnumerable
```

### Examples

The following example creates a Text Part Collection object and prepares it for a document workflow.

```csharp
TXTextControl.Web.TextPartCollection textPartCollection = new(new TXTextControl.Web.WebSocketHandler());
Console.WriteLine("Text Part Collection is ready for the document workflow.");
```

```vbnet
Dim textPartCollection As New TXTextControl.Web.TextPartCollection(New TXTextControl.Web.WebSocketHandler())
Console.WriteLine("Text Part Collection is ready for the document workflow.")
```

---

## In This Section

- [TextPartCollection.Activate Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web/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.

---

## Nearby

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