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

Richtext at end of Group causes extra, blank page

edited July 2002 in General
I am having a problem with RB generating an extra page when a richtext field falls
at the end of a group. Here are the gory details:

I am using RB 6.03 and Delphi 6 Pro (Update 2) to create a printable catalog
from a database I use for a website.

My report is grabbing HTML-based memo fields from a MySql table data via
DBExpress components.

It is then converting the HTML format tags to richtext equivalents and
displaying them on the report in a TppRichText field.
So far, everything works as expected.

These richtext fields are then grouped according to a separate category field.
I've set up the report so that each group is started on a new page via the
"On Group Change Start New Page" checkbox in the Groups menu.

This report works well about 90% of the time.

Here's the problem.

On the odd occasions when the last richtext field of a group happens to
end on the last printable line of a page, the report generates an additional,
empty page after the field ends. Just the standard headers and footers print on this
extra page, but no field data.

I thought that perhaps some extraneous character information from the richtext memo (or some
carriage returns) might be responsible, but I've checked the contents of the field and it is
just standard rich text.

After some further debugging, I discovered that RB is executing an additional
"ppGroupFooterBand1BeforePrint" event when these richtext fields print on the bottom
of the last page of a group. This seems to trigger the extra blank page, I believe.

So, in summary, it appears that RB is firing two "ppGroupFooterBand1BeforePrint"
events and adding a blank page under the following conditions:

1. A richtext field is on the last page of a group

2. The richtext field ends on the last printable line of that page.

3. The group is set to start a new page when the group changes.


Here are some of the unsuccessful things I've tried to work around the problem:

a. Tried setting the richtext field to "keep together" to see if that would somehow cause
the richtext field to print on the new page. It didn't work.

b. Tried putting the richtext field in a region. No change.


Do you have any insight on what might be causing this behavior and how I
might fix it or work around it?

I've spent countless hours trying to debug this and have increased my gray hair count unnecessarily.
I hope I've explained this thoroughly enough for you to understand. Please
reply if you need more info.

I am trying construct a report using DBDEMOS that mimics this behavior.

Bill

Comments

  • edited July 2002
    For one reason or another RB thinks that the last richtext requires more
    space when it reaches the bottom of the page. First check the BottomOffset
    of the component is 0 to make sure that no bottom offset is being generated.
    Then you can place a line directly below the rich text and see if that line
    is being rendered directly after the last line of text or at an offset (ie.
    on the next page).

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

  • edited July 2002
    I checked the BottomOffset -- it?s 0.

    I placed a line directly below the richtext. It renders on the
    following page.

    Any suggestions on how I can get the richtext to not cause an
    additional, blank page?

    It ruins my report to have these spurious blank
    pages appear occasionally. I am about to throw in the towel
    and simply claim that this feature can?t be made to work easily
    in RB.

    Thanks.




  • edited July 2002
    OK. I think I found a hack that will enable me to somewhat work around
    this problem, but would still appreciate any insight you might have that
    would give me a more graceful solution.

    What I?ve done is put the Richtext field and a line with a pen style of ?psclear?
    into a single region at the bottom of the report.

    I?ve set the region to ?keep together? so that if it is ever in danger
    of generating the blank page, it will at least move the whole richtext
    field to the next page.

    The clear line acts as a flag for the end of the page, activating the
    keep together property if the richtext is about to print at the bottom of
    a page.

    Of course, I occasionally end up with excessive blank space at the bottom
    of some pages when the richtext field moves to the following page. Fortunately,
    the contents of the richtext fields are minimal so this doesn?t detract too much
    from the report.

    Regards,

    Bill

  • edited July 2002
    Well. . .I?ve discovered yet another piece of my puzzle.

    The problem only seems to occur when the richtext is set to fs18 (9 points).

    When set to 10 points, it paginates correctly. Maybe something is just
    corrupted in my report? I?ll see if I can?t reproduce the error in another
    report.

    Again -- if you have any debugging tips, would appreciate anything
    you could throw my way. Thanks.

    Bill


  • edited July 2002
    Can you send a sample report that paginates so that we can see this problem?
    Email the attachment to support@digital-metaphors.com

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

This discussion has been closed.