Tables of Contents

A table of contents can be automatically generated from the structure levels defined for each paragraph in the document. The ParagraphFormat.StructureLevel property defines the level of a paragraph, possible values are 0 to 10. A structure level of 0 means, that the paragraph belongs to the body of the document. A level can be specified for each paragraph in the document, but it is more common to define it as an attribute of a ParagraphStyle. To add a new table of contents to the document, the TextControl.TableOfContentsDialog method can be used which offers the end-user a dialgbox for setting all necessary parameters. To do the same thing through programming code, a TableOfContents object must be created and added to the TableOfContentsCollection with its Add method. The document then is searched for all paragraphs with the specified structure levels, generates the table of contents with or without page numbers and adds it at the current text input position. The table of contents is formatted with font and paragraph attributes found in the contained paragraphs. Furthermore, for each level a formatting style is generated so that the end-user can alter these attributes in a simple way. The automatically created styles are named TOC_Title, TOC_Level1, TOC_Level2, .... The TableOfContents object defines the properties of a table of contents, the most important being the minimum and maximum structure level of the paragraphs it should contain. Further attributes are a title, a highlight color and a mode with which to highlight the table of contents. 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. Automatic link generation is also possible. In this case each entry in the table of contents is defined as a DocumentLink with a corresponding DocumentTarget. When the end-user clicks an entry in the table of contents while pressing the CTRL-key, the document scrolls to the corresponding page in the document. Events occur, when a table of contents is created (TableOfContentsCreated), deleted (TableOfContentsDeleted), entered (TableOfContentsEntered) or left (TableOfContentsLeft).

Classes

Class Description
TXTextControl.TableOfContents A TableOfContents object defines the position and the properties of a table of contents.
TXTextControl.TableOfContentsCollection Contains all tables of contents in a certain part of the document.
TXTextControl.TableOfContentsEventArgs The TableOfContentsEventArgs class provides data for the TableOfContentsCreated, TableOfContentsDeleted, TableOfContentsEntered and TableOfContentsLeft events.

Constructors

Constructor Description
TXTextControl.TableOfContents Initializes a new instance of the TableOfContents class.

Enumerations

Enumeration Description
TXTextControl.TableOfContentsCollection.AddResult Specifies the result when an existing table of contents has been updated or a new table of contents has been added to the document.

Events

Event Description
TXTextControl.ServerTextControl.TableOfContentsCreated Occurs when a table of contents has been created.
TXTextControl.ServerTextControl.TableOfContentsDeleted Occurs when a table of contents has been deleted.
TXTextControl.TextControl.TableOfContentsCreated Occurs when a table of contents has been created.
TXTextControl.TextControl.TableOfContentsDeleted Occurs when a table of contents has been deleted.
TXTextControl.TextControl.TableOfContentsEntered Occurs when the current input position has been moved to a position that belongs to a table of contents.
TXTextControl.TextControl.TableOfContentsLeft Occurs when the current input position has left a table of contents.

Methods

Method Description
TXTextControl.ServerTextControl.OnTableOfContentsCreated Raises the TableOfContentsCreated event.
TXTextControl.ServerTextControl.OnTableOfContentsDeleted Raises the TableOfContentsDeleted event.
TXTextControl.TableOfContents.Save Saves the text of the table of contents with the specified format.
TXTextControl.TableOfContents.ScrollTo Sets the current input position to the beginning of the table of contents and scrolls it into the visible part of the document.
TXTextControl.TableOfContents.Update Updates the content and the page numbers of the table of contents.
TXTextControl.TableOfContentsCollection.Add Adds a new table of contents to the document at the current text input position.
TXTextControl.TableOfContentsCollection.CopyTo Copies the elements of the collection to an array, starting at a particular index.
TXTextControl.TableOfContentsCollection.GetEnumerator Returns an enumerator that can be used to iterate through the collection.
TXTextControl.TableOfContentsCollection.GetItem Gets a particular table of contents from the collection.
TXTextControl.TableOfContentsCollection.Remove Removes a table of contents from the collection including all its text and including all DocumentTargets to where the table's links point.
TXTextControl.TextControl.OnTableOfContentsCreated Raises the TableOfContentsCreated event.
TXTextControl.TextControl.OnTableOfContentsDeleted Raises the TableOfContentsDeleted event.
TXTextControl.TextControl.OnTableOfContentsEntered Raises the TableOfContentsEntered event.
TXTextControl.TextControl.OnTableOfContentsLeft Raises the TableOfContentsLeft event.
TXTextControl.TextControl.TableOfContentsDialog Invokes the built-in dialog box for inserting or changing a table of contents.

Properties

Property Description
TXTextControl.ServerTextControl.TablesOfContents Gets a collection of all tables of contents in the document.
TXTextControl.TableOfContents.DefaultHighlightColor Represents the default highlight color.
TXTextControl.TableOfContents.HasLinks Gets or sets a value specifying whether each entry in the table of contents is a DocumentLink with a corresponding DocumentTarget.
TXTextControl.TableOfContents.HasPageNumbers Gets or sets a value specifying whether the table of contents contains page numbers.
TXTextControl.TableOfContents.HasRightAlignedPageNumbers Gets or sets a value specifying whether the page numbers in the table of contents are right-aligned.
TXTextControl.TableOfContents.HighlightColor Gets or sets the highlight color for the table of contents.
TXTextControl.TableOfContents.HighlightMode Gets or sets a value indicating how the text of the table of contents is highlighted.
TXTextControl.TableOfContents.ID Gets or sets an identifier.
TXTextControl.TableOfContents.Length Gets the number of characters which belong to the table of contents.
TXTextControl.TableOfContents.MaximumStructureLevel Gets or sets the maximum structure level for this table of contents.
TXTextControl.TableOfContents.MinimumStructureLevel Gets or sets the minimum structure level for this table of contents.
TXTextControl.TableOfContents.Name Gets or sets a name for the table of contents.
TXTextControl.TableOfContents.Number Gets the number of the table of contents in the text.
TXTextControl.TableOfContents.Start Gets the index (one-based) of the first character which belongs to the table of contents.
TXTextControl.TableOfContents.Text Gets the text of the table of contents.
TXTextControl.TableOfContents.Title Gets or sets a title for the table of contents.
TXTextControl.TableOfContentsCollection.Count Gets the number of elements contained in the collection.
TXTextControl.TableOfContentsCollection.IsSynchronized Returns true if the collection is designed to be thread safe, otherwise, it returns false.
TXTextControl.TableOfContentsCollection.Item Gets the table of contents with the specified number from the collection.
TXTextControl.TableOfContentsCollection.SyncRoot Gets an object that can be used to synchronize access to the collection.
TXTextControl.TableOfContentsEventArgs.TableOfContents Gets an object that represents the table of contents which causes the event.
TXTextControl.TextControl.TablesOfContents Gets a collection of all tables of contents in the text part with the input focus.