Jump to content
Hrushikesh Shet

Delphi Report Builder - Failed to export report on second attempt

Recommended Posts

We have an application built in Delphi XE6. We are using the component named 'TppReport' from the report builder to generate the reports. Currently, we are facing an issue while exporting the report.

The application can generate and export the report in the respective format for the first time. However, when we try to export it for the second consecutive time, the file is not generated. If we restart the application then the report is generated and exported only for the first time instance.

 

When we tried to debug this behavior we came to know that we were getting an access violation error in the RequestPage procedure inside that generate method of ppEngine.pas file. This error comes up when we execute the line CustomReport.PrintReport.

 

This happens when we have bands in the report. Below are more details - 
 

  • Delphi Version - XE6 Version 20.0.16277
  • Report Builder Version - 20.04 Build 302

 

Any help would be appreciated.

Share this post


Link to post
On 2/29/2024 at 5:59 AM, Hrushikesh Shet said:

However, when we try to export it for the second consecutive time, the file is not generated. If we restart the application then the report is generated and exported only for the first time instance.

Is the report's pipeline a TppDBPipeline? If so, add a BeforePrint event handler to the TppReport component. In the event handler, call Dataset.First on the master/primary dataset used by the report. I do not have 22.04 available to test whether that is an issue. With 22.03, the dataset is Eof after the report is exported and attempting to generate or export the same report a second time results in an empty report.

 

On 2/29/2024 at 5:59 AM, Hrushikesh Shet said:

When we tried to debug this behavior we came to know that we were getting an access violation error in the RequestPage procedure inside that generate method of ppEngine.pas file. This error comes up when we execute the line CustomReport.PrintReport.

I would expect you would have seen some dialog informing you of an Access Violation before you tried to debug, unless there is code in your unit that is "eating" exceptions (an empty except/end block).

 

Looking at RequestPage in 22.03, my first thought is that a pipeline, datasource, or dataset is being destroyed before the TppReport component is destroyed. In the unit containing the line CustomReport.PrintReport, is there any code that calls Free to destroy an object?

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×