ActiveReports 18 .NET Edition
Report Authors: Designer Components / Design Reports / Design Page/RDLX Reports / Tutorials: Report Controls in Page/RDLX Reports / Add Table of Contents to a Report with TableofContent Control
In This Topic
    Add Table of Contents to a Report with TableofContent Control
    In This Topic

    Let us add a Table of Contents to the following report. Note that this report is similar to the 'MoviesCatalog.rdlx' report available with samples on GitHub. The report contains nested List data regions to display the hierarchy in report. The parent list is grouped based on 'GenreName'. The child list is grouped based on the 'Title' and displays other information.

    Movies Catalog report at preview with no TOC

    HeadingLevel property

    You can define a hierarchical structure for your report using the Heading Level property of the TextBox control. If a TextBox is set to Heading Level 1 and another TextBox at a different level to Heading Level 2, the entries in Heading Level 2 are clubbed under the Heading Level 1 entry in the Table of Contents. The headings are auto-numbered.

    1. Drag and drop the TableOfContents control on top of the report, below the report title. Grab its corner and adjust its size.
    2. With the TableOfContents control selected, in the Properties window, click the Levels property to open the LevelDesigner Collection Editor.
    3. Select the Level1 (to display [GenreName]) in the Table of Contents and set the following properties:
      LevelDesigner Collection Editor
      • FontSize: 11pt
      • FillCharacter: "-" (a dash)
      • DisplayFillCharacter: True
    4. Click +Add item to add the Level2 (to display [Title]) to the Table of Contents and set the following properties:
      • Padding > Left: 5pt
      • FillCharacter: "." (a dot)
      • DisplayFillCharacter: True
    5. From the Report Explorer, select Report, and from the Properties window, go to the DocumentMap property.
    6. Expand the DocumentMap property and click the ellipses next to Levels (Collection) property.
    7. In the DocumentMapLevelDesigner Collection Editor, that appears, select:
      DocumentMapLevelDesigner Collection Editor
      Report.DocumentMap.Levels.0 and set NumberingStyle to 'A, B, C, D, E'
      Report.DocumentMap.Levels.1 and set NumberingStyle to '1, 2, 3, 4, 5'
    8. Click OK to close the collection editor.
    9. Set the DocumentMap > Source property to 'Headings Only'.    
    10. Now, select the Textbox with the Value property set to =Fields!GenreName.Value and, in the Properties window, set its HeadingLevel property to 'Heading 1' from the drop-down list.
    11. Select the Textbox with the Value property set to =Fields!Title.Value and, in the Properties window, set its HeadingLevel property to 'Heading 2' from the drop-down list.
      Movies Catalog with TOC at design
    12. Preview the report. Here's how the table will look like. Click the TOC item to jump to the desired page.

      Movies Catalog with TOC at preview

    Label Property

    By setting the Label property of the controls in your report, you can show a hierarchical structure based on the parent-child relationship between the controls in the Document Map. For example, if the Label property of the List data region is set and a TextBox control is placed inside the List data region, the TextBox label appears nested inside the List data region label, thereby displaying a hierarchical structure.

    1. Drag-drop the TableOfContents control on top of the report. Grab its corner and adjust its size.
    2. Follow steps 2-8 in the Using HeadingLevel property section above for setting properties of levels in Table of Contents.
    3. Set the DocumentMap > Source property to 'Labels Only'.
    4. Select the List1 data region and set its Label property to =Fields!Genre.Value to have it displayed in the Level1 of the Table of Contents.
    5. Similarly, select the List2 data region and set its Label property to =Fields!Title.Value to have it displayed in the Level2 of the Table of Contents.
    6. Preview the report.
      Note: The Table of Contents mapped using labels are not numbered.
    See Also