I would like to show an image in FastReport.
Here is Delphi code :
img_sick.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) +
'Pictures/' + Qry_Search.FieldByName('code_personel').AsString + '.jpg');
Any ideas would be appreciated.
Put a picture object onto your report form. Let's assume it will be called Picture1
.
In your Delphi code, in the method where you want to load the picture, add a line like this:
TfrxPictureView(YourReportObject.FindObject('Picture1')).Picture.LoadFromFile(…)
The Picture
property is a TPicture
and so LoadFromFile
is the same method you are using in your example. So just supply a corresponding file name as an argument.
That is supposed to be done prior to running the report. If you want to load pictures in the process of running the report, you should perhaps try doing something similar in the report script. Maybe I would define an OnBeforePrint
handler for the Picture1
object, like this:
procedure Picture1OnBeforePrint(Sender: TfrxComponent);
begin
TfrxPictureView(Sender).Picture.LoadFromFile(…); // use a reference
// to the "code_personel" column in the file name expression
// as appropriate in the context of the report script,
// like <Qry_Search."code_personel">, perhaps
end;