请参考以下代码:
- protected void btnWord_Click(object sender, EventArgs e)
- {
- SectionReport1 section = new SectionReport1();
- section.UnboundDataSource = GetData1();
- section.Run();
- System.IO.MemoryStream ms = new System.IO.MemoryStream();
- GrapeCity.ActiveReports.Export.Word.Section.RtfExport rtfExport = new GrapeCity.ActiveReports.Export.Word.Section.RtfExport();
- rtfExport.Export(section.Document, ms);
- Response.ContentType = "application/rtf";
- Response.AddHeader("content-disposition", Server.UrlPathEncode("attachment;filename=客户订单.rtf"));
- Response.BinaryWrite(ms.ToArray());
- Response.End();
- }
- protected void btnPdf_Click(object sender, EventArgs e)
- {
- SectionReport1 section = new SectionReport1();
- section.UnboundDataSource = GetData1();
- section.Run();
- System.IO.MemoryStream ms = new System.IO.MemoryStream();
- GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport pdfExport = new GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport();
- pdfExport.Export(section.Document, ms);
- Response.ContentType = "application/pdf";
- Response.AddHeader("content-disposition", Server.UrlPathEncode("attachment;filename=客户订单.pdf"));
- Response.BinaryWrite(ms.ToArray());
- Response.End();
- }
复制代码 |