A newer version of this page is available. Switch to the current version.

CachedReportSourceBase.ModifyDocument(Action<IDocumentModifier>) Method

Adds and/or removes the generated document's pages.

Namespace: DevExpress.XtraPrinting.Caching

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


public void ModifyDocument(
    Action<IDocumentModifier> callback
Public Sub ModifyDocument(
    callback As Action(Of IDocumentModifier)


Name Type Description
callback Action<IDocumentModifier>

A delegate method that allows you to modify the report document using the IDocumentModifier object passed as a parameter.


Call the ModifyDocument method when the report's document is already created. Use the CachedReportSourceBase.CreateDocument method beforehand.

If you use the ModifyDocument method to extend a report document with pages from another document, create the other document using the XtraReport.CreateDocument/CachedReportSourceBase.CreateDocument method beforehand.

In the delegate method, modify the document's page set using members exposed by the IDocumentModifier object that is passed as a parameter.

The following code demonstrates how to add a report's title page to the beginning of another report.

using DevExpress.XtraReports.UI;
using DevExpress.XtraPrinting.Caching;
// ... 
private void CombineTwoReports() {
    var mainReportStorage = new MemoryDocumentStorage();
    var mainReport = new XtraReport1();
    var cachedMainReportSource = new CachedReportSource(mainReport, mainReportStorage);

    var titleReportStorage = new MemoryDocumentStorage();
    var titleReport= new XtraReport2();
    var cachedTitleReportSource = new CachedReportSource(titleReport, titleReportStorage);

    cachedMainReportSource.ModifyDocument(x => {
        x.InsertPage(0, cachedTitleReportSource.PrintingSystem.Pages[0]);
See Also