Recent

Author Topic: Display Blob Data (Images) into a Report.  (Read 6526 times)

fredycc

  • Sr. Member
  • ****
  • Posts: 265
Display Blob Data (Images) into a Report.
« on: December 23, 2009, 12:44:28 am »
Hi! :), Is there a way to display a blob data like images(jpg or bmp) into a report, maybe LazReport, fortresReport?
How Can I implement this?. :(

Paul Ishenin

  • Sr. Member
  • ****
  • Posts: 274
Re: Display Blob Data (Images) into a Report.
« Reply #1 on: December 23, 2009, 03:53:04 am »
No idea about reports but this is easy to implement if you know image format. Blob data is usually available through the TBobField wich has SaveToStream method. So if you have an Image: TImage you can use the next code:
Code: Delphi  [Select]
  1. var
  2.   Stream: TMemoryStream;
  3. begin
  4.   Stream := TMemoryStream.Create;
  5.   try
  6.      TBloblField(Ds.Fields[..]).SaveToStream(Stream);
  7.      Stream.Position := 0;
  8.      Image.Picture.Bitmap.LoadFromStream(Stream);
  9.   finally
  10.      Stream.Free;
  11.   end;
  12. end;
  13.  
« Last Edit: December 23, 2009, 04:04:48 am by Paul Ishenin »

fredycc

  • Sr. Member
  • ****
  • Posts: 265
Re: Display Blob Data (Images) into a Report.
« Reply #2 on: December 23, 2009, 04:16:36 pm »
Thanks Paul, this code work fine, is similar in Delphi to display a blob in a Form, I will check to implement similar code in a event of a Report, maybe works I was checking a example of Fortresr with blobs but the examples are for Delphi.

thanks again. :)