Header keep at least 1 row

edited 6:11AM in FastReport VCL
How do I make a header keep at least 1 row? I want it to not show the header if the first line will be on the next page. Otherwise I end up with the possibility of a header on the bottom of the page with no rows. I do not want to use Keep Together because that will put the whole group onto the next page.

Comments

  • LurkingKiwiLurkingKiwi Wellington, New Zealand
    edited 6:11AM
    I use the following code, obtained from FR support or somebody in the forum:

    procedure GroupHeader2OnBeforePrint(Sender: TfrxComponent);
    begin
    if (<force_break> <> 0) or (engine.freespace < (GroupHeader2.Height + MasterData1.Height * 2 + 1)) then
    engine.newpage;
    end;

    where
    force_break is a column in the dataset used to insert manual pagebreaks
    GroupHeader2 has the column headings and the BeforePrint handler
    MasterData1 has the fields

    MasterData1.Height is multiplied by 2 to prevent widows (a single data line at the bottom of the page under the header); the 1 is added to allow for mathematical effects.

Leave a Comment