How to display / print an image on a column ?

How to display / print an image on a column ?

Postby HunterEC » Wed May 26, 2010 2:22 pm

Hi guys:

How can I have a report that print a JPG in one of its columns along other text data ? Thank you for your help.
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: How to display / print an image on a column ?

Postby nageswaragunupudi » Thu May 27, 2010 12:08 pm

This is an example program.
Run this program in the fwh\samples folder.
Code: Select all  Expand view
#include "FiveWin.Ch"
#include "ord.ch"
#include "xbrowse.ch"
#include "report.ch"

REQUEST DBFCDX

//------------------------------------------------------------------//

function Main()

   local oPrn, oRep, oFont, oBold

   USE WWONDERS NEW ALIAS WW SHARED VIA 'DBFCDX'
   SET FILTER TO RECNO() > 7
   GO TOP

   DEFINE FONT oFont NAME 'TAHOMA' SIZE 0,-9
   DEFINE FONT oBold NAME 'VERDANA' SIZE 0,-10 BOLD

   PRINT oPrn NAME 'Inline images in FW Report' PREVIEW MODAL

   REPORT oRep TITLE 'FWin Report inline Images' ;
      FONT oFont, oBold PREVIEW TO DEVICE oPrn

   COLUMN TITLE 'Name' DATA WW->NAME SIZE 30

//   COLUMN TITLE 'Details' DATA WW->Details MEMO

   COLUMN TITLE 'Image' DATA WW->Details MEMO SIZE 35 ;
      FONT 2 CENTER ;
      IMAGE IMGDATA WW->Image HEIGHT 20 ALPHALEVEL 128

   ENDREPORT

   ACTIVATE REPORT oRep

   ENDPRINT
   RELEASE FONT oFont
   RELEASE FONT oBold

   CLOSE WW

return ( 0 )

//------------------------------------------------------------------//
 


Image

Uploaded with ImageShack.us
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10628
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: How to display / print an image on a column ?

Postby HunterEC » Thu May 27, 2010 10:59 pm

Thank you very much for your help ! My samples folder does not have the wwonders.dbf file, can you email it to me ? Also how can I display a JPG (in a REPORT column) that is not in a DBF file but in a file by itself (filename.jpg). Thanks in advance.

Gustavo
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: How to display / print an image on a column ?

Postby nageswaragunupudi » Fri May 28, 2010 3:47 am

This example uses array and does not need wwonders.dbf. This also demonstrates use of imagefile names. IMGDATA clause can have either image filename or image buffer.
Code: Select all  Expand view
#include "FiveWin.Ch"
#include "xbrowse.ch"
#include "report.ch"

#define IMGPATH "c:\fwh\bitmaps\AlphaBmp\"

//------------------------------------------------------------------//

function Main()

   local oPrn, oRep, oFont, oBold, n
   local aDir  := DIRECTORY( IMGPATH + "
*.bmp" )

   n  := 1

   DEFINE FONT oFont NAME 'TAHOMA' SIZE 0,-9
   DEFINE FONT oBold NAME 'VERDANA' SIZE 0,-10 BOLD

   PRINT oPrn NAME 'Inline images in FW Report' PREVIEW MODAL

   REPORT oRep TITLE 'FWin Report inline Images' ;
      FONT oFont, oBold PREVIEW TO DEVICE oPrn

   COLUMN TITLE 'Name' DATA aDir[ n, 1 ] SIZE 30

   COLUMN TITLE 'Image' ;
      DATA IMGPATH + CRLF + aDir[ n, 1] + CRLF + ;
           DToC( aDir[ n, 3 ] ) + CRLF + aDir[ n, 4 ] ;
      SIZE 35 MEMO FONT 2 CENTER ;
      IMAGE IMGDATA IMGPATH + aDir[ n, 1 ] ;
           HEIGHT 5 ALPHALEVEL 180

   ENDREPORT

   oRep:bSkip  := { || n++ }

   ACTIVATE REPORT oRep WHILE n <= Len( aDir )

   ENDPRINT
   RELEASE FONT oFont
   RELEASE FONT oBold

return ( 0 )

//------------------------------------------------------------------//
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10628
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: How to display / print an image on a column ?

Postby HunterEC » Tue Jun 01, 2010 9:55 am

G. N. Rao.:

Thank you very much for your great explanation and example. I'll give it a try.

Gustavo
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 58 guests