foxpro codes below:
any xml file is a simple txt file ( as prg,html,...)
notepad can open this file (as IE,FF or any navigator).
can use this vfp syntax:(see foxHelp)
TYPE FileName1 [AUTO] [WRAP] [TO PRINTER [PROMPT] | TO FILE FileName2] [NUMBER]
or simply Type getfile('xml') to printer
another light way to print directly an xml file is to print it with notepad command line (/p)
(wordpad /p does the same thing also).
local m.lcfile
m.lcfile=getfile('xml')
if empty(m.lcfile)
return .f.
endi
run/n notepad /p &lcfile
the API shellexecute (0,"print",getfile('xml'),"","",0) dont work because there is no association
with the print verb and the xml files.
it returns a result value<=32 want to say fails.
you can invoke the commondialog print with sending keys
keyboard "{CTRL+P"}
or
creating com object "(mscomdlg.commondialog") prompt or no prompt.
you can use IE oleBrowser with
#DEFINE OLECMDID_PRINT 6
#DEFINE OLECMDID_PRINTPREVIEW 7
#DEFINE OLECMDEXECOPT_DODEFAULT 0
#DEFINE LECMDEXECOPT_DONTPROMPTUSER 2
apie=newObject("internetexplorer)
with apie
......
.Execwb(OLECMDID_PRINT ,LECMDEXECOPT_DONTPROMPTUSER )
.......
.quit
endwith
warning: IE have changed some old behaviors depending what IE version used.
Can also use old CMD.exe to print a file by directing it to the printer
i dont know if this yet work in dos cmd window:
type "filename.txt" >lpt1: