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

Detailband background color

edited May 2015 in General
Hi,

I am using the Background1 and Background2 color settings for
detailbands to have alternating background color. This works fine for
reports without any groups.
I have some reports with groups that does not show the header (only the
footer is shown to get a sum for the group) and here the Backgroup1
setting is used for every first detail band of each group.

Lets say that Background1 color is RED and Background2 color is BLUE,
then this is what is happening:

No Groups:
RED
BLUE
RED
BLUE

With Groups:
RED
RED - New group with one record
RED - New group with one record
RED - New group with two records
BLUE

I want this to be:
RED
BLUE - New group with one record
RED - New group with one record
BLUE - New group with two records
RED

Are there a way, not to reset the odd/even count when printing the
report. I found that when I clear the breakname, then the Odd/even is
not reset, and then the background1 and background2 color is fine. The
problem here is that then the group footer does not show the correct
count/sum.

What to do to get alternating background color?

RB version: 15:02
Delphi: XE5

Best regards

Kent Johansen

Comments

  • edited May 2015
    Hi Kent,

    The band background feature toggles the background color based on the
    DetailBand.Count property which is reset each time a group breaks.

    If you would like to customize this behavior so that groups are not
    taken into account, you will need to manually keep track of the number
    of DetailBands printed and perhaps toggle the visibility of two shapes.

    procedure TForm1.ppDetailBand1BeforePrint(Sender: TObject);
    begin
    Inc(FDetailCount);
    ppShape1.Visible := (FDetailCount mod 2 = 0);
    ppShape2.Visible := (FDetailCount mod 2 = 1);

    end;

    Or you can statically add DrawShape commands on the page to give a
    greenbar effect like in the following example.

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.