Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
HOWTO: Print to an MS Word document
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Divers
Thread ID:
00333362
Message ID:
00333383
Vues:
15
There may be some confusion here. George gave you the code to print an existing document from Word using VFP. He did not give you code to print a report in VFP to Word document format and then have Word print that.

Which did you want?

VFP reports will print BMP images so I'm unclear why you want Word to do it.

>George,

>Thanks for the info. I appreciate it quite a bit.

>I assume I do my normal table and memvar setup(s) to this point. Where do I put this routine and do I still use REPORT FORM... ??

>- Gerry

>>How do I do this?
>>
>>I'd like to print to a Microsoft WORD document, especially since I will be printing bmp images.
>>
>>Thanks!
>> - Gerry
>
>Two ways. One would be to use OLE Automation. The other would be to use the ShellExecute() API call. I'd prefer the latter since the possibility exists that Word isn't present on the target machine. I believe that the FFC has an example of the code necessary to open a file using ShellExecute(). Here's a sample, however, of how to do it.
DECLARE INTEGER ShellExecute IN Shell32;
> INTEGER hwnd, STRING @lpOperation, STRING @lpFile,;
> STRING @lpParameters, STRING @lpDirectory, SHORT nshow
>* lcfile is the document filename
>lcdir = JUSTPATH(lcfile)
>lcop = 'print'
>lnresult = ShellExecute(0, @lcop, @lcfile, "", @lcdir, 0)
>IF lnresult < 32
> * Error
>ENDIF
>The the last zero parameter will prevent the application from being displayed
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform