如何在 VCL 快速报告中更改页面方向



我正在使用Embarcadero版本的FastReport,我需要在运行时更改某些子报表页面的方向(主要是因为图片(。根据程序员手册,这应该很容易,但我无法弄清楚如何或何时可能。我试图更改这两个事件中的所有页面,但没有成功。我不确定它是否在此版本中有效,或者我错过了一些东西。

TfrxReport.OnBeforePaint

procedure TForm1.frxReportBeforePrint(Sender: TfrxReportComponent);
begin
  if Assigned(Sender.Page) then
    TfrxReportPage(Sender.Page).Orientation := TPrinterOrientation.poLandscape;
end;

TfrxReport.OnPrintPage

procedure TForm1.frxReportPrintPage(Page: TfrxReportPage; CopyNo: Integer);
begin
  TfrxReportPage(Page).Orientation := TPrinterOrientation.poLandscape;
end;

使用

TfrxReportPage(frxReport1.FindObject('Page1')).Orientation := TPrinterOrientation.poLandscape;
frxReport1.ShowReport;

最新更新