Skip to main content

CachedReportSource Class

A component that manages caching logic and acts as a mediator between a report and a Document Viewer.

Namespace: DevExpress.XtraPrinting.Caching

Assembly: DevExpress.Printing.v22.1.Core.dll


[ToolboxBitmap(typeof(ResFinder), "Bitmaps256.CachedReportSource.bmp")]
public class CachedReportSource :


Use the CachedReportSource component to avoid memory consumption-related issues when you display, print or export large documents. This component generates a report document and caches each generated page in the specified storage. The following document storages are available:

You can also inherit from the DocumentStorage class to implement a custom document storage.

The following code demonstrates how to create a CachedReportSource instance.

using DevExpress.XtraPrinting.Caching;
var storage = new MemoryDocumentStorage();
var report = new MyReport();
var cachedReportSource = new CachedReportSource(report, storage);

When you dispose of the CachedReportSource component, the storage it uses is disposed of as well. The storage content is cleared if DocumentStorage.ClearOnDispose is enabled.


The disposal can take some time if it is invoked while the document is generated, because the CachedReportSourceBase.StopPageBuilding method waits until the currently generated page is ready.

Display Large Reports

To display a report in a Document Viewer, assign the CachedReportSource component to the DocumentViewer.DocumentSource (WinForms) / DocumentViewerControl.DocumentSource (WFP) property. Refer to the Quick Start (WinForms) / Quick Start (WPF) section for details.


The document created by the CachedReportSource component is regenerated each time users edit it in the Document Viewer (when they change margins, paper format, or watermark).

Merge Large Reports

When you merge a large document with another document, use the CachedReportSource component’s CachedReportSourceBase.CreateDocument method beforehand to generate the document. Then, use the XtraReport.ModifyDocument or CachedReportSourceBase.ModifyDocument method to manipulate the generated document’s page set.

Print and Export Large Reports

To print or export a large document in code without displaying it in a Document View, use the CachedReportSource component’s CachedReportSourceBase.CreateDocument method to generate the document. Then access the CachedReportSource.PrintingSystem property to utilize the document’s Printing System and its printing and exporting methods.

Use Caching in Web Reporting Applications

Use the CachedReportSource class in WinForms and WPF reporting applications. To utilize document caching in Web applications, use the CachedReportSourceWeb class.


The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CachedReportSource class.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also