简体   繁体   中英

Crystal report too slow from Visual Studio 2019 and Winforms

I have a form that prints some reports created with Crystal Report (13.030) and Visual Studio 2019. The printing of each report takes about 5/8 seconds. I have tried all the suggestions found on google, but have not solved anything. Since the reports are about 10m, the customer has to wait a long time before being able to continue.

I have read that it is a known problem, but I don't know how to fix it. I've been thinking about doing the prints in a BackgroundWorker, but I'm not sure if that's a good idea.

I checked the No printer in report box. This is one of my reports, which are all very similar. Am I wrong something?

ReportDocument myReport = new ReportDocument();                           
myReport.Load("myreport.rpt");
PrintLayoutSettings PrintLayout = new PrintLayoutSettings();
PrinterSettings printerSettings = new PrinterSettings();
printerSettings.PrinterName = "PDF Creator"; // Any;
PageSettings pSettings = new PageSettings(printerSettings);

myReport.SetParameterValue("var1", "123"); 
myReport.SetParameterValue("var2", "ABC"); 
myReport.SetParameterValue("var3", "DEF"); 

myReport.PrintToPrinter(printerSettings, pSettings, false, PrintLayout);

myReport.Close();

我将打印件移动到尽可能多的 BackgroundWorkers,显然一切都非常快,即使我不知道这是否是最佳解决方案。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM