Create a Custom End-User Report Designer
- 3 minutes to read
Note
You need a DevExpress Win
The Invoke a Default End-User Report Designer Form tutorial illustrates how to open the Report Designer if you have an active license for the DevExpress Reporting Subscription.
This tutorial demonstrates how to add the End-User Report Designer to WinForms applications.
Note
If your Win
#Create a Ribbon Report Designer
Switch to the application’s main form in Visual Studio and press CTRL+ALT+X to open the Toolbox. Drop the RibbonReportDesigner component onto the form to create a custom End-User Report Designer with a ribbon UI.
If required, you can hold down the ALT key while dropping this component to add the End-User Report Designer with the previous ribbon version.
Use the XRDesignMdiController.OpenReport method to open a report in the End-User Report Designer.
private void Form1_Load(object sender, System.EventArgs e) {
XtraReport1 report = new XtraReport1();
reportDesigner1.OpenReport(report);
}
Tip
Refer to the Create a Report in Visual Studio article for information on adding a new report to the Visual Studio project.
#Create a Standard Report Designer
Switch to the application’s main form in Visual Studio and press CTRL+ALT+X to open the Toolbox. Drop the StandardReportDesigner component onto the form to create a custom End-User Report Designer with a standard UI.
Use the XRDesignMdiController.OpenReport method to open a report in the End-User Report Designer.
private void Form1_Load(object sender, System.EventArgs e) {
XtraReport1 report = new XtraReport1();
reportDesigner1.OpenReport(report);
}
#Visually Inherit from a Designer Form
Another way to create an End-User Report Designer form is to visually inherit it from the XRDesignForm class.
Note
This approach imposes limitations on using the Visual Studio design time - you cannot customize the XRDesign
Do the following to create an inherited End-User Report Designer form:
Select PROJECT | Add New Item… in the Visual Studio’s main menu and select Inherited Form in the dialog that is invoked.
Click Browse in the invoked Inheritance Picker dialog, and locate the DevExpress.XtraReports.v24.2.Extensions.dll file (it is stored in the “C:\Program Files\DevExpress 24.2\Components\Bin\Framework” folder by default).
Select the XRDesignForm or XRDesignRibbonForm class as the base for the created form and click OK.
This adds a custom Report Designer form to your application:
You can now customize the Report Designer form by adding custom code to the created subclass:
using DevExpress.XtraReports.UserDesigner;
// ...
namespace WindowsFormsApplication1 {
public partial class CustomForm : XRDesignForm {
public CustomForm() {
InitializeComponent();
}
// ...
}
}
#Change the Default Report Settings
The StandardReportDesigner and RibbonReportDesigner components use the following default settings to create new reports:
- PaperKind: Letter
- Landscape: false
- ReportUnit: HundredthsOfAnInch
- PageHeight: 1100
- PageWidth: 850
- Margins: 100, 100, 100, 100
- RollPaper: false
Use the DefaultReportSettings property to change the default report settings.