Skip to main content

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:

  1. Create a master-detail report with the following layout:

    Howto-Table-of-Contents-Reports0

  2. Specify the bookmarks for report elements that need to be included in the table of contents.
  3. Open the Toolbox panel (by pressing CTRL+ALT+X), select the XRTableOfContents control in the DX.24.2: 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.

    Howto-Table-of-Contents-Reports1

  4. Customize the table of contents title using the XRTableOfContents.LevelTitle property.

    Howto-Table-of-Contents-Reports2

  5. 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.

    Howto-Table-of-Contents-Reports3

    In the invoked collection editor, click Add to add a new level and adjust its settings.

    Howto-Table-of-Contents-Reports4

    You can limit the maximum number of levels the table of contents displays using the XRTableOfContents.MaxNestingLevel property.

  6. 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).

    Howto-Table-of-Contents-Reports5

The following image demonstrates the result in Print Preview:

Howto-Table-of-Contents-Reports6