Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

PreviewReportCustomizationService.CreateCachedReportSource(XtraReport) Method

Enables you to assign a CachedReportSourceWeb object to the current report when the Report Designer is about to be switched to the Preview tab.

Namespace: DevExpress.XtraReports.Web.ReportDesigner.Services

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

NuGet Package: DevExpress.Web.Reporting.Common

#Declaration

public virtual CachedReportSourceWeb CreateCachedReportSource(
    XtraReport report
)

#Parameters

Name Type Description
report XtraReport

The current report to be previewed.

#Returns

Type Description
CachedReportSourceWeb

A CachedReportSourceWeb object.

#Remarks

The CreateCachedReportSource method is called after the CustomizeReport method and allows you to assign a CachedReportSourceWeb object to the customized report.

The following example demonstrates how to change the report’s orientation and assign a new CachedReportSourceWeb instance.

using DevExpress.XtraReports.UI;
using DevExpress.XtraReports.Web;
using DevExpress.XtraReports.Web.ReportDesigner.Services;

public class MyPreviewReportCustomizationService: PreviewReportCustomizationService {
    public override void CustomizeReport(XtraReport report) {
        report.Landscape = true;
    }

    public override CachedReportSourceWeb CreateCachedReportSource(XtraReport report) {
        return new CachedReportSourceWeb(report);
    }
}

Then, register your custom service implementation at the application’s startup.

ASP.NET Web Forms and ASP.NET MVC
using DevExpress.XtraReports.Web.ReportDesigner;
using DevExpress.XtraReports.Web.ReportDesigner.Services;

void Application_Start(object sender, EventArgs e) {
    DefaultReportDesignerContainer.Register<PreviewReportCustomizationService, MyPreviewReportCustomizationService>();
}
ASP.NET Core
using DevExpress.XtraReports.Web.ReportDesigner.Services;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddSingleton<PreviewReportCustomizationService, MyPreviewReportCustomizationService>();

var app = builder.Build();
See Also