Tony -
>> How to print blob field that contain image?
Here's how Lisa demonstrated printing a BLOB field in a report using the new reporting system in VFP9 in her DevCon sessions:
First, some setup:
SET REPORTBEHAVIOR 90
CREATE CURSOR test ( picname C(25), picdata W)
APPEND BLANK
REPLACE picname WITH "One", picdata WITH FILETOSTR(GETFILE())
APPEND BLANK
REPLACE picname WITH "Two", picdata WITH FILETOSTR(GETFILE())
APPEND BLANK
REPLACE picname WITH "Three", picdata WITH FILETOSTR(GETFILE())
Obviously, choose a different GIF, JPG, or BMP file each time.
Now, to print the blob contents:
Create an in-scope reference to an image control:
Image1 = CREATEOBJECT("Image")
Create a report form
Add a Picture/OLE Bound report element to the Detail band
Set the Control Source Type to
Expression or Variable nameEnter
Image1 as the Control Source.
Double-click (or right-click) on the Detail band to get the properties dialog
Select the General Tab.
Enter an On-Entry Run Expression of:
EXECSCRIPT("Image1.PictureVal = test.picdata")
Preview the report.
Lisa showed how you can scope the Image control to the report by creating it as a member of the report's data environment object, in the BeforeOpenTables event.
You can also set the Image1.PictureVal property in a Reportlistener's .BeforeBand() event, but that requires a customised report listener instance.
I hope this helps,
- Colin