xtrareports-devexpress-dot-xtrareports-dot-web-dot-reportdesigner-dot-services-a50385aa.md
Enables you to customize the current report and assign a CachedReportSourceWeb object when the Report Designer is about to be switched to the Preview tab.
Namespace : DevExpress.XtraReports.Web.ReportDesigner.Services
Assembly : DevExpress.XtraReports.v25.2.Web.dll
NuGet Package : DevExpress.Web.Reporting.Common
public class PreviewReportCustomizationService
Public Class PreviewReportCustomizationService
You can create a descendant from the PreviewReportCustomizationService and override the following methods:
The following example demonstrates how to use this service 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);
}
}
Imports DevExpress.XtraReports.UI
Imports DevExpress.XtraReports.Web
Imports DevExpress.XtraReports.Web.ReportDesigner.Services
Public Class MyPreviewReportCustomizationService
Inherits PreviewReportCustomizationService
Public Overrides Sub CustomizeReport(ByVal report As XtraReport)
report.Landscape = True
End Sub
Public Overrides Function CreateCachedReportSource(ByVal report As XtraReport) As CachedReportSourceWeb
Return New CachedReportSourceWeb(report)
End Function
End Class
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>();
}
Imports DevExpress.XtraReports.Web.ReportDesigner
Imports DevExpress.XtraReports.Web.ReportDesigner.Services
Private Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
DefaultReportDesignerContainer.Register(Of PreviewReportCustomizationService, MyPreviewReportCustomizationService)()
End Sub
ASP.NET Core
using DevExpress.XtraReports.Web.ReportDesigner.Services;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSingleton<PreviewReportCustomizationService, MyPreviewReportCustomizationService>();
var app = builder.Build();
Object PreviewReportCustomizationService
See Also
PreviewReportCustomizationService Members
DevExpress.XtraReports.Web.ReportDesigner.Services Namespace