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

Changing the height of a GroupHeaderBand depending on the visibility of a component

Hello Nico
I want to reduce the band height for all pages except the first. I don't want to print the diagram multiple times. However, other components in the band should still print. I can't understand why the band doesn't automatically reduce its size if I set PrintHeight := phDynamic.

I am trying the following code. I'm trying the following code. The result is fine, but I see a warning message "Invalid value: Zero height band cannot contain components."
What is my mistake?

procedure GroupHeaderBand1BeforePrint;
begin
if not Group1.FirstPage then begin
Chart.Visible := False;
GroupHeaderBand1.Height := GroupHeaderBand1.Height - Chart.Height;
end;
end;

Comments

  • Hi Serg,

    Try using the BeforeGenerate event of the GroupHeader. In my testing, the BeforePrint fired too late to successfully hide any components or dynamically resize the band.

    When using the BeforeGenerate, I was able to hide a TeeChart and did not need to resize the band manually (my GroupHeader contained a Chart and Label only).
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
Sign In or Register to comment.