晶体报告中的印刷有时会停止

2020-09-21 12:39发布

点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)打印效果很好,除了有时可以继续加...

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


打印效果很好,除了有时可以继续加载而不执行任何操作,从而导致我网站上的所有页面都停止了

这是我的代码:

受保护的无效btnSubmit_Click(对象发送者,EventArgs e)
         {
             字符串FileName;
             ReportDocument crd = new ReportDocument();
             尝试
             {
                //如果(rbA4.Checked)
                //{
                 crd.Load(Server.MapPath("〜/Reports/rptPrint.rpt"));
                 crd.RecordSelectionFormula ="(({@DocID} =" + DocID +")";
//出于安全考虑,登录凭据已被替换
  crd.SetDatabaseLogon(" anything"," anything"," anything"," anything",true);
                 crd.Refresh();
                 如果(rbButtomLeft.Checked)
                 {
                     crd.SetParameterValue(" Location"," BL");
                 }
                 否则如果(rbButtomCenter.Checked)
                 {//也许!
                     crd.SetParameterValue(" Location"," BC");
                 }
                 否则if(rbButtomRight.Checked)
                 {//也许!
                     crd.SetParameterValue(" Location"," BR");
                 }
                 如果(rbCenterLeft.Checked)
                 {
                     crd.SetParameterValue(" Location"," CL");
                 }
                 否则(rbCenterRight.Checked)
                 {//也许!
                     crd.SetParameterValue(" Location"," CR");
                 }
                 否则(rbTopLeft.Checked)
                 {
                     crd.SetParameterValue(" Location"," TL");
                 }
                 否则(rbTopCenter.Checked)
                 {
                     crd.SetParameterValue(" Location"," TC");
                 }
                 否则(rbTopRight.Checked)
                 {//也许!
                     crd.SetParameterValue(" Location"," TR");
                 }
                
                 FileName = Session [" UserID"]。ToString()+" _" + DateTime.Now.Ticks +" .pdf";
                 ExportOptions CrExportOptions;
                 DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions();
                 CrExportOptions = crd.ExportOptions;
                 CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                 CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
                 CrDiskFileDestinationOptions.DiskFileName = Server.MapPath("〜/Reports/ExportFiles/" + FileName);
                 CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions;
                 crd.Export();
                 crd.Dispose();
                 GC.Collect();
                 lblMessage.Text = null;
                 iFramePdf.Attributes [" src"] =" ../Reports/ExportFiles/" + FileName; //文件路径从页面目录(文件所在的目录)开始,[FileName]是具有扩展名的文件名
                 Page.ClientScript.RegisterStartupScript(this.GetType()," myScript"," printTrigger(name ='" + FileName +"');",true);


             }
             抓住(例外)
             {
                 lblMessage.Text = ex.Message;
             }
         }