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

Suppress printing of header and footer elements

edited August 2008 in General
Hi,

I would like to suppress printing of certain elements in a report header
after the first page has printed. I have tried using report.absolutepageno >
1 and setting the element visible properties to false in a beforegenerate
method. This works fine when the report is first displayed in preview but if
the user navigates forward and then back the element remains hidden.

Also I need to suppress printing of certain elements in a group footer
depending on the data printed in the detail band. Again this works fine when
first viewed but does not following report navigation in preview.

What should I do?

Thanks, Ray

Comments

  • edited August 2008
    Hi Ray,

    In my testing with the following code in the HeaderBand.BeforeGenerate
    event, the test label was properly hidden for the first page regardless how
    I navigated the entire report. Try placing a break point in the event in
    your application and see if you can find out what is happening when you
    navigate backward to cause this issue.

    ppLabel1.Visible := ppReport1.AbsolutePageNo > 1;

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2008
    Thanks Nico,

    The following code worked:

    Label1.visible := Report.AbsolutePageNo = 1;
    Variable1.visible := Report.AbsolutePageNo = 1;

    However, the code I was using caused the elements to be hidden at all times
    after the first pass::

    if Report.AbsolutePageNo > 1 then begin
    Label1.visible := false;
    Variable1.visible := false;
    end;

    Regards, Ray

  • edited August 2008
    Hi Ray,

    The reason for this was that you were never setting the label and variable
    back to Visible := True. Something like the following would fix the
    issue...

    if Report.AbsolutePageNo > 1 then begin
    Label1.visible := false;
    Variable1.visible := false;
    end
    else
    begin
    Label1.Visible := True;
    Variable1.Visible := True;
    end;


    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.