zoukankan      html  css  js  c++  java
  • 控制水晶报表只能导出PDF

        ds_Leader.Tables.Add(dt);
                ds_Leader.Tables[0].TableName = "dt";//
                ds_Leader.Tables.Add(dt1);
                ds_Leader.Tables[1].TableName = "dt1";//
    
                //ReportDocument rtd = new ReportDocument();
                //string path = Server.MapPath("\\QueryStatistic\\CrystalReport\\ReserveSummaryReport.rpt");
                //rtd.Load(path);
                //rtd.SetDataSource(ds_Leader);
                //CrystalReportViewer1.ReportSource = rtd;
                CommonOper.PDFOperate pdfOperate = new CommonOper.PDFOperate();
                CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new ReportDocument();
                rptDoc.Load(this.Server.MapPath("\\QueryStatistic\\CrystalReport\\ReserveSummaryReport.rpt"));
                rptDoc.SetDataSource(ds_Leader);
                CrystalDecisions.Shared.DiskFileDestinationOptions objFile = new CrystalDecisions.Shared.DiskFileDestinationOptions();
                objFile.DiskFileName = this.Server.MapPath("myTest.pdf");
                rptDoc.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                rptDoc.ExportOptions.DestinationOptions = objFile;
                rptDoc.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
                rptDoc.Export();
                string error = "pdf生成水印错误";
                bool IsRight = pdfOperate.AddTextWaterMark("myTest.pdf", ref error, DateTime.Now.ToString(), 0);
                Response.ClearContent();
                Response.ClearHeaders();
                Response.ContentType = "application/pdf";
                Response.WriteFile(objFile.DiskFileName);
                Response.Flush();
                Response.Close();      
  • 相关阅读:
    Amoeba -- 阿里巴巴工程师的开源项目之一陈思儒
    js表达式与语句的区别
    互联网公司github项目汇总
    CDN解决方案
    免费评论组件多说
    ajax同步的实现
    两种时间格式化对比
    Google Gson 使用简介
    使用XStream解析MXL文件用到的jar包---xpp3_min-1.1.3.4.O.jar和xstream-1.3.1.jar
    《Netty in Action》中文版
  • 原文地址:https://www.cnblogs.com/ymecho/p/3064772.html
Copyright © 2011-2022 走看看