Printing sheets

Posted by: tosch on 8 September 2017, 3:02 pm EST

  • Posted 8 September 2017, 3:02 pm EST

    I have an app which reads data from a file into a sheet and then prints the sheet. In some cases the app does this for multiple files.

    If I have two files, read the first file and print it and the immediately load the second file and print it the second file is printed twice. There are normally only 2-10 rows to be printed.

    It looks like Spread is delaying the printing and then starts printing the second time when the data for the first print job are removed and replaced by the data for the second print job.

    Is there a way to find out when Spread has finished printing so my app can wait?


  • Replied 8 September 2017, 3:02 pm EST

    Hello,

    I am not very sure why this might be happening, however you can use the PrintMessageBox event, which will be raised with the BeginPrinting parameter set to False when the print job is finished. You can use the same to provide a waiting time between the two printing jobs. However if you still face the same issue, I would request you to provide me a sample depicting your issue so that I can replicate the issue at my end and debug it further.

    Hope it will help you. Please let me know if you have any queries further.

    Thanks,

    Manpreet Kaur

  • Replied 8 September 2017, 3:02 pm EST

    I have tried it with showing a message box between print jobs. Then everything works fine.

    This problem is occuring in an app that runs unattended on a server so I can't show a message box. I guess I will just have to wait for a number of seconds between print jobs.

     

    Attached is a small sample app to demonstrate the issue.


    2012/12/Spread_Print_TwoSheetsQuickly.zip
  • Replied 8 September 2017, 3:02 pm EST

    Hello,

    Thank you for providing the sample application. I executed the same and was able to observe the behavior described by you. However it seems to be an intended behavior as the printing job is executed in a separate thread, and you are immediately changing the sheet contents, which makes you feel that it is printing the last sheet twice but it is not so, basically before the print job has finished execution, the sheet contents are replaced and hence it prints the same contents for both the sheets. The message box displayed in between gives the first printing job time to finish and then the contents are replaced which gives you the correct printing. So, I would suggest you to make use of the PrintMessageBox event as suggested in the above post to know when one printing job is ended and then start the another printing job.

    Please have a look at the attached modified sample that depicts the same. Hope it will help you. Please let me know if you have any queries further.

    Thanks,

    Manpreet Kaur


    2012/12/Spread_Print_TwoSheetsQuickly (2).zip
  • Replied 8 September 2017, 3:02 pm EST

    Thanks for you help, I am now waiting until the printmessagebox event signals that printing has finished before I continue with the second print job.

     

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels