如果打印机无效,Crystal Reports 加载速度会非常慢

发布于 2024-10-18 21:06:47 字数 1021 浏览 1 评论 0原文

在 Crystal Reports 中,如果其他开发人员设计了报表,我会看到错误“此报表使用无效打印机。将使用默认打印机。”

我注意到,当报告出现此错误消息时,需要很长时间才能以编程方式打开报告。当打印机无效时,一份报告的加载时间长达 1 1/2 分钟,而当我修好打印机后,加载时间仅需 5 秒。问题是,我们可以修复网络打印机中的报告,但我们将软件部署给没有我们打印机设置的客户。他们可能有所有报告的加载时间。

如何以编程方式将打印机设置为默认打印机,以加快报告加载速度?

下面的代码不起作用;至少,无论我是否能够从该打印机名称进行打印,加载仍然需要 1 1/2 分钟。我正在使用 ReportDocument (CrystalDecisions.CrystalReports.Engine.ReportDocument) 对象进行打印。这是代码片段,以及我尝试设置新打印机的位置。


// Create CrystalDecisions.CrystalReports.Engine.ReportDocument object
ReportDocument crReportDocument = new ReportDocument();
// Typically this is set to .PortableDocFormat
ExportFormatType selectedOutputType = m_ExportFormat;

System.Drawing.Printing.PrinterSettings printerSettings = new System.Drawing.Printing.PrinterSettings();
crReportDocument.PrintOptions.PrinterName = printerSettings.PrinterName;

// Load() takes an EXTREMELY long time 
// if the RPT file is saved with a printer not found on this computer.
crReportDocument.Load(m_FileName); 

In Crystal Reports, if another developer designed a report, I see the error "This report uses an invalid printer. The default printer will be used instead."

I noticed that it takes a VERY long time to open reports programatically when they have this error message. One report took up to 1 1/2 minutes to load with an invalid printer, and then only 5 seconds to load when I fixed the printer. The problem is, we can fix the reports within our network printers, but we deploy our software to customers who will not have our printer setup. They likely have these load times for ALL reports.

How do I set the printer programatically to the default printer, to speed the report loading up?

The code below didn't work; at least, it still took 1 1/2 minutes to load, whether I am able to print from that printer name or not. I am using a ReportDocument (CrystalDecisions.CrystalReports.Engine.ReportDocument) object to print. Here is a snippet of the code, along with where I am trying to set a new printer.

// Create CrystalDecisions.CrystalReports.Engine.ReportDocument object
ReportDocument crReportDocument = new ReportDocument();
// Typically this is set to .PortableDocFormat
ExportFormatType selectedOutputType = m_ExportFormat;

System.Drawing.Printing.PrinterSettings printerSettings = new System.Drawing.Printing.PrinterSettings();
crReportDocument.PrintOptions.PrinterName = printerSettings.PrinterName;

// Load() takes an EXTREMELY long time 
// if the RPT file is saved with a printer not found on this computer.
crReportDocument.Load(m_FileName); 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

浅浅 2024-10-25 21:06:47

尝试在水晶报表中选择“无打印机”选项。

  1. 在 Crystal Designer 中打开报表,转到页面设置。
  2. 勾选“无打印机”。保存报告。
  3. 发布报告。

Try to choose the "No Printer" option in crystal report.

  1. Open the report in Crystal Designer, go to Page Setup.
  2. Check "No Printer". Save the report.
  3. Publish the report.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文