Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to print image from a blob field
Message
De
17/11/2004 22:13:27
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro Beta
Divers
Thread ID:
00962468
Message ID:
00962475
Vues:
114
J'aime (1)
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   && this needs new-style report engine 
 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 name
Enter 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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform