1. Gastón Clara
  2. PowerBuilder
  3. Thursday, 7 November 2019 16:42 PM UTC

Hi,

We have a process that generate a dynamic report for a customer. It is dynamic because every customer has different information that is printed on the same report. For that we manually build the syntax for the dw and then create it and print it.

What we create is a dw with a fixed header, a fixed footer ad only one detail row with all the information on it (see the attached example).

The user can choose to print in Letter or A4 paper size so we change some of the properties according to that.

The problem comes when we preview it or print it. As we only have one row we need to simulate page breaks in order that we have no overlapping objects when PB generates the report. The idea is to find the max size that we can use to position objects on the different pages and move to the next one if the object does not fit in the current page. For that, we need to find that correct size, I tested with hundreds of sizes no one works. And I discover why.

For example, if I set the units for the dw in pixels I saw that the first jump is at 861 units, the second should be at 861* 2 = 1722, the third at 861*3=2583 and so on.

In the attached dw I put a red line on each imaginary page break and I can check that all the objects are correctly positioned in a way that no one overlaps those lines. Thus, the process that positions the objects verifying the positions works fine.

But, when I preview the object or send it to print, the errors appear and the objects starts to overlaps the page breaks generated by PB. And that breaks, does not corresponds to the ones for the red lines. On every page the space between the corresponding red line and the break generated by PB increased. That causes the objects to overlap the jumps.

 

I would like to understand the behavior. With that issue there is no way to set a manual page break. How PB establishes the jumps between pages? How can I manage to put extra spaces in order to simulate a page break?

I tried using the different units for the dw (pixels, PBUnits, inches and cms) and in all the cases the result is the same.

 Thank you very much for your help.

 

Gastón.

Attachments (1)
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 8 November 2019 03:22 AM UTC
  2. PowerBuilder
  3. # 1

Not sure if this might help, it's just an idea.

This is a composite datawindow, right? You could insert a "dummy" dw / report at the point where you want the page break to occur. Just insert it and mark the "new page" property. (I guess you can do all that dynamically?).

Not an easy one. Maybe you can rethink the whole thing and do something less dynamic, feeding the data from datastores in code.

Or ... if this is not 'composite', you could add a dummy field to the select, group on that field and set the properties to page break on change of group. You'd have to assign a different incremented value to the field when you want the page break.

Just to give you an idea, not sure if any good,

regards

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 7 November 2019 20:48 PM UTC
  2. PowerBuilder
  3. # 2

Hi Gastón;

  Thanks for the DWO source! I see that the DW Source states PB verision 12 and the DWO Source is also full of "AutoSizeHeight" properties set to YES.

  What PB & O/S version (build) are you using for this?

Regards ... Chris

Comment
  1. Gastón Clara
  2. Thursday, 7 November 2019 21:32 PM UTC
Pb 12.0 build 5530 and Windows 10
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.