# ParagraphCollection Object

> A ParagraphCollection contains all paragraphs in a Text Control document or part of the document.

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

---

### Description

A ParagraphCollection contains all [paragraphs](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/paragraph/llms-full.txt) in a Text Control document or part of the document.

### Syntax

```javascript
ParagraphCollection
```

### Examples

The following example demonstrates `ParagraphCollection` in a practical document-editing workflow. A ParagraphCollection contains all paragraphs in a Text Control document or part of the document.

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

TXTextControl.textParts.getMainText(function(mainText) {
    const paragraphs = mainText.paragraphs;
    paragraphs.getItem(
        -1,
        function(result) {
            if (!result) {
                console.warn("No paragraph was returned.");
                return;
            }
            
            console.log("get item result:", result);
        },
        onTxError
    );
}, onTxError);
```

---

## In This Section

- [Javascript: ParagraphCollection.getItem Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/paragraphcollection/getitem-method/llms-full.txt): Gets a particular Paragraph from the collection.
- [Javascript: ParagraphCollection.getItemAtLocation Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/paragraphcollection/getitematlocation-method/llms-full.txt): Gets the Paragraph at a certain geometrical position.

---

## Nearby

- **Previous:** [Javascript: Paragraph.setFormattingStyle Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/paragraph/setformattingstyle-method/llms-full.txt)
- **Next:** [Javascript: ParagraphCollection.getItem Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/paragraphcollection/getitem-method/llms-full.txt)
