# TableOfContentsCollection Object

> Contains all tables of contents in a certain part of the document.

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

---

### Description

Contains all tables of contents in a certain part of the document.

### Syntax

```javascript
TableOfContentsCollection
```

### Examples

The following example demonstrates `TableOfContentsCollection` in a practical document-editing workflow. It contains all tables of contents in a certain part of the document.

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

function inspectTableOfContentsCollection(tableOfContentss) {
    tableOfContentss.getItem(
        function(toc) {
            if (!toc) {
                console.warn("No table of contents was returned.");
                return;
            }
            
            console.log("get item result:", toc);
        },
        onTxError,
        25
    );
}
```

---

## In This Section

- [Javascript: TableOfContentsCollection.add Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/tableofcontentscollection/add-method/llms-full.txt): Adds a new table of contents to the document at the current text input position.
- [Javascript: TableOfContentsCollection.getItem Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/tableofcontentscollection/getitem-method/llms-full.txt): Gets the table of contents at the current input position or the table of contents with the specified identifier.
- [Javascript: TableOfContentsCollection.getItemByName Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/tableofcontentscollection/getitembyname-method/llms-full.txt): Gets the table of contents with the specified name.
- [Javascript: TableOfContentsCollection.remove Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/tableofcontentscollection/remove-method/llms-full.txt): Removes a table of contents from the collection including all its text and including all DocumentTargets to where the table's links point.

---

## Nearby

- **Previous:** [TableOfContentsCallback Function](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/tableofcontentscallback/llms-full.txt)
- **Next:** [Javascript: TableOfContentsCollection.add Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/tableofcontentscollection/add-method/llms-full.txt)
