Page Number from code in OnBeforePrint

JonJon
edited 12:03PM 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 12:03PM
    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 12:03PM
    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

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.