General information
Title:
How to Print images From SQL server y VFP9
Environment versions
Network:
Windows 2003 Server
Using recorset:
you need to create a PRG, ep:rptimage.prg inside it copy and paste this code i asuming that you have create a alias. sending a alias like a parameter(table).
PARAMETERS table
LOCAL loRL AS REPORTLISTENER
loRL = NEWOBJECT( 'PreviewListener' )
loRL.InitBLOBImage( '&tabla'+'.img' )
*-- Make sure that the cursor is selected,
*-- and then run the report to preview using
*-- the instance of our Report Listener.
SELECT &tabla
REPORT FORM Report2.frx OBJECT loRL
*CLOSE DATA ALL
RETURN
USE BlobReport.FRX IN 0 ALIAS TheReport EXCLUSIVE
SELECT TheReport
*-- Add the Picture/OLE Bound control record to the report.
APPEND BLANK IN TheReport
GATHER NAME loRL.oBlobImage MEMO
*-- Clean up and then close the report table.
PACK MEMO
USE IN SELECT( 'TheReport' )
*-- There has to be some way of redrawing the
*-- picture in the IMAGE class as the record pointer
*-- in the report's driving cursor changes; it does not occur
*-- automatically. This could be done by a UDF() in the PrintWhen
*-- of the OLE Bound control on the report, or as is illustrated here,
*-- by a Report Listener BEFOREBAND() Event.
DEFINE CLASS PreviewListener AS REPORTLISTENER
oBlobImage = NULL
PicBlobFld = ''
LISTENERTYPE = 1 && Preview Listener
PROCEDURE InitBLOBImage(lpcBlobField AS STRING)
THIS.PicBlobFld = lpcBlobField
THIS.oBlobImage = NEWOBJECT( 'IMAGE' )
THIS.oBlobImage.PICTUREVAL = THIS.PicBlobFld
ENDPROC
PROCEDURE BEFOREBAND( nBandObjCode, nFRXRecNo )
*-- Before the DETAIL band is rendered, ;
*-- just redraw the IMAGE object so that it has
*-- the correct picture from the BLOB field.
IF nBandObjCode = 4 && Detail band
THIS.oBlobImage.PICTUREVAL =;
EVALUATE( THIS.PicBlobFld )
ENDIF
ENDPROC
ENDDEFINE
After this just run from your application:
Do rptimage with 'table'
i asume that you have been create a table(alias) with your recorset.
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only