Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Collapse]Reporting
 [Expand]Product Information
 [Collapse]Creating Reports in Visual Studio
  [Expand]Adding a Report to Your .NET Application
  [Expand]Getting Started with DevExpress Reporting
  [Collapse]Detailed Guide to DevExpress Reporting
   [Expand]Storing and Distributing Reports
   [Expand]Providing Data to Reports
   [Expand]Shaping Report Data
   [Collapse]Report Navigation, Interactivity and Appearance
    [Collapse]Report Navigation
      Adding Page Numbers
      Adding Cross-References and Hyperlinks
      Adding Bookmarks and a Document Map
      Adding a Table of Contents
    [Expand]Report Interactivity
    [Expand]Report Appearance
   [Expand]Reporting API
  [Expand]Detailed Guide to Visual Studio Report Designer
 [Expand]Creating End-User Reporting Applications
 [Expand]API Reference
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Adding Bookmarks and a Document Map

This document describes how to use bookmarks for mapping the report elements' hierarchy to the Document Map that is displayed in a Print Preview, and speeds up the navigation through complex reports.

Tip

Report bookmarks are required to construct a table of contents.

This topic consists of the following sections:

Expanded Adding Bookmarks to a Report

Do the following to provide bookmarks to your report:

  1. Start with a report bound to the CategoryProducts view of the sample Northwind database (the nwind.mdb file included in the XtraReports installation). See Providing Data to Reports to learn more about data binding.

  2. Group the report by the CategoryName field as demonstrated below.

  3. Select the label placed in the Group Header band, expand the DataBindings property in the Properties window and bind the label's XRControl.Bookmark property to the CategoryName data field.

  4. In the same way, select the label in the Detail band and bind its XRControl.Bookmark property to the ProductName data field.

    Most of the reporting controls (for example, XRTable, XRTableCell, XRCheckBox, etc.) supports the Bookmark property.

  5. Set the same label's XRControl.BookmarkParent property to the label in the group band. This arranges bookmarks into a parent-child structure reflecting the report elements' hierarchy in the Document Map.

    Note

    Avoid cyclic bookmarks that occur when you assign two bookmarks as parents to each other. In this scenario, an exception raises when you attempt to create the report document.

  6. Select the report itself and assign text to its XtraReport.Bookmark property to determine the root node's caption in the Document Map.

    The root bookmark displays the report name if you do not specify this property.

Note

Duplicated bookmarks are suppressed to prevent adding multiple bookmarks with the same name to a final document. You can disable the XtraReport.BookmarkDuplicateSuppress property to allow duplicated bookmarks.

The following image illustrates the resulting report with the hierarchical Document Map. Clicking any bookmark navigates the Print Preview to the document section containing the associated element.

Expanded Adding Bookmarks for Every Page

Do the following to create a document map with bookmarks for each report page:

  1. Start with a report bound to the Products table of the sample Northwind database (the nwind.mdb file included in the XtraReports installation). See Providing Data to Reports to learn more about data binding.

  2. Set the report's XtraReport.Bookmark property to "Table of Contents".

  3. Drop the ProductName field from the Field List onto the report's Detail band.

  4. Insert a Report Header band by right-clicking anywhere in the report and selecting Insert Band | ReportHeader.

  5. Drop an XRLabel control onto the Report Header and set its XRControl.Bookmark and XRControl.Text properties to "Home".

  6. Add a Page Header band by right-clicking anywhere in the report and choosing Insert Band | PageHeader.

  7. Drop an XRLabel control onto this band and set the XRControl.Bookmark and XRControl.Text properties to "Page". Assign the XRControl.BookmarkParent property to the previously created Home label.

  8. Handle the Page label's XRControl.PrintOnPage event as follows:

The image below demonstrates the result.


When exporting a report to the PDF format, the Document Map is exported as well.

How would you rate this topic?​​​​​​​