The requested page is not available for the requested platform. You are viewing the content for Default platform.

How to: Execute Custom Code when a Report is Persisted

  • 2 min to read

This topic describes how you can customize the ReportsStorage class. Assume you have a customized the ReportDataV2 class and added the ModifiedBy property that should return the name of the user who last edited the report layout. You need to update this property value each time a report layout is saved. For this purpose, customize the ReportsStorage and register your custom implementation. The steps below demonstrate how to do it.


The approach described in this topic is not supported by the Mobile platform.

  • Inherit the ReportsStorage class and override its ReportsStorage.SaveReport method.

    using DevExpress.XtraReports.UI;
    using DevExpress.ExpressApp;
    using DevExpress.ExpressApp.ReportsV2;
    using DevExpress.ExpressApp.Security;
    // ...
    public class CustomReportsStorage : ReportsStorage {
        public override void SaveReport(IReportDataV2Writable reportData, XtraReport report) {
            if (reportData is MyReportDataV2) {
                ISecurityUser currentUser = SecuritySystem.CurrentUser as ISecurityUser;
                if (currentUser != null) {
                    ((MyReportDataV2)reportData).ModifiedBy = currentUser.UserName;
            base.SaveReport(reportData, report);
  • Edit the Module.cs (Module.vb) file and override the ModuleBase.Setup method. In this method, assign an instance of the CustomReportsStorage to the static ReportDataProvider.ReportsStorage property.

    using DevExpress.ExpressApp.ReportsV2;
    // ...
    public override void Setup(XafApplication application) {
        ReportDataProvider.ReportsStorage = new CustomReportsStorage();