FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour FastReport LoadImageFromHbVar
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
FastReport LoadImageFromHbVar
Posted: Wed Apr 16, 2014 03:04 PM

Hello,

I am trying to print a image in FR, I want to use LoadImageFromHbVar because I need to generate the image only for the report.

I found a topic about it but for me don't work, some body work with this function?

regards

Marcelo

Posts: 474
Joined: Sun Oct 30, 2005 06:37 AM
Re: FastReport LoadImageFromHbVar
Posted: Thu Apr 17, 2014 04:24 AM
  1. Static
    Add picture object-- close the "picture" windows--left tribution table--file link--- d:\myfold\aaaa.jpg --OK
  2. Dynamic
    2.1). Add picture object-- close the "picture" windows--left tribution table--event Picture1OnBeforePrint
    2.2). code:
    procedure Picture1OnBeforePrint(Sender: TfrxComponent);
    begin
    callhbfunc('fr3img',['.\sub\'+vartostr(<masterdata."imgid">)+'.jpg']) ; // this selft defined prg function to load current row jpg into private 'myvar'
    LoadImageFromHbVar(Picture1,'fr3img');
    end;

begin

end.
// " picture1" is the name of the picture object, can be edited in the left tribution table .
2.3) prg :
private fr3img
FrPrn := frReportManager():new()

2.4 prg:
FUNCTION fr3img(file1)
fr3img:=nil
fr3img:=memoread(file1)
sysrefresh()
return

http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: FastReport LoadImageFromHbVar
Posted: Thu Apr 17, 2014 03:01 PM

ShumingWang,

thanks very much for your response, I found my problem, we MUST to define the variable like a PRIVATE (don't work with other definition), then we need to relax the xHarbour compile switch
because with private variables I get error message "Ambiguous reference" I don't know why?

regards

Marcelo

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: FastReport LoadImageFromHbVar
Posted: Thu Apr 17, 2014 03:30 PM
Marcelo,

Marcelo Via Giglio wrote:ShumingWang,

thanks very much for your response, I found my problem, we MUST to define the variable like a PRIVATE (don't work with other definition), then we need to relax the xHarbour compile switch
because with private variables I get error message "Ambiguous reference" I don't know why?

regards

Marcelo


Use

Code (fw): Select all Collapse
M -> myvar


EMG
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: FastReport LoadImageFromHbVar
Posted: Thu Apr 17, 2014 07:50 PM

Thanks Enrico,

I didn't use PRIVATE variables since clipper.

Other question how can I get the same result than MEMOREAD("bmpfile.bmp") using a bmp object. I have a bmp in memory (generated), how can I convert this BMP to use like MEMOREAD whiout pass it to a disk file.

Regards

Marcelo

Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: FastReport LoadImageFromHbVar
Posted: Fri Apr 18, 2014 02:41 AM

found! DibToStr( hDib )

thanks

Marcelo

Posts: 195
Joined: Sun Jul 22, 2012 07:01 PM
Re: FastReport LoadImageFromHbVar
Posted: Tue Jun 10, 2014 08:52 PM

Marcelo,

Can you share the details regarding how you were able to load the bitmap from memory?

Regards,

Robb

Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: FastReport LoadImageFromHbVar
Posted: Tue Jun 10, 2014 09:32 PM
Robb,

the question is not clear for me but I can public some code

Code (fw): Select all Collapse
   oBmp:= TBitmap():Define() 
   oBmp:hBitMap := BuildCode( CODEBAR_QR, "QR", HB_ZEBRA_FLAG_QR_LEVEL_MASK ) //create bitmap in memory
   hDib := DibFromBitmap( oBmp:hBitMap ) // read dib from bitmap
   DibToStr( hDib ) // convert dib to string           
   GloBalFree( hDib )


regards

Marcelo
Posts: 195
Joined: Sun Jul 22, 2012 07:01 PM
Re: FastReport LoadImageFromHbVar
Posted: Tue Jun 10, 2014 10:11 PM

Thank you, that was quick.

I finally found what I need, or at least what I can use. There is a TBitmap() method named LoadFromString() that does the trick. Finally found it in the source code, it doesn't appear to be documented otherwise.

Thank you so much for the reply.

Robb

Continue the discussion