Skip to Content
Mar 25, 2011 at 04:07 PM

Cancelling and/or Progress when for ReportDocument ExportToDisk


Our application allows users to run various reports and the users are able to specify the criteria which is used to filter the reports. If the user enters criteria which results in a large amount of data coming back the report may take a long time to run. Our users would like to be able to cancel the generation of the report. Showing some sort of progress bar would also be very helpful.

Our code currently uses ExportToDisk to generate the report because we save a copy of the report in our database and then optionally display it to the user. Is there any way to get progress information for ExportToDisk and is there a way to cancel a call to ExportToDisk?

I see that in your Crystal Reports application in the Options dialog on the Database tab there is an option for "Perform Query Asynchronously" and the help states "Retrieving data from the database server can be divided into two parts: executing the SQL statement and fetching the rowset from the database server. Selecting this option allows Crystal Reports to execute the SQL statement asynchronously, which means that instead of waiting for the SQL statement to finish executing, the program checks intermittently to see if the user wants to cancel the process."

I'm not sure if this implies that it is possible to cancel the report generation or if you simply run the generation on a background thread and then kill the thread.

What can we do in order to be able to cancel our report generation? The icing on the cake would be able to get progress information as well.