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

CachedReportSource Class

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

Namespace: DevExpress.XtraPrinting.Caching

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

Declaration

[ToolboxBitmap(typeof(ResFinder), "Bitmaps256.CachedReportSource.bmp")]
public class CachedReportSource :
    CachedReportSourceBase,
    IReport,
    IDocumentSource,
    ILink,
    IComponent,
    IDisposable,
    IServiceProvider,
    IExtensionsProvider

Remarks

When displaying/printing/exporting huge documents containing thousands of pages, use the CachedReportSource component to avoid memory consumption-related issues. This component generates a report document caching each generated page in the specified storage. The following document storages are available:

You can also implement a custom document storage by inheriting from the DocumentStorage class.

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);

Note

The CachedReportSource component cannot be associated with reports that include a PrintableComponentContainer.

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

Note

The disposing operation can take some time if it is invoked during document generation, because the CachedReportSourceBase.StopPageBuilding method waits until the currently generated page is ready.

Display Large Reports

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

Tip

The document created by a CachedReportSource component is regenerated each time an end user edits it in a Document Viewer (when changing margins, a paper format or watermark).

Merge Large Reports

When merging a large document with another document, use the CachedReportSource component’s CachedReportSourceBase.CreateDocument method to generate the document and the CachedReportSourceBase.ModifyDocument method to manipulate with the page set of the generated document.

Print and Export Large Reports

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

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.

See Also