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();      
  • 相关阅读:
    使用Twitter异常检测框架遇到的坑
    Python从入门到精通
    Windows中几个内存相当的指标
    Windows应用程序进程级别统一监控实践
    基于时序数据的微内核预警引擎架构设计
    Flink1.4.0连接Kafka0.10.2时遇到的问题
    wait和sleep的区别
    JVM几种垃圾回收器介绍
    二叉树的非递归遍历
    段页式内存管理
  • 原文地址:https://www.cnblogs.com/ymecho/p/3064772.html
Copyright © 2011-2022 走看看