Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

XRDesignPanel.ExecCommand(ReportCommand, Object[]) Method

Executes the specified report command and passes the specified parameters to it.

Namespace: DevExpress.XtraReports.UserDesigner

Assembly: DevExpress.XtraReports.v24.2.Extensions.dll

NuGet Package: DevExpress.Win.Reporting

#Declaration

public void ExecCommand(
    ReportCommand command,
    object[] args
)

#Parameters

Name Type Description
command ReportCommand

A ReportCommand enumeration value, specifying the report command to execute.

args Object[]

An array of Object values, specifying the parameters to be passed to the report command.

#Remarks

Use the ExecCommand method to perform various actions in the End-User Designer, such as clicking a menu item, a toolbar button, a context menu item, or a context link. All the available report commands are listed in the ReportCommand enumeration.

To execute a report command without any parameters, use the overloaded XRDesignPanel.ExecCommand method.

#Example

This example illustrates how to execute report commands in an End-User Report Designer by calling the XRDesignPanel.ExecCommand method of an active XRDesignPanel.

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

private void button1_Click(object sender, System.EventArgs e) {
    // Create a Design Tool with an assigned report instance.
    ReportDesignTool designTool = new ReportDesignTool(new XtraReport1());

    // Access the standard or ribbon-based Designer form.
    // IDesignForm designForm = designTool.DesignForm;
    IDesignForm designForm = designTool.DesignRibbonForm;

    // Create a new blank report to initialize a Design Panel.
    designForm.DesignMdiController.CreateNewReport();

    // Handle the Design Panel's Loaded event.
    designForm.DesignMdiController.DesignPanelLoaded += DesignMdiController_DesignPanelLoaded;

    // Load a Report Designer in a dialog window.
    // designTool.ShowDesignerDialog();
    designTool.ShowRibbonDesignerDialog();
}

void DesignMdiController_DesignPanelLoaded(object sender, DesignerLoadedEventArgs e) {
    // Run the Report Wizard every time a Report Designer is loaded.
    ((XRDesignPanel)sender).ExecCommand(ReportCommand.NewReportWizard);
}
See Also