If you have already built a chart in your Delphi code and want to print it in the report you need to use a “Picture” object from the FastReport object toolbar. Place the object in the required place on the report design page and create the following “TfrxReport.OnBeforePrint” event handler in the Delphi application:
procedure TForm1.frxReport1BeforePrint(Sender: TfrxReportComponent);
begin
if Sender.Name = 'Picture1' then
TfrxPictureView(Sender).Picture.Assign(
Chart1.TeeCreateMetafile(False,
Rect(0, 0, Round(Sender.Width), Round(Sender.Height))));
end;
where Picture1 is the “Picture” object's name and Chart1 is your Delphi chart.
Note: When you have code assigned to the event handlers of the TfrxReport component within a Delphi application you must preview the report by running the compiled Delphi application. You cannot preview the report from within the FastReport report designer.
|