Available for: UI for ASP.NET MVC | UI for ASP.NET AJAX | UI for Blazor | UI for WPF | UI for WinForms | UI for Xamarin | UI for WinUI | UI for ASP.NET Core | UI for .NET MAUI

New to Telerik Document Processing? Download free 30-day trial

Table of Contents Field

The TOC (Table of Contents) field creates a table of contents. It is created from the heading or other styles used in the document. You can specify the items by using the TC field as well.


{ TOC [Switches ] }


Switches that control whats included in the table of contents.

Switch Description
\o "Levels" Builds a table of contents from paragraphs formatted with styles that include outline levels (most commonly, heading styles). For example, { TOC \o "1-3" } lists only paragraphs formatted with styles that include outline levels 1 through 3
\t "Style,Level,Style,Level,..." Builds a table of contents from paragraphs formatted with styles other than the built-in styles. For example, { TOC \t "style1,1, style2,2" }
\u Builds a table of contents from paragraphs whose formatting includes outline levels applied directly, in paragraph settings.
\c "SEQIdentifier" Lists figures, tables, charts, or other items that are numbered by a SEQ (Sequence) field.
\a Identifier Lists items captioned with the Caption but omits caption labels and numbers. Currently you can insert caption by adding a SEQ field
\f EntryIdentifier Builds a table from TC fields. If EntryIdentifier is specified, the table is built only from TC fields with the same identifier (typically a letter)
\l Levels Builds a table of contents from TC fields that assign entries to one of the specified levels.
\b BookmarkName Collects entries only from the portion of the document marked by the specified bookmark.

Switches that format the page number

Switch Description
\s Identifier Includes a number such as a chapter number before the page number. The chapter or other item must be numbered with a SEQ field. Identifier must match the identifier in the SEQ field.
\d "Separator" When used with the \s switch, specifies the character that separates the sequence numbers and page numbers.
\p "Separator" Specifies the character that separates an entry and its page number.
\n Levels Omits page numbers from the table of contents. Page numbers are omitted from all levels unless a range of entry levels is specified.

Switches that format table entries

Switch Description
\w Preserves tab entries within table entries.
\x Preserves manual line breaks within table entries.
\z Hides tab leader and page numbers in Web layout view.
\h Hyperlinks Inserts TOC entries as hyperlinks.


Inserting this field is easily achieved through the RadFlowDocumentEditor's InsertField() method. It accepts code as argument.

Example 1 demonstrates how you can insert a TOC field.

Example 1: Insert TOC field

var document = new RadFlowDocument(); 
var editor = new RadFlowDocumentEditor(document); 
editor.InsertField("TOC \f a "); 
This makes a list of all TC fields with the 'a' identifier.

In order to update the PageRef fields within the TOC field you need to set the FlowExtensibilityManager.NumberingFieldsProvider

See Also

In this article