Store Report Documents

This document describes the key aspects of publishing, storing and distributing report documents.

Creating Documents

Calling the XtraReport.CreateDocument method fills data sources available in the report, supplies bound report controls with the obtained data, and starts building document pages. This method is called internally when loading a report in a Print Preview or exporting a document.

In the Visual Studio Report Designer, you can trigger document creation and preview the document by switching to the Preview tab below a report's design surface.

visual-studio-print-preview-progress-bar-stop

Tip

Creating extensive documents may take a considerable amount of time. You can interrupt the page building process at any time by clicking Stop on the Print Preview's status bar.

When using large data sources, you can reduce the load on your database server that filling the data source causes each time you switch to Preview by limiting the number of times the detail band is printed (see the XtraReportBase.ReportPrintOptions property description).

Saving and Loading Documents

You can save the created document to a file:

visual-studio-print-preview-save-document

Report documents are compressed and stored in archive files with a PRNX extension by default. This file extension is used to filter data in the Save File and Load File dialogs displayed in a Print Preview.

After saving a report's document, you can open it in any desktop report viewer version (WinForms or WPF):

winforms-print-preview-load-document

Tip

DevExpress reports are backward compatible and do not need to be updated each time you upgrade your product version.

See Save and Open Report Documents to learn how to store documents in a file or stream and retrieve them from a Print Preview.

Protecting Documents

Consider storing report definitions along with published documents to be able to make changes to the document layout at a later time.

Important

Make sure you take the necessary measures to protect your documents from unauthorized access. Consider using third-party tools to encrypt documents containing sensitive data or protect them using digital signatures.

See Reporting Security for more information.

A document provides a snapshot of dynamic data source contents when it is created. Another document created from the same report can contain different information as a result of changes made to the report's data source. Published documents often display a timestamp, user name and information about parameter values assigned to the report to provide the right context for published information and ensure its validity.

Tip

Reports are commonly used to create and distribute documents automatically on a schedule.

Consider choosing the DevExpress Report Server - a stand-alone multi-user client-server solution providing advanced mechanisms for management, scheduling, and distribution of reports and dashboards out of the box.

Distributing Documents

Data presentation in published documents does not depend on the system's culture and locale settings. A document's culture-specific content does not change when viewing it on different machines.

Note

A single exception to this is the XRPageInfo control that uses the current application thread's culture settings to format its date-time values by default.

Use the PrintingSystemBase.Culture property to define a specific culture for rendering this control's content to ensure consistency across various systems.

Culture-sensitive formatting applied to a report's data may change when exporting to Excel if the report's XlExportOptionsBase.TextExportMode property is set to TextExportMode.Value, which makes the resulting Excel document use the system formatting of the client machine on which export has been performed.

Fonts used in a document for rendering text are automatically replaced with the system's default equivalents if they are missing on a client machine.

See Globalize and Localize Reports to learn more about culture-specific report settings.

Customizing Documents

A created Document is not supposed to be edited after its publication unless you have enabled the report's interactive features.

Document pages are not available for a report until its document is created. You can use report events to adjust the layout of a report's content in a published document.

You can use the XtraReport.Pages property or a report (or its document's Document.Pages property) to access the collection of document pages.

Tip

When publishing a document, the Printing System transforms each report control into a graphical primitive (brick) corresponding to the control's type. A brick renders a control's content and defines its size and location on a document's page.

In most cases, you do not need to access and manipulate individual bricks because you can manipulate elements in a report instead. See Printing-Exporting for more information about the low-level API the printing library uses to create documents.