XRTableOfContents Class
A control that generates a table of contents in a report composed of sections and their corresponding page numbers based on the hierarchy of bookmarks contained in the report document map.
Namespace: DevExpress.XtraReports.UI
Assembly: DevExpress.XtraReports.v25.1.dll
NuGet Package: DevExpress.Reporting.Core
Declaration
Remarks
The XRTableOfContents
control automatically generates a table of contents based on bookmarks assigned to report elements. See the following demo for a TOC example:
The following image displays a table of contents in a report designer and in a published document:
If you export a report to a tagged PDF (accessibility-compliant documents like PDF/UA a table of content is automatically converted into TOCI
entries. These entries help screen readers and accessibility tools interpret the PDF document’s structure.
To create a table of contents, drop the XRTableOfContents
control from the Toolbox (DX.25.1: Report Controls tab) onto the report surface. The control appears in the ReportHeaderBand. The report creates a new Report Header band if necessary.
TOC Structure
A table of contents contains the following elements:
- Title
- The XRTableOfContentsTitle class defines the title text and format. Use the XRTableOfContents.LevelTitle property to access the TOC title.
- Levels
You can specify one or more levels. The XRTableOfContentsLevel class defines format settings for nodes in a document map tree.
To access the collection of levels, use the XRTableOfContents.Levels property.
The table of contents initially includes one default level. It specifies common settings for elements of the document map that do not yet have a specific level assigned to them.
Document Levels
To add a new level to the table of contents, do the following:
Select the table of contents and click its smart tag.
In the invoked actions list, click the ellipsis button for the Levels property.
In the invoked collection editor, click Add.
Specify the format settings for the created level and click OK to exit the dialog.
To configure indent settings for the document level, use its Indent property. A zero value assigned to this property indicates default indent settings.
For more information, review the following help topic: Add a Table of Contents.
Tips and Limitations
Page Header and Footer
The XRTableOfContents
control always occupies the entire page. This control behaves like an additional report merged with the main report. The PageHeaderBand and PageFooterBand bands are not displayed on a page that contains the table of contents.
To address this issue, place the content in the TopMarginBand or BottomMarginBand bands.
Custom Table of Contents
You can manually create a custom table of contents if the XRTableOfContents
control does not meet your needs. Review the following online example: