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

Alternative to KeepTogether?

edited August 2005 in General
Hi Guys,

There's a feature in MS Word that seems so logical, that I cannot
imagine how I keep not finding it in ReportBuilder.

If I type a heading, apply the style (say, Heading2) and continue with
my paragraph, the heading sticks to the first few lines of that
paragraph, no matter what. Seven line paragraph of which four fits on
the same page as the heading? No problem, the heading stays put and the
paragraph breaks. Seven line paragraph of which only the first line fits
on the same page as the heading? Not a problem either! The heading and
the entire paragraph breaks to the next page. It always looks good, with
no unnecessary blank half-pages to be seen.

I simply cannot duplicate this in RB Pro 7. The KeepTogether property
does sort of the same thing, only not at all. I have resorted to using
it on small sections of reports, but that only saves you a little bit of
pain.

For emaple, I have SubReport which contains a heading and a group with
group heading, detail and a group footer. On the group, I have
KeepTogether set to True, so I know that each group will print
completeley on its page. Now, this will normally be a grid containing
about four or so rows, rarely ten or more. But I may have ten or twenty
groups.

If I set the KeepTogether property on the SubReport, my heading will
shift to the next page if group 1 doesn't fit, but also if only group 3
doesn't fit. Nasty. So now I set KeepTogether on the group instead, and
then occasionally find a heading orphaned right at the bottom of the
page.

Neither solution works. Is there a problem with my abstract thinking, or
is this very logical behaviour *really* not possible to produce?

A second annoyance to me relates to BottomOffset. The reports where it
bugs me all have several SubReports, some of which may not be visible
for all possible data. If the last visible report has a bottom offset
set and it ends near the bottom of a page, you get a final page
containing nothing but a footer with a page count. I fixed this by
iterating my SubReports at runtime and setting BottomOffset on all but
the bottommost report, but still I think this is a fairly obvious
feature. I can hardly think that anyone will ever need that meaningless
last page, but even supporting both options should be trivial.

Regards,

Cobus



--- posted by geoForum on http://delphi.newswhat.com

Comments

  • edited August 2005
    Hi Cobus,

    Take a look at the following example on hiding an orphaned group header.

    http://www.digital-metaphors.com/tips/HideOrphanGroupHeader.zip

    For the second issue, ReportBuilder will not break a page unless there is
    information that cannot fit on the current page. In this case something is
    unable to fit in the alloted space of the last page and ReportBuilder is
    being forced to break another page. Thanks for the feedback, we will look
    into enhancing this for a later release of ReportBuilder.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2005
    Thanks Nico,

    Judging from the demo, I'd say this is exactly what I needed.

    Unfortunately it doesn't work in my case just yet - it has simply
    highlighted an anomaly that I have never noticed before.

    I have multiple levels of nesting with SubReports that have other
    TppReports nested inside (using SetReportProperty):

    MainReport
    |___SubReportM1
    |___SubReportM2->SetReportProperty(DetailReport)
    |___SubReportM3

    DetailReport
    |___SubReportD1
    |___SubReportD2->MyGroupHere
    |___SubReportD3

    MainReport has its Printing property set and its PrintPosRect updating
    like it should, but the same is not true for DetailReport. Consequently,
    I only have the PrintPosRect for SubReportM2 as a whole, not the
    SubReports inside, which is what I need for MyGroupHere.

    Any ideas how to get past this issue?

    Oh, and as a side note, it doesn't seem like either OutOfSpace or
    PrintPosRect is documented in RBPro 7.04 (not in the help files; not in
    the dev guide). If this has not been corrected in RB 9, then I'd suggest
    that as a future enhancement too.

    Regards,

    Cobus Kruger



    --- posted by geoForum on http://delphi.newswhat.com
  • edited August 2005
    Hi Cobus,

    Are the MainReport and DetailReport two separate TppReport objects on your
    form? I'm a bit unclear about how you are able to access the PrintPosRect
    of SubReportM2 yet not DetailReport. Perhaps a little more information on
    exactly how your application is set would help me understand what is
    happening.

    Thanks for the suggestion about documentation. It will be considered for a
    later release.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2005
    Hi Nico,


    Hmmm... Looking at my wording now it does seem a little vague.

    Two data modules, one containing MainReport, one containing
    DetailReport. Both reports are TppReport components.

    On MainReport, PrintPosRect updates perfectly. If I read it directly
    from DetailReport, MainReport.Engine.PrintPosRect has the correct
    coordinates, although it doesn't update while DetailReport prints. For
    example, using the same structure as before:

    MainReport
    |___SubReportM1
    |___SubReportM2->SetReportProperty(DetailReport)
    |___SubReportM3

    DetailReport
    |___SubReportD1
    |___SubReportD2->MyGroupHere
    |___SubReportD3

    Throughout the printing of DetailReport's three SubReports,
    MainReport.Engine.PrintPosRect has the coordinates where DetailReport
    started, and so the values stay consistent for SubReports D1 to D3.

    So I figured that if I add DetailReport.Engine.PrintPosRect, I should
    get what I need. Unfortunately, DetailReport.Engine.PrintPosRect only
    has a valid Left and Right (zero and some big number), but both Top and
    Bottom are alway zero.

    Also, DetailReport.Engine.Printing remains False. This I don't
    understand, because the event handlers execute OK and the entire
    DetailReport shows up in my preview window, at precesely the spot in
    MainReport where it should. That is probably the real issue - why would
    Printing remain False?

    By the way, this time zone difference is driving me nuts - we only seem
    to both be at the office for about two hours at a time :-(

    Regards,

    Cobus



    --- posted by geoForum on http://delphi.newswhat.com
  • edited September 2005
    Small correction:

    DetailReport.Engine.Printing is actually True
    DetailReport.Printing is False

    DetailReport.Engine.PrintPosRect still stays with top = 0 though.

    Cobus



    --- posted by geoForum on http://delphi.newswhat.com
  • edited September 2005
    Hi Cobus,

    Sorry about the time zones. If possible, please send an example I can run
    on my machine that demonstrates what you are trying to do. I think this
    will help me get to the bottom of your problem easier. Please send the
    example in .zip format to support@digital-metaphors.com

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2005
    > Sorry about the time zones.
    Not your fault :-)

    I've been trying to reproduce in a small example but no luck thus far.
    I'll try again tomorrow (Friday).
  • edited September 2005
    Hi Nico,

    I had no luck reproducing the problem, so I started systematically
    gutting my report into a small enough example to give to you. When I
    finally had it down to a shadow of its former self, the full blown
    version seemed to work. I'll spend some time trying to isolate the
    change I've made that has fixed it, but the heading now breaks perfectly
    when the detail doesn't fit.

    Thanks for your help.

    Regards,

    Cobus



    --- posted by geoForum on http://delphi.newswhat.com
This discussion has been closed.