您好,
在区域报表已经可以正常运行的前提下,增加button按钮。
- protected void Button4_Click(object sender, EventArgs e)
- {
- 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();
- }
复制代码 |