Search code examples
c#devexpress

N number of report whith different parameters


I am totaly begginer in DevExpress. I have N number of report (let's say around 100) with different parameters. Now I want to create solution which I will choose parameters and report it will display report in Viewer. Since I have read about DevExpress but I couldnt find any example how to do this. Any idea or guidelines how to do this kind of Report


Solution

  • Refer: Set programatically the title to the viewer form in XtraReport

    public partial class ReportViewer : DevExpress.XtraEditors.XtraForm
    {
        public ReportViewer()
        {
            InitializeComponent();
        }
    
        // Used when displaying a single report
        public void SetReport(XtraReport report)
        {
            this.printControl.PrintingSystem = report.PrintingSystem;
            report.CreateDocument();
            this.printControl.UpdatePageView();
        }
    
        // Used when displaying merged reports
        public void SetReport(PrintingSystem system)
        {
            this.printControl.PrintingSystem = system;
            this.printControl.UpdatePageView();
        }
    }
    

    So displaying a report goes like this:

    ReportViewer viewer = new ReportViewer();
    viewer.SetReport(new EmployeeReport());
    viewer.Show();
    

    How to load a report to the Document Viewer at runtime