回复 1楼Young的帖子
请参考以下代码:
- protected void btnExcel_Click(object sender, EventArgs e)
- {
- SectionReport1 section = new SectionReport1();
- section.UnboundDataSource = GetData1();
- section.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(section.Document, ms);
- Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
- Response.AddHeader("content-disposition", Server.UrlPathEncode("attachment;filename=客户订单.xlsx"));
- Response.BinaryWrite(ms.ToArray());
- Response.End();
- }
复制代码 |