清风堂堂

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

这个问题官网一直都没有解决,反复强调说只有转成PDF才是最好的结局方法,官方给出了个半自动的解决方案,各位可以参考一下。

protected void Button1_Click(object sender, EventArgs e)
 {
     FastReport.Utils.Config.WebMode = true;
 
     using (Report report = new Report())
     {
  report.Load("your_report.frx");
  report.RegisterData(...);
  report.Prepare();
 
  // Export report to PDF stream
  FastReport.Export.Pdf.PDFExport pdfExport = new FastReport.Export.Pdf.PDFExport();
  using (MemoryStream strm = new MemoryStream())
  {
      report.Export(pdfExport, strm);
 
      // Stream the PDF back to the client as an attachment
      Response.ClearContent();
      Response.ClearHeaders();
      Response.Buffer = true;
      Response.ContentType = "Application/PDF";
      Response.AddHeader("Content-Disposition", "attachment;filename=report.pdf");
 
      strm.Position = 0;
      strm.WriteTo(Response.OutputStream);
      Response.End();
  }
 
     }
 }

FastReport ASP.Net包括在FastReport.Net里面,有兴趣的可以点这里下载~

 

posted on 2013-09-06 10:51  清风堂堂  阅读(2728)  评论(3编辑  收藏  举报