Page Number from code in OnBeforePrint

JonJon
edited 2:07AM in FastReport 4.0
I need to set report variables dependent on the page number, but the following code does not return the page number. What am I missing?

procedure TfrmMain.frxReportBeforePrint(Sender: TfrxReportComponent);
var
Page : TfrxReportPage;
begin
if frxReport.Variables = 1 then begin
Page := frxReport.Pages[1] as TfrxReportPage;
if FMarginTitle <> 0 then
Page.TopMargin := FBigMargin;
end
else if frxReport.Variables > 1 then begin
Page := frxReport.Pages[1] as TfrxReportPage;
if FMarginTop <> 0 then
Page.TopMargin := FStdTopMargin;
end;
end;

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 2:07AM
    it appears you are trying to set the margin from delphi code, but you
    cant set it from this point, as the engine is already processing the page
    you can only set it's design just after loading the report and before processing.
  • JonJon
    edited 2:07AM
    gordk wrote: »
    it appears you are trying to set the margin from delphi code, but you
    cant set it from this point, as the engine is already processing the page
    you can only set it's design just after loading the report and before processing.


    Thank you for the advice. I will set frxReportTitle Height to give extra margin on first page.

Leave a Comment