Skip to main content
A newer version of this page is available. .

XtraReport.Bookmark Property

Gets or sets the text shown as a root bookmark in a Document Map.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v19.2.dll

NuGet Package: DevExpress.Reporting.Core

Declaration

[Browsable(true)]
[SRCategory(ReportStringId.CatNavigation)]
public override string Bookmark { get; set; }

Property Value

Type Description
String

A String representing a root bookmark’s text.

Remarks

If at least one report control has a bookmark assigned to its XRControl.Bookmark property, a report’s Document Map is created (it is displayed in a report’s Print Preview and exported to certain formats). In this case, a report’s Name is used as a root bookmark, since the Bookmark property is set to Empty by default. If you want to show another text as a root bookmark, assign this string to the Bookmark property.

For more information on this feature, refer to the Adding Bookmarks and a Document Map document.

Example

This example demonstrates how to create a document map with bookmarks for each page in a report.

To implement a document map in your report, do the following.

  1. To create a table report, start with a report that is bound to the “Products” table of the sample Northwind database (the nwind.mdb file included in the XtraReports installation). To learn more about binding a report to a data source, see Providing Data to Reports.
  2. Set the report’s XtraReport.Bookmark property to “Table of Contents”.

    HowTo_AddBookmark5

  3. To create the report’s main content, drop the ProductName field from the Field List onto the report’s Detail band.

    How to - GroupData_3

  4. Insert a ReportHeaderBand. To do this, right-click anywhere in the report designer, and in the invoked context menu point to Insert Band, and then click ReportHeader.

    Shared_BandsAddReportHeader

    Drop an XRLabel control on the Report Header and set its XRControl.Bookmark and XRControl.Text properties to “Home”.

    HowTo_Bookmarks_0

  5. Insert a PageHeaderBand. To do this, right-click anywhere in the report designer, and in the context menu, point to Insert Band, and then click PageHeader.

    Shared_BandsAddPageHeader

    Drop an XRLabel control on the Page Header. Then, set its XRControl.Bookmark and XRControl.Text properties to “Page”, and the XRControl.BookmarkParent property to the Home label.

    HowTo_Bookmarks_1

    Next, handle the Page lable’s XRControl.PrintOnPage event as follows.

using System;
using DevExpress.XtraReports.UI;
// ...

private void xrLabel3_PrintOnPage(object sender, PrintOnPageEventArgs e) {
    // Obtain the current page number.
    string s = (e.PageIndex + 1).ToString();

    // Set the label's text and bookmark (this label is located on the PageHeader
    // band, so it will show a bookmark for every report page
    ((XRLabel)sender).Bookmark += s;
    ((XRLabel)sender).Text += s;
}
See Also