New Blog Post: PDF/A and Metadata

How to use region.shiftrelativeto and to position the region NOT above a certain value

edited June 2016 in RAP

I have a title band with several regions in it.

Every region has dynamic height and shifts relative to the previous region.

The last region should be positioned at e.g. "max(150, actualPosition)"
- it should not be above 150, but can be below, if it is necessary. In
other words I need dynamic white space between the second last and last

I searched in the wiki and the forum and played around with
Band.BeforePrint / BeforeGenerate / AfterGenerate / AfterPrint and
Region.OnDrawCommandCreate (to get the actual position of the region),
but always something went wrong (e.g. moving the region after it was
rendered doesn't retrigger rendering, so pagebreaks could be wrong).

Is there a way to achieve what I need?

Thanks in advance!


  • edited June 2016
    Hi Klaus,

    One option would be to place an empty static region between the second
    to last and last regions (shift relative to). This would ensure the
    final two regions are always spaced apart.

    Best Regards,

    Nico Cizik
    Digital Metaphors
  • edited June 2016
    Hi Nico,

    Thanks for your answer.

    I'm not sure if I understand correctly.

    What I currently have is:

    R1: Top 0 cm, stretchable (height at runtime can be between 5 and 25 cm)
    R2: Top 15 cm, shift relative to R1

    Actual result:

    R1.Height = 5 cm -> R2.Top = 5 cm (plus something)
    R1.Height = 15 cm -> R2.Top = 15 cm
    R1.Height = 20 cm -> R2.Top = 20 cm

    But the desired result is:

    R1.Height = 5 cm -> R2.Top = 15 cm
    R1.Height = 15 cm -> R2.Top = 15 cm
    R1.Height = 20 cm -> R2.Top = 20 cm

    Do I understand your suggestion correctly?

    R1: Top 0 cm, stretchable
    R empty: empty, Top 14 cm, not stretchable, no shift relative
    R2: Top 15 cm, shift relative to R-empty

    In that case R2 could be overwritten by content of R1.

    BTW: Cannot set "stretch = false" for a region, at least my designer
    doesn't let me doing this.

    Best regards,

    Am 16.06.2016 um 15:22 schrieb Nico Cizik (Digital Metaphors):
  • edited June 2016
    Hi Klaus,

    Which version of ReportBuilder are you using? Using RB 17.02, it is
    possible to toggle the Stretch property of a Region.

    Looking at your requirements, it appears you would like the first region
    to grow (stretch) until it begins to overlap the second region at which
    time you would like the second region to begin shifting relative to the

    ReportBuilder does not have any built-in features to handle this type of

    Basically you would need to determine the height of the region before
    the report prints (either by estimating its contents or generating the
    report twice), then based on that information, toggle the
    ShiftRelativeTo property based on whether the two regions will overlap
    or not.

    Best Regards,

    Nico Cizik
    Digital Metaphors
This discussion has been closed.