Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Printing a word doc from VFP
Message
From
20/04/2015 11:50:03
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01618752
Message ID:
01618788
Views:
29
>>>>Using the following code my word doc prints in VFP
>>>>
>>>>DECLARE INTEGER ShellExecute ;
>>>>IN SHELL32.DLL ;
>>>>INTEGER nWinHandle,;
>>>>STRING cOperation,;
>>>>STRING cFileName,;
>>>>STRING cParameters,;
>>>>STRING cDirectory,;
>>>>INTEGER nShowWindow
>>>>? ShellExecute(0,"print","c:\what.doc","","",0)
>>>>
>>>>But I get a message
>>>>
>>>>The margins of section 1 are outside the printable area of the page - do you want to continue?
>>>>
>>>>If I say yes it prints fine - how can I stop this message coming up?
>>>
>>>Not sure if this code will suppress this message:
>>>
>>>oWord = CREATEOBJECT("Word.Application")
>>>oWord.Documents.Open(GETFILE())
>>>oWord.DisplayAlerts = .f.
>>>oWord.Visible = .t.
>>>oWord.PrintOut()
>>>oWord.ActiveDocument.Close()
>>>oWord.Quit()
>>>
>>
>>I think a while ago I suggested slightly different approach (it was not DisplayAlerts but something else) and it worked. Should be here in UT but I can not search.
>
>Thanks - I cant get that to work - what if i convert the doc to a pdf - how do I print that from VFP?

It's exactly the same code! Since a PDF will have pdf as its extension, Windows will pick up the registered program to print it.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform