您好,
区域报表基于代码的导出- Reports.SectionReport1 rpt = new Reports.SectionReport1();
- rpt.Run();
- GrapeCity.ActiveReports.Export.Excel.Section.XlsExport XlsExport1 = new GrapeCity.ActiveReports.Export.Excel.Section.XlsExport();
- System.IO.MemoryStream ms = new System.IO.MemoryStream();
- XlsExport1.FileFormat = GrapeCity.ActiveReports.Export.Excel.Section.FileFormat.Xlsx;
- XlsExport1.Export(rpt.Document, ms);
- ms.Position = 0;
- Response.ContentType = "application/vnd.ms-excel";
- Response.AddHeader("content-disposition", Server.UrlPathEncode("attachment;filename=MyExport.xlsx"));
- Response.BinaryWrite(ms.ToArray());
- Response.End();
复制代码
区域报表基于XML的导出- GrapeCity.ActiveReports.SectionReport sr = new GrapeCity.ActiveReports.SectionReport();
- System.Xml.XmlTextReader xtr = new System.Xml.XmlTextReader(Server.MapPath("") + "\\Reports\\RP_YN_YarnSalesSummary.rpx");
- sr.LoadLayout(xtr);
- xtr.Close();
- GrapeCity.ActiveReports.Export.Excel.Section.XlsExport XlsExport1 = new GrapeCity.ActiveReports.Export.Excel.Section.XlsExport();
- System.IO.MemoryStream ms = new System.IO.MemoryStream();
- XlsExport1.FileFormat = GrapeCity.ActiveReports.Export.Excel.Section.FileFormat.Xlsx;
- XlsExport1.Export(sr.Document, ms);
- ms.Position = 0;
- Response.ContentType = "application/vnd.ms-excel";
- Response.AddHeader("content-disposition", Server.UrlPathEncode("attachment;filename=MyExport.xlsx"));
- Response.BinaryWrite(ms.ToArray());
- Response.End();
复制代码 |