Back to Devexpress

XRDesignMdiController.CreateNewReportWizard() Method

xtrareports-devexpress-dot-xtrareports-dot-userdesigner-dot-xrdesignmdicontroller-41185344.md

latest5.3 KB
Original Source

XRDesignMdiController.CreateNewReportWizard() Method

Invokes the Report Wizard.

Namespace : DevExpress.XtraReports.UserDesigner

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

NuGet Package : DevExpress.Win.Reporting

Declaration

csharp
public void CreateNewReportWizard()
vb
Public Sub CreateNewReportWizard

Remarks

This example demonstrates how to invoke the Report Wizard by calling the XRDesignMdiController.CreateNewReportWizard method.

After the report has been created, it is saved to a temporary file, where it can be later reconstructed and previewed.

vb
Imports System
Imports System.Windows.Forms
Imports DevExpress.XtraReports.UI
Imports DevExpress.XtraReports.UserDesigner
' ...

Namespace docNewReportWizard
    Partial Public Class Form1
        Inherits Form

        Public Sub New()
            InitializeComponent()
        End Sub

        Private Sub simpleButton1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles simpleButton1.Click
            Dim fileName As String = CreateReport()

            Me.BeginInvoke(New MethodInvoker(Sub() PreviewReport(fileName)))
        End Sub

        Private Function CreateReport() As String
            Dim fileName As String = "temp.repx"
            Dim form As New XRDesignForm()
            form.DesignMdiController.CreateNewReportWizard()
            form.ActiveDesignPanel.BeginInvoke(New MethodInvoker(Sub() form.ActiveDesignPanel.Report.SaveLayout(fileName)))
            Return fileName
        End Function
        Private Sub PreviewReport(ByVal fileName As String)
            Dim newReport As XtraReport = XtraReport.FromFile(fileName, True)
            newReport.ShowPreview()
        End Sub

    End Class
End Namespace
csharp
using System;
using System.Windows.Forms;
using DevExpress.XtraReports.UI;
using DevExpress.XtraReports.UserDesigner;
// ...

namespace docNewReportWizard {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
        }

        private void simpleButton1_Click(object sender, EventArgs e) {
            string fileName = CreateReport();

            this.BeginInvoke(new MethodInvoker(
                () => {
                    PreviewReport(fileName);
                }
                ));
        }

        private string CreateReport() {
            string fileName = "temp.repx";
            XRDesignForm form = new XRDesignForm();
            form.DesignMdiController.CreateNewReportWizard();
            form.ActiveDesignPanel.BeginInvoke(new MethodInvoker(() => { form.ActiveDesignPanel.Report.SaveLayout(fileName); }));
            return fileName;
        }
        private void PreviewReport(string fileName) {
            XtraReport newReport = XtraReport.FromFile(fileName, true);
            newReport.ShowPreview();
        }

    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CreateNewReportWizard() method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-reporting-add-ai-options-to-report-wizard/CS/CustomXRDesignRibbonForm.cs#L13

csharp
base.OnLoad(e);
    DesignMdiController.CreateNewReportWizard();
}

winforms-reporting-add-ai-options-to-report-wizard/VB/CustomXRDesignRibbonForm.vb#L17

vb
MyBase.OnLoad(e)
    DesignMdiController.CreateNewReportWizard()
End Sub

See Also

Invoke the Report Wizard

XRDesignMdiController Class

XRDesignMdiController Members

DevExpress.XtraReports.UserDesigner Namespace