I have masterdata band in my fastreport. I can write code on "masterdata After print" in pascal script, but i want to know is there a way to write this code in main delphi form.
Pascal script:
procedure MasterDataOnAfterPrint(Sender : TfrxComponent)
begin
Sup_Page.Text := 'Cont on Page ' + IntToStr(<Page> + 1);
end;
You have different options to interfer your report while printing.
You might use the events
AfterPrint
and/orBeforePrint
which will provide the component as parameter for every time it will be printed.If you want to access another component then the one which is provided in the events, you can use FindComponent delivering the component for the page actually printed.
To access functions within the report you can call
Calc
with the functions name as parameter .An other option depending on your demands is to use the
GetValue
event which, will be called every time a variable is evaluated, providing the name of the variable and a var parameter for the value, which will enable you to return the value you like.A short example might be useful: