Skip to main content

Invoke a Default End-User Report Designer Form

  • 6 minutes to read

This tutorial illustrates how to open a report in an End-User Report Designer form.

Note

You need a Reporting Subscription to use the API described in this tutorial.

Use a Default Design Form

Create a ReportDesignTool class instance with a specified XtraReport (requires referencing the DevExpress.XtraReports.UI namespace).

Note

If your WinForms application targets .NET 6+, add the DevExpress.Win.Reporting NuGet package to this application to use the ReportDesignTool class.

Use any of the methods below to load a report into one of the default End-User Report Designer forms in a WinForms application:

Note

If you implement a custom report that inherits from XtraReport and want to open it in the End-User Report Designer, add a constructor without parameters to this report.

Ribbon Report Designer

The ReportDesignTool.ShowRibbonDesigner and ReportDesignTool.ShowRibbonDesignerDialog methods show a form with a ribbon toolbar.

Each of these methods has overloads to invoke the Designer form with either the default or custom look and feel settings applied.

The following code illustrates how to call these methods in the main application form’s Load event handler:

using DevExpress.XtraReports.UI;
using DevExpress.LookAndFeel;
// ...

private void Form1_Load(object sender, System.EventArgs e) {
    ReportDesignTool designTool = new ReportDesignTool(new XtraReport1());

    // Invoke the Ribbon End-User Report Designer form  
    // and load the report into it.
    designTool.ShowRibbonDesigner();

    // Invoke the Ribbon End-User Report Designer form modally 
    // with the specified look and feel settings.
    designTool.ShowRibbonDesignerDialog(UserLookAndFeel.Default);
}

To make these methods display the End-User Report Designer form with the previous ribbon version, set the static UseOfficeInspiredRibbonStyle property to false at the application’s startup.

static class Program {
    static void Main() {
        DevExpress.XtraReports.Configuration.DesignSettings.Default.UseOfficeInspiredRibbonStyle = false;
        // ... 
    }
}

default-ribbon-report-designer-form

Standard Report Designer

The ReportDesignTool.ShowDesigner and ReportDesignTool.ShowDesignerDialog methods invoke a form with a standard toolbar.

default-standard-report-designer-form

Both methods have overloads to invoke the Designer form with either the default or custom look and feel settings applied.

using DevExpress.XtraReports.UI;
using DevExpress.LookAndFeel;
// ...

private void Form1_Load(object sender, System.EventArgs e) {
    ReportDesignTool designTool = new ReportDesignTool(new XtraReport1());

    // Invoke the End-User Report Designer form  
    // and load the report into it. 
    designTool.ShowDesigner();

    // Invoke the Print Preview form modally 
    // with the specified look and feel settings.
    designTool.ShowDesignerDialog(UserLookAndFeel.Default);
}

Tip

Refer to the Create a Report in Visual Studio article for information on adding a new report to the Visual Studio project.

Use a Specific Design Form

The following examples illustrate how you can open a report in a custom Report Designer form:

Ribbon Report Designer

When creating a custom Report Designer derived from the XRDesignRibbonForm class, you can load a report into it via the XRDesignRibbonForm.OpenReport method.

using DevExpress.XtraReports.UserDesigner;
// ...

private void Form1_Load(object sender, System.EventArgs e) {
    // Enables form skins in the application (if required).
    DevExpress.Skins.SkinManager.EnableFormSkins();
    DevExpress.LookAndFeel.LookAndFeelHelper.ForceDefaultLookAndFeelChanged();
}

private void button1_Click(object sender, System.EventArgs e) {
    // Create an End-User Report Designer form with a ribbon UI.
    XRDesignRibbonForm designForm = new XRDesignRibbonForm();

    // Create a new blank report.
    designForm.OpenReport(new XtraReport1());

    // Display the Report Designer form.
    //designForm.Show();

    // Display the Report Designer form, modally.
    designForm.ShowDialog();
}

To show the Report Designer form with the previous ribbon version, disable the static UseOfficeInspiredRibbonStyle property at the application’s startup.

Note

The XRDesignRibbonForm is based on the RibbonForm class and using it in your application requires adding the following libraries to the References list of your project:

  • DevExpress.XtraBars.v24.1
  • DevExpress.XtraEditors.v24.1

Standard Report Designer

When you create a custom Report Designer derived from the XRDesignForm class, you can use the XRDesignForm.OpenReport method to load a report into it.

using DevExpress.XtraReports.UserDesigner;
// ...

private void button1_Click(object sender, System.EventArgs e) {
    // Create a new End-User Report Designer form.
    XRDesignForm designForm = new XRDesignForm();

    // Load a report into the Report Designer.
    designForm.OpenReport(new XtraReport1());

    // Display the Report Designer form.
    // designForm.Show();

    // Display the Report Designer form, modally.
    designForm.ShowDialog();
}

Use the XRDesignPanel.Report property to access the report displayed in a Report Designer form. To save that report to a file, use the XRDesignPanel.SaveReport method.

using DevExpress.XtraReports.UI;
using DevExpress.XtraReports.UserDesigner;
// ...

private void button1_Click(object sender, System.EventArgs e) {
    // Create a new End-User Report Designer form.
    XRDesignForm designForm = new XRDesignForm();

    // Handle the DesignPanelLoaded event before opening a report in the Report Designer
    designForm.DesignMdiController.DesignPanelLoaded += DesignMdiController_DesignPanelLoaded;

    // Create a new blank report and show it the Report Designer dialog window.
    designForm.OpenReport(new XtraReport1());
    designForm.ShowDialog();
}

public XtraReport report;

void DesignMdiController_DesignPanelLoaded(object sender, DesignerLoadedEventArgs e) {
    // Access the currently opened report.
    report = (sender as XRDesignPanel).Report;

    // Save the report that is currently open to a file.
    (sender as XRDesignPanel).SaveReport(@"D:\\report.repx");
}