TX Text Control .NET Server

TableOfContents Class

Class|Introduced in 29.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.Core.SDK from the private NuGet feed or Text Control Offline Packages
Assembly
TXTextControl.Core.dll
Install
dotnet add package TXTextControl.TextControl.Core.SDK .NET 8 and later. For .NET Framework, reference TXTextControl.dll from the setup.
Also in
TXTextControl.TextControl.ASP.SDK as TXTextControl.dll

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 object. To generate a new table of contents the TableOfContentsCollection.Add method can be used.

Syntax

public class TableOfContents

Examples

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

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

Members

Constructors

ConstructorDescription
TableOfContentsInitializes a new instance of the TableOfContents class.

Properties

PropertyDescription
DefaultHighlightColorRepresents the default highlight color. It is black with an alpha value of 60.
HasLinksGets 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.
HasPageNumbersGets or sets a value specifying whether the table of contents contains page numbers.
HasRightAlignedPageNumbersGets 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.
HighlightColorGets 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.
HighlightModeGets or sets a value indicating how the text of the table of contents is highlighted.
IDGets or sets an identifier. It must be a one-based value. A value of zero indicates that the table of contents has no identifier.
LengthGets the number of characters which belong to the table of contents.
MaximumStructureLevelGets 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.
MinimumStructureLevelGets 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.
NameGets or sets a name for the table of contents. An empty string indicates that the table of contents has no name.
NumberGets 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.
StartGets the index (one-based) of the first character which belongs to the table of contents.
TextGets the text of the table of contents.
TitleGets or sets a title for the table of contents. An empty string indicates that the table of contents has no title.

Methods

MethodDescription
SaveSaves the text of the table of contents with the specified format.
ScrollToSets the current input position to the beginning of the table of contents and scrolls it into the visible part of the document.
UpdateUpdates the content and the page numbers of the table of contents.

Further Reading