PrintOnFirstPage for One Page Reports

TECH TIP: Using PrintOnFirstPage for One Page Reports

Question: I have a Footer that I do not want to print on the first page of my report, unless the report is only one page.”

Solution:

Both the Headerband and FooterBand have boolean properties called PrintOnFirstPage and PrintOnLastPage that can be used to control whether the respective bands print.

Example:

  1. Set default behavior prior to calling Report.Print
    ppFooterband1.PrintOnFirstPage := False;
    ppReport1.PassSetting := psTwoPass;
    ppReport1.Print;

     

  2. Add the following code the Report.OnEndFirstPass event:
     procedure TForm1.ppReport1EndFirstPass(Sender: TObject);
    begin
    
      {override default behavior for a single page report}
      if ppReport1.AbsolutePageCount = 1 then
        ppFooterband1.PrintOnFirstPage := True;
    
    end;