# SectionCollection Object

> Contains all sections of a document. A document has at least one section.

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

---

### Description

Contains all sections of a document. A document has at least one section.

### Syntax

```javascript
SectionCollection
```

### Examples

The following example demonstrates `SectionCollection` in a practical document-editing workflow. It contains all sections of a document. A document has at least one section.

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

TXTextControl.sections.getItem(
    function(section) {
        if (!section) {
            console.warn("No section was returned.");
            return;
        }
        
        console.log("get item result:", section);
    },
    1,
    onTxError
);
```

---

## In This Section

- [Javascript: SectionCollection.add Method](https://docs.textcontrol.com/ds-server/reference/javascript/sectioncollection/add-method/llms-full.txt): Adds a new section at the current text input position. The new section ends at the end position of the section containing the input position. If a new section is inserted in a paragraph or table, the paragraph or table is split into two paragraphs or tables.
- [Javascript: SectionCollection.addAtTextPosition Method](https://docs.textcontrol.com/ds-server/reference/javascript/sectioncollection/addattextposition-method/llms-full.txt): Adds a new section at the specified text input position. The new section ends at the end position of the section containing the input position. If a new section is inserted in a paragraph or table, the paragraph or table is split into two paragraphs or tables.
- [Javascript: SectionCollection.getItem Method](https://docs.textcontrol.com/ds-server/reference/javascript/sectioncollection/getitem-method/llms-full.txt): Gets the section at the current input position or or the section in the collection with the given number.

---

## Nearby

- **Previous:** [Javascript: Section.select Method](https://docs.textcontrol.com/ds-server/reference/javascript/section/select-method/llms-full.txt)
- **Next:** [Javascript: SectionCollection.add Method](https://docs.textcontrol.com/ds-server/reference/javascript/sectioncollection/add-method/llms-full.txt)
