Skip to main content

Create Predefined Static Reports

  • 4 minutes to read

This topic describes how to create an XtraReport at Design Time and then register it. An XAF application displays registered reports in the Reports List View. These predefined reports cannot be modified by a user. However, a user can copy a predefined report with the help of the Copy Predefined Report Action and then modify the copy.

Follow the steps below to create an XtraReport and register it for use with the Reports V2 module.

  1. Use the DevExpress v.23.2 Report project item template (see Report Wizard) to add an empty XtraReport to your project. Select the Blank report type and click the Finish button.

    Report Wizard, DevExpress

    The XtraReport1.cs item appears in the module project of your application.

    XtraReport1 Item in the Solution Explorer, DevExpress

  2. The Reports V2 module supports the following Data Source components to use in XAF-compatible XtraReport classes: CollectionDataSource and ViewDataSource. Drag the CollectionDataSource item from the Toolbox to the created report.

    Report Data Sources in Toolbox, DevExpress


    You can use the ViewDataSource component instead of the CollectionDataSource. For more information about the difference between these components refer to the following topic: Data Sources for Reports V2.

  3. Invoke the Properties window for the collectionDataSource1 item and set value of the ObjectTypeName property to the name of the business class you want to use for your report.

    CollectionDataSource Properties, DevExpress

    The business class properties should appear in the Field List window.

    Field List Populated with Data Source Items, DevExpress

  4. Drag the required fields to the report or run the Report Wizard to generate the required layout automatically.


    To learn more about report design, refer to the following topics of the Reporting documentation: Report Designer and Report Wizard. Note that the CollectionDataSource and ViewDataSource components only provide a list of fields to the designer and you cannot preview the report at design time.


    • At design time, the Preview tab of the Report Designer is empty. The CollectionDataSource and ViewDataSource components do not connect to a database directly and require an IObjectSpace instance to load data. XAF creates the instance at runtime only, therefore it cannot load data at design time.
    • Currently, Custom Fields are not available in the Reports Designer at design time.
  5. After you save the report, register it in your XAF application. Navigate to the ModuleBase.GetModuleUpdaters method in the Module.cs file. Instantiate the PredefinedReportsUpdater class and use the PredefinedReportsUpdater.AddPredefinedReport<T> method to add a report. Add the updater object to the method’s return value.

    File: MySolution.Module\Module.cs

    // ...
    using DevExpress.ExpressApp.ReportsV2;
    using MySolution.Module.BusinessObjects;
    namespace MySolution.Module;
    public sealed class MySolutionModule : ModuleBase {
        public MySolutionModule() {
            // ...
        public override IEnumerable<ModuleUpdater> GetModuleUpdaters(
            IObjectSpace objectSpace, Version versionFromDB) {
            ModuleUpdater updater = new DatabaseUpdate.Updater(objectSpace, versionFromDB);
            PredefinedReportsUpdater predefinedReportsUpdater =
                new PredefinedReportsUpdater(Application, objectSpace, versionFromDB);
            predefinedReportsUpdater.AddPredefinedReport<XtraReport1>("Employee DOB Information", typeof(Employee));
            return new ModuleUpdater[] { updater, predefinedReportsUpdater };
        // ...


    By default, each new PredefinedReportsUpdater instance removes predefined reports that are not registered within this instance. If you implement your reports in several modules and need to create multiple PredefinedReportsUpdater objects in a single application, set the PredefinedReportsUpdater.UseMultipleUpdaters property of each updater to true.

  6. Run the application. Note that the designed XtraReport is available in the Reports List View. A user can double-click a report to preview it in a Print Preview Form.

    ASP.NET Core Blazor
    XAF ASP.NET Core Blazor Report List View, DevExpress
    XAF ASP.NET Core Blazor Report Preview, DevExpress
    Windows Forms
    XAF Windows Forms Report List View, DevExpress
    XAF Windows Forms Report Preview, DevExpress

If you want to skip the preview dialog, refer to the How to: Print a Report Without Displaying a Preview example.


When you create a predefined report with scripts that end users can possibly modify, do not use XtraReport events directly. Instead, use the XtraReport.Scripts and/or XRControl.Scripts properties in the Report Designer, as demonstrated in the following topic: Scripting Overview. Otherwise, when you use the Copy Predefined Report Action, XAF does not copy your code to user scripts.

This technique requires that you add references to assemblies used in scripts to the XtraReport.ScriptReferences property. Assemblies used in your application are attached to scripts automatically. If classes from such assemblies cause errors during script evaluation, either use fully qualified names or add the using (Imports in VB) directive at the beginning of the script.