Skip to main content

XRPageInfo Class

A Page Information control that is used to display auxiliary information on report pages.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v23.2.dll

NuGet Package: DevExpress.Reporting.Core

Declaration

public class XRPageInfo :
    XRControl,
    IXtraSupportShouldSerialize

Remarks

General Information

The XRPageInfo control displays the following information on report pages:

  • Date and time
  • Page numbers
  • User name

To add the XRPageInfo control to a report, drag the XRPageInfo item from the DX:23.2: Report Controls Toolbox tab and drop it onto the report band. Note that the XRPageInfo control cannot automatically grow to fit its contents, so you must adjust the control width at design time.

versions-asp-lesson-2-06

The XRPageInfo.PageInfo property specifies the kind of information the control displays: page numbers, system date-time, or user name.

Features

Review the following help topics for examples of use:

Note

You cannot bind this control to a data source. To display information from the data source field, use the XRLabel or XRRichText control.

Use a combination of the XRPageInfo.PageInfo and XRPageInfo.TextFormatString properties to specify how the control displays information. For example, to display page count, set the PageInfo property to PageInfo.NumberOfTotal and assign the Page {0} of {1} string to the TextFormatString property, as illustrated in the following image:

Tip

If a report contains at least one group, you can specify individual page numbers for report groups. For this, assign the name of the group whose page numbers should be displayed to the XRPageInfo.RunningBand property.

Localization

To localize the date and time strings that the control displays, specify the PrintingSystemBase.Culture property. When a document is created, the property is set to the value of the current thread’s culture to ensure consistency with other culture-sensitive formatting. At runtime you can change the report document’s Document.PrintingSystem.Culture property to display culture-specific date and time values.

As an alternative, you can localize a report and set the XRPageInfo.TextFormatString property to different values for different languages. This technique allows you to specify different format strings such as Page {0} of {1} for different languages.

Web Specifics

In web applications, the report is processed on the server side. The XRPageInfo control displays information related to the server (date and time on the server, name of the user who logged on to the server). To display client information, implement the DevExpress.XtraPrinting.PageInfoDataProviderBase service. The PageInfoDataProviderBase.GetText method allows you to use an HttpContext object to get information about the current user who is logged in to the server.

View Example: How to Display the Name of the Current Logged in User in a Report

Example

The following code creates the XRPageInfo control and sets its properties:

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

public XRPageInfo CreateXRPageInfo() {
   XRPageInfo pageInfo1 = new XRPageInfo
   {
      SizeF = new SizeF(200F, 50F),
      BackColor = Color.PaleGreen,
      PageInfo = PageInfo.DateTime,
      Format = "{0:MM/dd/yyyy}",
      StartPageNumber = 2
   };
   return pageInfo1;
}

Implements

See Also