Recent

Author Topic: LazReport image into report  (Read 5533 times)

makgab

  • Jr. Member
  • **
  • Posts: 55
LazReport image into report
« on: March 16, 2016, 11:04:31 am »
Hi!
Can I insert images into the report?
For example, the application runs a query and it has result records.
I would like insert an image for each record (and print them).

The one field of result is the path of image:
For example the result fields:
ID,NAME,DESCRIPTION,PATH_OF_IMAGE

How can I solve this with LazReport?

balazsszekely

  • Guest
Re: LazReport image into report
« Reply #1 on: March 16, 2016, 11:35:43 am »
I assume "PATH_OF_IMAGE" is a physical path on your computer and dataset of the report is already configured.
Place an image to a detailband. Give it a name. Close the report designer, create then OnEnterRect event(frReport):
Code: Pascal  [Select][+][-]
  1. procedure TForm1.frReport1EnterRect(Memo: TStringList; View: TfrView);
  2. var
  3.   FileName: String;
  4. begin
  5.   if (View is TfrPictureView) then
  6.   begin
  7.     if (View as TfrPictureView).Name = 'imMyImage' then //change imMyImage
  8.     begin
  9.       FileName := SQLQuery1.FieldByName('PATH_OF_IMAGE').AsString); //change SQLQuery1
  10.       (View as TfrPictureView).Visible := FileExists(FileName);
  11.       if (View as TfrPictureView).Visible then
  12.         (View as TfrPictureView).Picture.LoadFromFile(FileName);
  13.     end;
  14.   end;
  15. end;
  16.  

makgab

  • Jr. Member
  • **
  • Posts: 55
Re: LazReport image into report
« Reply #2 on: March 16, 2016, 11:42:10 am »
thanks! I will try it!

 

TinyPortal © 2005-2018