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();      
  • 相关阅读:
    完全图解scrollLeft,scrollWidth,clientWidth,offsetWidth 获取相对途径,滚动图片
    Input的size,width,maxlength属性
    Linux,VI命令详解
    Javascript 第十章
    Javascript 第七章
    IE css hack
    Javascript 第九章
    js中document.documentElement 和document.body 以及其属性
    关于xmlhttp.status == 0的问题
    Javascript 第八章
  • 原文地址:https://www.cnblogs.com/ymecho/p/3064772.html
Copyright © 2011-2022 走看看