Solution to slow issue of first time crystal RePort Printing

Source: Internet
Author: User

The business of the company project requires users to print a file confirmation form when obtaining files. This function is implemented using Crystal Reports, but it is always slow for the first time when printing a list, according to rough calculations, it takes about 30 seconds to print data. I have read a lot on the Internet and many people have encountered the same problem. In some forums such as csdn, most people suspect that there are two reasons:

(1) Some people suspect that the check may be due to a large amount of data or SQL writing problems. Generally, I only have 1-10 pieces of data, which should not be a data problem.

(2) It is recommended that you change the control. If you do not want to use third-party things, you have also used the controls in Vs, but the export may be problematic, you can use the Operation Office to export directly to word printing, but you need to install office on the client

During debugging, it was found that the first printing time was slow because the setdatasource () method was stuck for a while, so I came up with a method to solve this problem and shared it with you. Instead of solving it, you just need to find a speculative method to hide it. I don't know much about the specific loading method of the crystal report, but according to debugging, I suspect that the first time the setdatasource () method is executed, the crystal report will load something, so it will be very slow, so when I started running the program, I wrote the following code)

 

1 # region cache file list
2
3 // to solve the problem of slow printing of the first CRYSTAL REPORT
4 datatable dt = new datatable ();
5 DT. Columns. Add ("Temp ");
6 // crystal report object
7 forms. Report. rptfilelist file = new forms. Report. rptfilelist ();
8 file. setdatasource (DT );
9
10 # list of endregion cache files
11 application. Run (new forms. frmmain ());

 

 

Obviously, I put this code in program. before loading the main form in CS, let the crystal report program load an empty datatable in advance, so that the crystal report can load everything to be loaded in advance, in this way, when the form is printed, it is almost a second .... It is not easy to write, and I hope it will help you with your questions.

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.