Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dynamic BMP on reports
Message
De
12/03/1997 23:52:06
Kervin Lo
Romeford Systems
Hong Kong, Hong Kong
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00023879
Message ID:
00024034
Vues:
40
>>> Does anyone know how to make an image on a report change based on a
>>> filename provided in a field/variable?
>>>
>>> I want the user to select their own logo.
>>
>>in the worst case you can directly change the FRX record (it is just another table you
>>know (s))
>>
>>Arnon
>
>Changing the FRX file will work, but what if you wnat reports included in the Project/App? Then you want be able to wrtie the report ile unless you copy the report to disk before changing it.
>I needed the same feature on screens in FPW26 so I wrote a little function that will display/print images dynamically, but later I realized that the approach is valid in printing reports in VFP also.
>Here is the strategy:
>I created a dbf IMAGES.DBF with 2 fields: imagecode C(20), imagegen G(10). I store the image in images.imagegen and give it the description, let's say image.imagecode='LOGO'.
>The IMAGE dbf must be indexed on imagecode.
>On the report I place an OLE/image object with Picture from field value=EVALUATE(Pickpic('LOGO')).
>Here is the Pickpic function:
>
>**********************************
>FUNCTION Pickpic
>PARAMETERS tcpicCode
>**********************************
>PRIVATE ALL
>lcAlias = ALIAS()
>IF USED('images')
> SELECT images
>ELSE
> USE images IN 0 ORDER imagecode
>ENDIF
>SET ORDER TO 1
>IF .NOT. SEEK(tcpicCode)
> GO BOTTOM

Put the Field name or Variable name to instead the file name of the image in the report, add the a checking to the "Print When" make sure the specific bitmap file is existing, otherwise the report will error.

Assume that :

a = "c:\windows\honey.bmp"

Print When : file(a)

Kervin Lo



> SKIP
>ENDIF
>IF .NOT. EMPTY(lcAlias)
> SELECT (lcAlias)
>ENDIF
>RETURN ('images.imagegen')
>
>The above technique will permit handling/printing of multiple images stored in IMAGES.DBF dynamically. It may look more complicate than it really is.
>APPEND GENERAL... will do the transfer from image file to general field, taht I guess you can figure out.
>HTH
>Sorin
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform