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.v24.1.dll
NuGet Package: DevExpress.Reporting.Core
Declaration
Remarks
The XRTableOfContents
control automatically generates the table of contents based on the bookmarks assigned to report elements.
The following image illustrates the difference in displaying information using the table of contents in a report and in a published document:
To create a table of contents, drop the XRTableOfContents
control from the Toolbox DX.24.1: Report Controls tab onto the report surface. If the report does not contain a ReportHeaderBand, it is created automatically to host the table of contents.
TOC Structure
The 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.
- Level
A table may include one or more levels. The XRTableOfContentsLevel class defines format settings for individual 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: