# TableOfContents Class

> A TableOfContents object defines the position and the properties of a table of contents. A table of contents can be automatically genarated from the structure levels defined for each paragraph in the document. A document can contain multiple tables of contents consisting of paragraphs with different levels. All tables of contents in a document are available through a TableOfContentsCollection object. To generate a new table of contents the TableOfContentsCollection.Add method can be used.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Class
- **Introduced:** 29.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WPF.SDK` (assembly `TXTextControl.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.dll` from the setup
- **Path:** TX Text Control .NET for WPF > Reference > TXTextControl > TableOfContents Class
- **1620 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontents/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontents/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontents/llms-full.txt

---

### Description

A TableOfContents object defines the position and the properties of a table of contents. A table of contents can be automatically genarated from the structure levels defined for each paragraph in the document. A document can contain multiple tables of contents consisting of paragraphs with different levels. All tables of contents in a document are available through a [TableOfContentsCollection](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontentscollection/llms-full.txt) object. To generate a new table of contents the [TableOfContentsCollection.Add](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontentscollection/add-method/llms-full.txt) method can be used.

### Syntax

```csharp
public class TableOfContents
```

```vbnet
Public Class TableOfContents
```

### Examples

The following example creates a table of contents for the document's heading styles.

```csharp
TableOfContents tableOfContents = new(1, 3) { Name = "Contents", ID = 10 };
textControl.TablesOfContents.Add(tableOfContents);
```

```vbnet
Dim tableOfContents As New TableOfContents(1, 3) With { .Name = "Contents", .ID = 10 }
textControl.TablesOfContents.Add(tableOfContents)
```

---

## In This Section

- [TableOfContents Constructor](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontents/constructor/llms-full.txt): Initializes a new instance of the TableOfContents class.
- [TableOfContents.DefaultHighlightColor Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontents/defaulthighlightcolor-property/llms-full.txt): Represents the default highlight color. It is black with an alpha value of 60.
- [TableOfContents.HasLinks Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontents/haslinks-property/llms-full.txt): Gets or sets a value specifying whether each entry in the table of contents is a DocumentLink with a corresponding DocumentTarget. When the end-user clicks on the link while pressing the CTRL-key, the document is scrolled to the paragraph in the document that belongs to the entry in the table of contents.
- [TableOfContents.HasPageNumbers Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontents/haspagenumbers-property/llms-full.txt): Gets or sets a value specifying whether the table of contents contains page numbers.
- [TableOfContents.HasRightAlignedPageNumbers Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontents/hasrightalignedpagenumbers-property/llms-full.txt): Gets or sets a value specifying whether the page numbers in the table of contents are right-aligned. To realize right-aligned page numbers a tab is inserted and its TabType is set to RightBorderTab.
- [TableOfContents.HighlightColor Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontents/highlightcolor-property/llms-full.txt): Gets or sets the highlight color for the table of contents. Depending on the HighlightMode a table of contents is highlighted, if it contains the current text input position, is always highlighted or never. The color's alpha value must be less than 255 (opaque) so that the text remains visible. The default value is black with an alpha value of 60.
- [TableOfContents.HighlightMode Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontents/highlightmode-property/llms-full.txt): Gets or sets a value indicating how the text of the table of contents is highlighted.
- [TableOfContents.ID Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontents/id-property/llms-full.txt): Gets or sets an identifier. It must be a one-based value. A value of zero indicates that the table of contents has no identifier.
- [TableOfContents.Length Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontents/length-property/llms-full.txt): Gets the number of characters which belong to the table of contents.
- [TableOfContents.MaximumStructureLevel Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontents/maximumstructurelevel-property/llms-full.txt): Gets or sets the maximum structure level for this table of contents. The table of contents contains all paragraphs with a structure level less than or equal this value. It must be between 1 and 10.
- [TableOfContents.MinimumStructureLevel Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontents/minimumstructurelevel-property/llms-full.txt): Gets or sets the minimum structure level for this table of contents. The table of contents contains all paragraphs with a structure level larger than or equal this value. It must be between 1 and 10.
- [TableOfContents.Name Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontents/name-property/llms-full.txt): Gets or sets a name for the table of contents. An empty string indicates that the table of contents has no name.
- [TableOfContents.Number Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontents/number-property/llms-full.txt): Gets the number of the table of contents in the text. The first table of contents has the number 1. The number is defined through the textflow. A table of contents with a smaller start position has a smaller number.
- [TableOfContents.Save Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontents/save-method/llms-full.txt): Saves the text of the table of contents with the specified format.
- [TableOfContents.ScrollTo Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontents/scrollto-method/llms-full.txt): Sets the current input position to the beginning of the table of contents and scrolls it into the visible part of the document.
- [TableOfContents.Start Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontents/start-property/llms-full.txt): Gets the index (one-based) of the first character which belongs to the table of contents.
- [TableOfContents.Text Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontents/text-property/llms-full.txt): Gets the text of the table of contents.
- [TableOfContents.Title Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontents/title-property/llms-full.txt): Gets or sets a title for the table of contents. An empty string indicates that the table of contents has no title.
- [TableOfContents.Update Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontents/update-method/llms-full.txt): Updates the content and the page numbers of the table of contents.

---

## Nearby

- **Previous:** [TableEventArgs.Table Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableeventargs/table-property/llms-full.txt)
- **Next:** [TableOfContents Constructor](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontents/constructor/llms-full.txt)
