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();      
  • 相关阅读:
    把DataSet转换成JSON
    adb devices无法连接设备
    fiddler运行报错:Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute'
    Jira 通过csv导入数据
    postman设置环境变量
    VirtualBox主机与虚拟机文件夹共享
    python selenium环境配置
    python json.dump中文乱码问题
    python字典
    python练习:猜价钱小游戏
  • 原文地址:https://www.cnblogs.com/ymecho/p/3064772.html
Copyright © 2011-2022 走看看