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

CachedReportSourceWeb Class

An object that acts like a mediator between a report and a Web Document Viewer.

Namespace: DevExpress.XtraReports.Web

Assembly: DevExpress.XtraReports.v18.2.Web.dll

Declaration

public class CachedReportSourceWeb :
    CachedReportSourceBase

The following members return CachedReportSourceWeb objects:

Remarks

Use the CachedReportSourceWeb object to display a report in a Document Viewer. This object creates a report document caching each generated page to a storage. Only pages displayed in a Document Viewer are stored in memory.

Pass a target report as a parameter to the CachedReportSourceWeb object’s constructor.

using DevExpress.XtraReports.Web;
using DevExpress.XtraPrinting.Caching;
//...
var cachedReportSource = new CachedReportSourceWeb(new XtraReport1()); 

A CachedReportSourceWeb object uses a MemoryDocumentStorage storage to cache a generated document. This storage stores a document in memory in a compact way. Use the UseFileExportedDocumentStorage (.NET Framework) / UseFileDocumentStorage (.NET Core) method to store the report documents in the File Document Storage instead. You can also use the DbDocumentStorage storage or implement a custom one. Register your IDocumentStorageProvider to manage document storages.

Use the OpenReport(String) (WebForms)) / Bind(String) (MVC) / Bind(String) (ASP.NET Core MVC) method to bind the Document Viewer to a report by the unique report name. Implement the ICachedReportSourceWebResolver interface to associate the report unique name with the CachedReportSourceWeb object that possesses the corresponding report. A Document Viewer uses the ICachedReportSourceWebResolver object to find an appropriate CachedReportSourceWeb object by a report unique name and requests the found object to generate a report document, when required.

You can also directly bind a Document Viewer to the CachedReportSourceWeb object that possesses the required report using the OpenReport(CachedReportSourceWeb) (WebForms) / Bind(CachedReportSourceWeb) (MVC) method. However, the report’s interactive features will only be available to end users until the application pool is recycled. Using interactive features demands document regeneration. But after the application pool is recycled, the document cannot be regenerated, because the initial report cannot be found.

When merging documents, use the CachedReportSourceWeb object’s CreateDocument() method to generate a document and the ModifyDocument(Action<IDocumentModifier>) method to manipulate the generated document’s page set.

Limitations

  • The CachedReportSourceWeb component cannot be associated with reports that include a PrintableComponentContainer.
  • The AddBrick(VisualBrick) method does not work if you use the CachedReportSource component to create report documents.

  • When using the CachedReportSourceWeb component to generate a report document, the PrintOnPage event is raised each time a page with the current control is created. In this connection, the total number of pages is unknown at the moment the event fires and you cannot use the PageCount property in the event handler.

  • The RollPaper mode is not supported.

  • When creating a report document, the CachedReportSourceWeb component generates information required for a single-file export. This increases memory consumption. Disable the AllowSingleFileExport option if you are not going to export the generated document in single-file mode.

See Also