Page Number from code in OnBeforePrint
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;
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
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.