Reports V2 Module
- 4 minutes to read
Reports are widely used in business applications to present data in human-readable and printer-friendly formats. The Reports V2 module is introduced to simplify the integration of DevExpress Reporting into XAF applications. Note that WinForms, ASP.NET Web Forms, and ASP.NET Core Blazor XAF applications are standard .NET applications, and the approaches described in the GUI and Web Reporting tutorials are fully applicable, but you need to create a user interface for reports access and implement a storage for user-defined reports manually. The Reports V2 module provides ready-to-use solutions for these tasks, which cover the most popular scenarios.
With the Reports V2 module, reports are represented by business objects that are stored with other persistent objects in the application database. A list of included reports (both predefined in Visual Studio and added by end-users) is displayed in the Reports List View, which can be invoked from the Reports navigation item. The Reports View is accompanied by the Actions used to manage reports (create, design, print, copy, etc.). Reports can also be executed from a business object context - you can select several objects and then use the ShowInReport Action to display these objects in a report.
Note
If the solutions provided by the Reports V2 module are not applicable in your particular scenario, feel free to integrate XtraReports in a custom way (see How to: Show an XtraReport created at design time, without the use of XAF Reports module).
Reports V2 Capabilities
- Create, preview and print end-user reports at runtime and persist these reports in the database.
- Preview and print predefined reports designed by the developer in Visual Studio.
- Use predefined reports as templates for creating end-user reports.
DevExpress Controls Used by the ReportsV2 Module
WinForms
- XRDesignForm - used to design reports in WinForms (when the IModelOptionsWin.FormStyle property is set to Standard).
- XRDesignRibbonForm - used to design reports in WinForms (when the IModelOptionsWin.FormStyle property is set to Ribbon).
- ReportPrintTool - used to preview and print reports in WinForms applications.
Examples: How to: Customize the WinForms Report Designer Form | How to: Use the Custom WinForms Report Designer | How to: Use the Custom Report Preview Form
ASP.NET Web Forms
- ASPxReportDesigner - used to design reports in ASP.NET Web Forms applications.
- ASPxDocumentViewer - used to preview and print reports in ASP.NET Web Forms applications (when the ReportsAspNetModuleV2.ReportViewerType property is set to ASP).
- ASPxWebDocumentViewer - used to preview and print reports in ASP.NET Web Forms applications (when the ReportsAspNetModuleV2.ReportViewerType property is set to HTML5).
Examples: How to: Access the ASPxReportDesigner Control | How to: Access the ASPxDocumentViewer and ASPxWebDocumentViewer Controls
ASP.NET Core Blazor
- DxReportDesigner - used to design reports in ASP.NET Core Blazor applications.
- DxReportViewer - used to preview and print reports in ASP.NET Core Blazor applications.
Examples: How to: Access the Report Designer Control (Blazor) | How to: Access the Report Preview Control (ASP.NET Core Blazor)
Reports V2 Module Components
The Reports V2 Module consists of the following platform-agnostic and platform-specific components.
- ReportsModuleV2
Add it to your platform-agnostic module in the MySolution.Module\Module.cs file (see ModuleBase.RequiredModuleTypes). - ReportsWindowsFormsModuleV2
Add it to your WinForms application project in the MySolution.Win\WinApplication.cs file (see XafApplication.Modules). - ReportsAspNetModuleV2
Add it to your ASP.NET Web Forms application project in the or MySolution.Web\WebApplication.cs file (see XafApplication.Modules). - ReportsBlazorModuleV2
Add it to your ASP.NET Core Blazor application project in the MySolution.Blazor.Server\BlazorApplication.cs file (see XafApplication.Modules).
Note
In .NET applications, you can call the AddReports(IModuleBuilder<IBlazorApplicationBuilder>, Action<ReportsOptions>) / AddReports(IModuleBuilder<IWinApplicationBuilder>, Action<ReportsOptions>) method in your ASP.NET Core Blazor / WinForms application builder.
- In .NET Framework applications, you can also use the Module Designer and Application Designer to add a module to your project.
You can add modules to your application when you use the Solution Wizard to create a new XAF solution. Select modules in the Choose Additional Modules step.
Report Data Type
Reports are persisted using business objects (entities) that implement the IReportDataV2 interface. If you use XPO, the ReportDataV2 persistent class implemented in the Business Class Library is used automatically. If you use Entity Framework, you should manually set the ReportsModuleV2.ReportDataType property to ReportDataV2 and add this type to your DBContext (see Create and Preview a Report). You can also use a custom report data type (see How to: Add a Custom Column to the Reports List).