thunfeid 发表于 2018-6-11 12:54:28

区域报表导出Excel

WPF平台AR11


代码:
string dir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);//系统桌面路径
string filename = "导出文件.xls";
GrapeCity.ActiveReports.Export.Excel.Section.XlsExport xlsexpt = new XlsExport();
xlsexpt.FileFormat = FileFormat.Xlsx;
xlsexpt.UseCellMerging = true; //合并单元格,所见即所得
GrapeCity.ActiveReports.SectionReport RPT = 区域报表实例;
xlsexpt.Export(RPT.Document, dir + "\\" + filename);
Process.Start("explorer.exe", dir); //打开生成的文件夹

KearneyKang 发表于 2018-6-11 13:04:07

这波区域报表的导出Excel的代码贴的很到位。赞一个
区域报表导出Excel的核心代码:
SectionReport1 rpt = new SectionReport1();
            GrapeCity.ActiveReports.Export.Excel.Section.XlsExport XlsExport1 = new GrapeCity.ActiveReports.Export.Excel.Section.XlsExport();
            // Set a file format of the exported excel file to Xlsx to support Microsoft Excel 2007 and newer versions.
            XlsExport1.FileFormat = GrapeCity.ActiveReports.Export.Excel.Section.FileFormat.Xlsx;
            XlsExport1.Export(rpt.Document, Application.StartupPath + "\\XLSExpt.xlsx");



页: [1]
查看完整版本: 区域报表导出Excel