Add a Table of Contents
- 2 minutes to read
This topic describes how to provide a report with a table of contents that displays page numbers for bookmarked report elements at different nesting levels:
Create a master-detail report with the following layout:
- Specify the bookmarks for report elements that need to be included in the table of contents.
Open the Toolbox panel (by pressing CTRL+ALT+X), select the XRTableOfContents control in the DX.23.1: Report Controls category and drop it onto the report surface. This places the created control on the Report Header band. This band is created automatically if the report does not currently contain it.
Customize the table of contents title using the XRTableOfContents.LevelTitle property.
When report bookmarks are organized into a hierarchy (by setting the nested elements’ XRControl.BookmarkParent property), the corresponding levels are displayed in the table of contents. You can specify each level’s text formatting options individually.
Access the level collection by clicking the control’s smart tag and using the XRTableOfContents.Levels property.
In the invoked collection editor, click Add to add a new level and adjust its settings.
You can limit the maximum number of levels the table of contents displays using the XRTableOfContents.MaxNestingLevel property.
The XRTableOfContents.LevelDefault property allows you to apply common formatting settings to all levels at once (for which you did not assign a specific level previously).
The following image demonstrates the result in Print Preview: