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

2020-09-21 12:39发布

         点击此处--->   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;
             }
         }
 

         点击此处--->   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;
             }
         }
 
付费偷看设置
发送
4条回答
d56caomao
1楼 · 2020-09-21 13:04.采纳回答

Microsoft建议经常骑自行车。

没有日志或任何报告,因此无可奉告。

尝试使用ProcessMonitor获取一些日志,并查看停止打印时发生的情况。

软件心理学工程师
2楼-- · 2020-09-21 12:43

感谢您的答复,唐。

sdk版本3.5

水晶报表版本13.0.3500.0

所以唯一的原因是回收,我希望有另一种解决方案。

Haoba3210
3楼-- · 2020-09-21 12:54

您使用的是什么SDK?

什么版本?

更新到最新版本。

您可以经常循环IIS,CR需要连续的内存块,并且IIS不能即时对内存进行碎片整理。

MS建议您经常骑自行车。

微wx笑
4楼-- · 2020-09-21 12:55

感谢您的答复,唐。

sdk v3.5

晶体报告13.0.2000.0。

所以唯一的解决方案是经常回收?

一周热门 更多>