Back to Devexpress

Create Predefined Static Reports

expressappframework-113645-shape-export-print-data-reports-create-predefined-static-reports.md

latest4.1 KB
Original Source

Create Predefined Static Reports

  • Mar 09, 2026
  • 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.25.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.

  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.

  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.

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

  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.

  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.

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

Important

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 directive at the beginning of the script.