[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand].NET Core 3 Support
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Collapse]Rich Text Editor
   [Expand]Product Information
    Product Class Structure
    Supported Formats
   [Expand]Getting Started
   [Expand]RichEditControl Document
   [Expand]Fields
    Text Formatting
    Import and Export
   [Expand]Page Layout
    Printing
    AutoCorrect
    Mail Merge
    Restrictions and Protection
   [Expand]Visual Elements
    Services
    Events
    Commands
    HTML Tag Support
   [Collapse]Examples
    [Expand]UI Customization
    [Expand]Files
    [Expand]Text
    [Expand]Formatting
    [Expand]Styles
    [Expand]Pictures
    [Expand]Text Boxes
    [Expand]Tables
    [Expand]Document Elements
    [Expand]Layout
    [Collapse]Automation
      How to: Insert a Field to a Document
      How to: Create a Table of Contents
      How to: Create TOC for Special Cases
      How to: Create a Table of Contents in Code
      How to: Handle the HyperlinkClick Event to Invoke the Custom Form
      How to: Use the Visitor-Iterator Pattern to Retrieve the List of Document Fonts
      How to: Highlight Document Syntax
      How to: Insert Dynamic Content
     Spell Check
    [Expand]Export
    [Expand]Printing
    [Expand]Protection
    [Expand]Commands
    [Expand]Miscellaneous
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

How to: Create TOC for Special Cases

A Table of Contents (TOC) in a document is represented by a special TOC field. RichEditControl provides a set of TOC field switches that you can combine to create TOCs of different types. This document describes how to create the following TOCs.

Expanded TOC for the Specified Portion of a Document

To generate a TOC collecting titles (marked with built-in heading styles) from the specified portion of a document only, follow the steps below.

  1. Mark entries to be included in the TOC by using built-in heading styles (Heading 1, Heading 2, etc.).
  2. Mark a portion of a document whose headings you want to include in the TOC with the "Chapter1" bookmark.
  3. Insert a TOC field and use the \b switch with the bookmark name: {TOC \b Chapter1}.

Expanded TOC Including Paragraphs with Specified Outline Levels Only

To generate a TOC from Heading 1, Heading 2 and Heading 3 entries only (or paragraphs with outline levels 1 through 3), use the \o switch in the TOC field code.

{TOC} {TOC \o "1-3"}

Expanded Table of Figures (Tables, Equations)

The following step-by-step instruction describes how to create a TOC from items numbered by a SEQ field (for example, table of figures), add sequence numbers (figure numbers) before page numbers in the table of contents and specify the separator between sequence and page numbers.

  1. Specify captions for figures that you want to include in the table of figures. To do this, click the Insert Caption button in the Captions ribbon page group on the References tab (Ribbon UI) or Captions toolbar (Bar UI) and select Figures Caption...

    ... or add the {SEQ Figure} field code in one of the available ways -using CTRL+F9, CreateFieldCommand, InsertFieldCommand, or FieldCollection.Create (for details, refer to How to: Insert a Field to a Document).

  2. Click where you want to insert the table of figures.
  3. In the Captions ribbon page group on the References tab (Ribbon UI) or Captions toolbar (Bar UI), click Insert Table of Figures and select Table of Figures.

    If you right-click the newly created table of figures and select Toggle Field Codes from the context menu or click the Show All Field Codes button on the Preview Results ribbon page group or toolbar, you will see the TOC field code - { TOC \h \c "Figure" }. The \c switch is used to build a TOC from items that are numbered by a SEQ field.

  4. To add figure numbers before page numbers in the table of figures and insert the => separator between figure and page numbers, use the s and d switches of the TOC field - { TOC \h \c "Figure" \s Figure \d => }.
  5. Resulting table of figures will look like the following.

In the same way you can sequentially number tables and equations in a document, and built a table of tables or equations.

Note

If you add, remove or modify captions, you can quickly update the table of figures by using the Update Table button in the Captions ribbon page group on the References tab (Ribbon UI) or Captions toolbar, by selecting the Update Field from the context menu, or clicking the TOC and pressing F9.

Expanded See Also

Is this topic helpful?​​​​​​​