Home General

PrintPosition of ppHeaderBand

edited November 2010 in General
Hi All,

I have the following report (using RB 7.0 and Delphi 7.0.)

ppTitleBand
Height = 100
PrintHeight = phStatic

ppHeaderBand
Height = 10
PrintHeight = phStatic

ppDetailBand
Height = 6
PrintHeight = phDynamic

ppSummaryBand
Height = 60
PrintHeight = phStatic
PrintPostion = 210

The ppTitleBand is only visible at the first page and ppSummaryBand on the
last one.
On the first page the ppHeaderBand is shown just below the ppTitleBand and
ppDetailBand just below the ppHeaderBand.
On the second page the ppHeaderBand is shown on top of the page followed by
the ppDetailBand.

I was wondering if it would be possible to show the ppHeaderBand followed by
the ppDetailBand not on top of the second page but some 5 cm from the top.

I tried the following code in the ppHeaderBandBeforeGenerate section:
If Report.PageNo = 1
Then ppHeaderBand.PrintPosition := 0
Else ppHeaderBand.PrintPosition := 50;

but it doesn't work.

The second page looks good but on the first page the ppHeaderBand and
ppDetailBand are not visible.
Any idea how to solve this?

Thanks in advance.

Peter Herijgers

Comments

  • edited November 2010
    Hi Peter,

    The PrintPosition is the actual position of the band on the page. Setting
    the HeaderBand's PrintPosition to 0 on the first page will overlap the
    TitleBand. Perhaps try something like the following to avoid that
    situation...

    if Report.PageNo > 1 then
    HeaderBand.PrintPosition := 50;

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2010
    Unfortunately this is not working.
    The PassSetting is psTwoPass.

    ppHeaderBandBeforeGenerate section:

    If Report.PageNo > 1 Then ppHeaderBand.PrintPosition := 50;
    ShowMessage(IntToStr(Report.PageNo) + ' - ' +
    FloatToStr(ppHeaderBand.PrintPosition));

    Showing the Report gives me:

    ShowMessage -> 1 - 0
    First page shown on screen is ok
    ShowMessage -> 2 -50
    First page shown on screen is wrong (no data)

    Going to second page
    ShowMessage -> 2 -50
    Second page shown on screen is ok

    Going back to first page
    No message
    First page shown on screen is wrong (no data)

    If the HeaderBand's PrintPosition is set to 0 the HeaderBand on the first
    page is shown just below the TitleBand.
    On the second page the HeaderBand is shown at the top of the page.

    The Report.PageNo > 1 is not working because of the PassSetting is
    psTwoPass.

    Kind regards,

    Peter


  • edited November 2010
    Hi Peter,

    You are correct, my original solution would not work when paging backward
    through the report. I believe the issue is the event you are using rather
    than the fact that you are using a two pass report.

    Try using an earlier event such as the Report.OnStartPage. This way the
    engine will have time to resolve a print position of 0 for the first page.
    In my testing with a one and two pass report, the following code functioned
    correctly.

    procedure TForm1.ppReport1StartPage(Sender: TObject);
    begin
    if ppReport1.AbsolutePageNo > 1 then
    ppReport1.HeaderBand.PrintPosition := 50
    else
    ppReport1.HeaderBand.PrintPosition := 0;
    end;



    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
    "Peter" wrote in message news:4cceebb4@mail....

    Unfortunately this is not working.
    The PassSetting is psTwoPass.

    ppHeaderBandBeforeGenerate section:

    If Report.PageNo > 1 Then ppHeaderBand.PrintPosition := 50;
    ShowMessage(IntToStr(Report.PageNo) + ' - ' +
    FloatToStr(ppHeaderBand.PrintPosition));

    Showing the Report gives me:

    ShowMessage -> 1 - 0
    First page shown on screen is ok
    ShowMessage -> 2 -50
    First page shown on screen is wrong (no data)

    Going to second page
    ShowMessage -> 2 -50
    Second page shown on screen is ok

    Going back to first page
    No message
    First page shown on screen is wrong (no data)

    If the HeaderBand's PrintPosition is set to 0 the HeaderBand on the first
    page is shown just below the TitleBand.
    On the second page the HeaderBand is shown at the top of the page.

    The Report.PageNo > 1 is not working because of the PassSetting is
    psTwoPass.

    Kind regards,

    Peter


    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2010
    Thanks Nico.
    Works great.

    Peter.


This discussion has been closed.