Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

RB22.02 / out of bound error in TppPublisher.TakeDeviceAction.

Hello,

I'm a long time user of reportBuilder but until now, I was using delphi 2010 and reportbuilder std 12.05.

Now I'm migrating to Delphi 11 (Version 28.0.48361.3236) and reportBuilder 22.02.

In my software, I have to create a report that I display in a preview window. Then I export it to a pdf.

During the pdf creation process, there is an out of bound error that is raised in TppPublisher.TakeDeviceAction.

At the beginning of this procedure, there is "liDevices := FDevices.Count;" and the value is 2. Then, in this procedure, there is an iteration:

for liDevice := 0 to (liDevices - 1) do
begin
lDevice := Devices[liDevice];

....

The problem is that during the first iteration, the number of devices changes to 1...

Then in the second iteration, "lDevice := Devices[liDevice];" is called with liDevice=1 which is out of the Devices bounds.

Here is a screenshot: https://ibb.co/BVjpxnx

Can anyone tell me if I'm doing something wrong or if there is a problem in the code ?

Thanks

Comments

  • Hi Laurent,

    This is not a known issue. We will need to see your underlying code to understand what is happening.

    1. Are you displaying the report in the built-in Report Preview or your own TppViewer?

    2. Are you exporting to PDF in code or from the Previewer?

    If you are exporting in code with an active TppViewer present, it's best to use the built in routine TppViewer.ExportToFile (see the help topic for info). This is the routine that the built-in previewer uses to ensure the screen device is properly disconnected and reconnected during the export process.
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • Hi Nicocizik,
    Thanks for your useful answer.
    I've set "Viewer.ScreenDevice.Publisher:=nil;" just before printing the report to a pdf and it apparently solved the problem.
    After printing, should I set "Viewer.ScreenDevice.Publisher" to its initial value ?
    Thanks for your help.
    BR
  • Hi Laurent,
    After printing, should I set "Viewer.ScreenDevice.Publisher" to its initial value ?
    Yes, or simply call the TppViewer.ExportToFile routine which takes care of this for you. This is how file export is handled from the built-in preview.
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
Sign In or Register to comment.