Access page number from report's OnBeforePrint event

DesDes
edited 9:03PM in FastReport 4.0
Hi, I'm using the report's OnBeforePrint event (external code, not scripts) to examine events for all components.

Using the passed component I appear to be able to access the report, but I can't find out how to access the current page number. The report's system variables appear to be blank.

Can anyone help?

Comments

  • PolomintPolomint Australia
    edited 9:03PM
    G'day Des,

    OK we don't have FRv4 installed, only FRv5 and FRv6, so this might not work for you.
    PageNo := <<Report>>.PreviewPages.CurPage + 1;
    

    where <<Report>> is whatever your TfrxReport component is called.

    Note the "+ 1". We've found that CurPage is zero-based. This line of code is included in the debug code of the "BeforePrint" events of our reports (but only in "FinalPass").

    Hope it helps you.

    Cheers, Paul
  • DesDes
    edited 9:03PM
    That's brilliant.

    Many thanks Paul, I can stop tearing my hair out now.


    Des

Leave a Comment