Skip to main content

WebDocumentViewerOperationLogger.CachedDocumentSourceSerializing(String, CachedDocumentSource, GeneratedDocumentDetails, DocumentStorage, PrintingSystemBase) Method

The method is called before the document is serialized and placed to the cache.

Namespace: DevExpress.XtraReports.Web.WebDocumentViewer

Assembly: DevExpress.XtraReports.v24.1.Web.dll

NuGet Package: DevExpress.Web.Reporting.Common

Declaration

public virtual void CachedDocumentSourceSerializing(
    string documentId,
    CachedDocumentSource cachedDocumentSource,
    GeneratedDocumentDetails documentDetails,
    DocumentStorage documentStorage,
    PrintingSystemBase printingSystemSource
)

Parameters

Name Type Description
documentId String

A document cache item identifier.

cachedDocumentSource DevExpress.XtraPrinting.Caching.CachedDocumentSource

A report source used to generate a document.

documentDetails DevExpress.XtraReports.Web.WebDocumentViewer.GeneratedDocumentDetails

Information about the generated document.

documentStorage DocumentStorage

A storage used by the CachedReportSource and CachedReportSourceWeb objects to cache the document that they generate to display/export/print a report.

printingSystemSource PrintingSystemBase

The Printing system used for the current document.

Remarks

The CachedDocumentSourceSerializing method allows you to restore event handlers once a document is serialized in the cache and all event handlers are detached.

The following code example shows how to use the CachedDocumentSourceSerializing method to store the Product Category that is used to rename worksheets in an exported XLSX file. The report displays the category on the page from which the worksheet originated.

public override void CachedDocumentSourceSerializing(string documentId, CachedDocumentSource cachedDocumentSource, GeneratedDocumentDetails documentDetails, DocumentStorage documentStorage, PrintingSystemBase printingSystemSource) {
    if(customPageDataProviderRegistry.TryGetPageDataService(documentId, out CustomPageDataService customPageDataService) && customPageDataService != null) {
        documentDetails.CustomData = new Dictionary<string, object> { [CustomPageDataService.Key] = customPageDataService.PageAdditionalData };
        cachedDocumentSource.PrintingSystem.XlSheetCreated += customPageDataService.PrintingSystem_XlSheetCreated;
    }
}

View Example: Web Reporting - How to Manage Events of a Cached Document and Pass Custom Data to the Exported Document

See Also