1. 程式人生 > >DEV中多個xtrareport匯出excel,多個sheet頁匯出

DEV中多個xtrareport匯出excel,多個sheet頁匯出

report1.CreateLayoutViewDocument();
 report2.CreateLayoutViewDocument();
            report3.CreateLayoutViewDocument();
            report4.CreateLayoutViewDocument();
            report5.CreateLayoutViewDocument();
            report1.Pages.AddRange(report2.Pages);
            report1.Pages.AddRange(report3.Pages);
            report1.Pages.AddRange(report4.Pages);
            report1.Pages.AddRange(report5.Pages);
            PrintingSystemBase ps = report1.PrintingSystem;
            ps.ContinuousPageNumbering = true;

            ps.ExportOptions.PrintPreview.DefaultFileName =“預設excel名稱";
         
           

            ps.ExecCommand(DevExpress.XtraPrinting.PrintingSystemCommand.ExportXlsx);

其中report為xtrareport例項,本例匯出五個sheet到一個excel檔案,資料來源為五個xtrareport例項