CachedReportSourceBase.ModifyDocument(Action<IDocumentModifier>) Method

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

Namespace: DevExpress.XtraPrinting.Caching

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

Declaration

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

Parameters

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.

Remarks

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.XtraPrinting.Caching;
using DevExpress.XtraReports.UI;
// ...
// Create the first report and generate its document.
var storage1 = new MemoryDocumentStorage();
var report1 = new XtraReport1();
var cachedReportSource1 = new CachedReportSource(report1, storage1);
cachedReportSource1.CreateDocument();
// Create the second report and generate its document.
var storage2 = new MemoryDocumentStorage();
var report2 = new XtraReport2();
var cachedReportSource2 = new CachedReportSource(report2, storage2);
cachedReportSource2.CreateDocument();

// Add all pages of the second report to the end of the first report.
// Use either XtraReport.ModifyDocument() or CachedReportSource.ModifyDocument() to modify the report document.
report1.ModifyDocument(x => {
    x.InsertPage(1, cachedReportSource2.PrintingSystem.Pages[0]);
});

// Preview the first report using the cachedReportSource1 object.
See Also