Master Detail Keep Together

Hi,

I'm using Fast Reports VCL 5 and am having a hard time keeping my master and detail bands from splitting across two pages. I've tried a number of different methods such as keep detail together, keep together, etc. but nothing seems to be working. Here is my current band layout:

Page Header 1 (empty)
Group Header 1
Master Data 1
Group Header 2
Detail Data 1
Group Footer 2
Group Footer 1
Page Footer

The actual output of data is working exactly like I need it, I just haven't found a way to keep my master detail from splitting across the page. I'm getting the contents of Master Data 1 on the last line of a page and the remaining bands on the next page. I want the master data band to stay with the rest of the bands.

Any help would be greatly appreciated!

Thanks,

Taylor

Comments

  • PolomintPolomint Australia
    edited 10:39AM
    Not sure what you have tried, but...

    Have you tried using Report.Engine to test if space remains in your equivalent of GroupHeaderBeforePrint?

    I successfully break my master-detail reports as in the following:
    procedure TGLOWReportIdleAccounts.GroupHeaderBeforePrint (Sender: TfrxReportComponent; var PrintBand: Boolean);
    begin
      BandColour.Restart;
      PrintBand := False;
      (* 
         report specific code here to determine if the GroupHeader band and children should be printed 
      *)
      if PrintBand then
        with Report.Engine do begin // <--- note that Report: TfrxReport;
          if FreeSpace <= GroupHeader.Height + DetailBand.Height then  // <--- this line checks to see if there is still space for the Detail
            NewPage;
        end;
    end; {TGLOWReportIdleAccounts.GroupHeaderBeforePrint}
    
    I have several more complicated reports with multiple layers, in which the "if FreeSpace" line just has more "Height" variables added.

    Cheers, Paul

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.