delphiquickreports

Delphi Quick Reports - Total Pages


I'm using QuickReports within my application and would like to have "Page x of x" within the footer. What's the best way to do this?


Solution

  • First prepare the document, so the system itselfs know how many pages will produce. There's a system variable you can use (no QR at hand to tell you the exact name).

    For example:

    procedure TForm1.Click(Sender: TObject);
    begin
      //this actually run the report in memory to 
      //calculate things like total page count
      Report1.Prepare;  
      Report1.Print;  //or PreviewModal;
    end;