Band at the bottom of the first page

edited October 2012 in FastReport 4.0
Good evening,

I am trying to make a report and I need a band at the very bottom of the first page, it must behave exactly like the PageFooter but it can't repeat on every page, only on the first one.

I can't set visible false on a normal PageFooter because the band will keep wasting space, so far I am trying to Free and Create the band manually but FR doesn't work very well with that kind of manipulation.

I really have no idea what to do and any help will be appreciated.

Edit1: I am using Double Pass.

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 7:50AM
    a lot will depend upon what comes before the bottom of the page and if the bands are stretching or not.
    the basic is to use an unattached child band.
    write code in the oap event of the preceding band to call engine.showband(bandname);
    it may be as simple as checking the line variable's value and making the call or checking
    the engines.freespace value
  • edited October 2012
    Thank you for the help, pretty much everything comes before the bottom of the page, the report is huge. I am pretty amazed that we have "PrintOnFirstPage" and "PrintOnLastPage" properties but we don't have "PrintOnEveryPage".

    I will try to use the Engine.ShowBand to see what happens

    *Edit: Engine.ShowBand doesn't work, I need something to don't show the PageFooter.

    This is what comes before the pagefooter:
    http://i.imgur.com/yEaxB.jpg

    I need:
    First page:

    Data Data
    Data Data
    Data Data
    Footer

    Next pages
    Data Data
    Data Data
    Data Data
    Data Data
    Data Data

    Data only...

  • edited 7:50AM
    IngoW wrote: »
    *Edit: Engine.ShowBand doesn't work, I need something to don't show the PageFooter.

    Try this solution:

    In PageFooter OnAfterPrint:

    PageFooter1.visible := false;

    In Detailband OnAfterPrint:

    if not PageFooter1.visible then
    PageFooter1.height := 0;

    This will make the pagefooter to print only on first page, without taking space in the rest of the pages.

    Petter


  • edited 7:50AM
    Petter S. wrote: »
    Petter S. wrote: »
    *Edit: Engine.ShowBand doesn't work, I need something to don't show the PageFooter.

    Try this solution:

    In PageFooter OnAfterPrint:

    PageFooter1.visible := false;

    In Detailband OnAfterPrint:

    if not PageFooter1.visible then
    PageFooter1.height := 0;

    This will make the pagefooter to print only on first page, without taking space in the rest of the pages.

    Petter

    Thank you for the hint, it didn't work though. I added a Visible := False OnAfterPrint but FR didn't respect it, the PageFooter was still visible.
    I messed a lot with visible, height, free and create... FR doesn't respect that kind of manipulation, specially when Double Pass is on.

    I am still trying to find a way to make it work, so far I am 4 days on this report and I feel that everytime I am almost finishing there is something that FR can't do and I must remake the whole thing with a different approach.
  • edited 7:50AM
    Sorry, I forgot to test the solution with doublepass. Try this:

    In PageFooter OnAfterPrint:

    if Engine.Finalpass then
    PageFooter1.visible := false;

    In Detailband OnAfterPrint:

    if not PageFooter1.visible and Engine.Finalpass then
    PageFooter1.height := 0;

    This works fine in my test-case. I get details+footer in page1, and just details in page 2+.

    My experience is that FR responds well to modifications of visibility an size, but there can be challenges in finding the right events to put your code.

    Petter
  • edited 7:50AM
    Attached you will find a small report where the footer is printed only in page 1.

    Petter
  • edited 7:50AM
    I already tried using Engine.FinalPass before but another issue happens:
    The first pass will consider Footer in every page, so it might happen this bug:

    First Pass

    (Page1)
    Data
    Data
    Data
    Footer

    (Page2)
    Data
    Data
    Data
    Footer

    (Page3)
    Data
    Footer

    Total Pages: 3

    Second Pass

    (Page1)
    Data
    Data
    Data
    Footer

    (Page2)
    Data
    Data
    Data
    Data (Data is printed instead of the footer and 2 pages are enough)

    Total Pages: 2

    Since I must show how many pages the report has in every sheet (1/3, 2/3, 3/3) I will have issues with page counting, therefore this approach isn't viable [img]style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> I will check the .fr3 you uploaded. Thank you for the help, Ingo Wagner.[/img]
  • edited 7:50AM
    Ok. You need the first pass to be equal to second pass, so that the page count will be correct.

    Here is another approach: Store the height of your footer in a variable initially, and then set the properties of the footer in a oap-event of the detailband, depending on the page number.:
    var      
      FooterHeight: Double;  
      
    procedure MasterData1OnAfterPrint(Sender: TfrxComponent);
    begin
      if <Page> = 1 then
      begin
        PageFooter1.visible := true;  
        PageFooter1.height := FooterHeight;
      end
      else
      begin
        PageFooter1.visible := false;
        PageFooter1.height := 0;
      end;               
    end;
    
    begin
    
      FooterHeight := PageFooter1.height;
        
    end.
    

    Modified report attached.

    Petter
  • edited October 2012
    Petter S. wrote: »
    Ok. You need the first pass to be equal to second pass, so that the page count will be correct.

    Here is another approach: Store the height of your footer in a variable initially, and then set the properties of the footer in a oap-event of the detailband, depending on the page number.:
    var      
      FooterHeight: Double;  
      
    procedure MasterData1OnAfterPrint(Sender: TfrxComponent);
    begin
      if <Page> = 1 then
      begin
        PageFooter1.visible := true;  
        PageFooter1.height := FooterHeight;
      end
      else
      begin
        PageFooter1.visible := false;
        PageFooter1.height := 0;
      end;               
    end;
    
    begin
    
      FooterHeight := PageFooter1.height;
        
    end.
    

    Modified report attached.

    Petter


    FooterPage isn't accepting Height changes.

    I found a way though...
    I deleted the PageFooter and added a ReportSummary.

    ReportSummary1OnBeforePrint I made it always print at the bottom of the page.

    OnBeforePrint on MasterData1 I made a condition
    if Engine.FreeSpace < ReportSummary1.Height + fr1cm then
    begin
      Engine.ShowBand(ReportSummary1);
      Engine.NewPage;
    end;
    

    OnAfterPrint of ReportSummary1 I did this
    ReportSummary.Height := 0;
    if Engine.FinalPass then
      ReportSummary.Visible := False;
    
    So far it's working like a charm.

    I will make more tests tomorrow but I am pretty sure it's working pretty well.
  • edited 7:50AM
    IngoW wrote: »
    FooterPage isn't accepting Height changes.

    The previously attached report HiddenFooter1.fr3 accepts height changing from script on my system. Might there be that there are differences between FR-versions? My version is 4.11.4.

    Petter
  • edited 7:50AM
    Petter S. wrote: »
    Petter S. wrote: »
    FooterPage isn't accepting Height changes.

    The previously attached report HiddenFooter1.fr3 accepts height changing from script on my system. Might there be that there are differences between FR-versions? My version is 4.11.4.

    Petter


    We are using 4.9 here. It might be it...

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.