Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Printing a text file from within VFP
Message
 
À
23/03/1999 09:12:33
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00200878
Message ID:
00200993
Vues:
12
>What is the best way to print a plain-text file (as opposed to RTF) from within a VFP program or form? Here is an example of what I've tried so far.
>
>** Use low-level file functions to open the text file
>** and read it into a memvar
>gnfilehand = fopen("c:\jomast.str")
>nsize = fseek(gnfilehand,0,2)
>= fseek(gnfilehand,0,0)
>cstring = fread(gnfilehand, nsize)
>
>** Output the contents of the memvar to the default printer
>set printer on
>set printer font 'Courier', 12
>set printer to default
>? cstring
>eject
>set printer to
>set printer off
>eject
>
>
>It spools the output (albeit very slowly, 1 byte / sec), but refuses o actually print it. I'm running VFP 6.0 on an NT 4.0 network, and sending the output to a HP LaserJet 5.
>
>Bill Yater

Bill,
to expand a little on Josephs' answer, try this code

fname = getfile('txt')

if not empty(fname)
type (fname) to printer wrap
endif

release fname

Regards
Pete Kane.
Regards,
Peter J. Kane



Pete
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform