Skip to main content

WebDocumentViewerOperationLogger.CachedDocumentSourceDeserialized(String, CachedDocumentSource, GeneratedDocumentDetails, DocumentStorage) Method

The method is called when the document is deserialized and restored from the cache.

Namespace: DevExpress.XtraReports.Web.WebDocumentViewer

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

NuGet Package: DevExpress.Web.Reporting.Common

Declaration

public virtual void CachedDocumentSourceDeserialized(
    string documentId,
    CachedDocumentSource cachedDocumentSource,
    GeneratedDocumentDetails documentDetails,
    DocumentStorage documentStorage
)

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.

Remarks

The CachedDocumentSourceDeserialized method allows you to restore event handlers that are detached once a document is serialized in the cache.

The following code example shows how to use the CachedDocumentSourceDeserialized method to obtain 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 CachedDocumentSourceDeserialized(string documentId, CachedDocumentSource cachedDocumentSource, GeneratedDocumentDetails documentDetails, DocumentStorage documentStorage) {
    if(documentDetails.CustomData != null && documentDetails.CustomData.TryGetValue(CustomPageDataService.Key, out object customData)) {
        var customDataServiceDictionary = ((object[])customData).Cast<KeyValuePair<int, CustomPageData>>().ToDictionary(x => x.Key, x => x.Value);
        if(customDataServiceDictionary == null)
            return;
        var customPageDataService = new CustomPageDataService(customDataServiceDictionary);
        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