Access page number from report's OnBeforePrint event

DesDes
edited 1:21AM 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 1:21AM
    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 1:21AM
    That's brilliant.

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


    Des

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.