In my app I want to give the user the possibility to directly print a Word document or to preview a Word document.
I have created a class which supports both requests. I use the following code to create the class
lparameters tnInvoiceNr, tnOutput
*-- tnInvoiceNr = invoice number to print
*-- tnOutput = c_PRN_TO_PRINTER of c_PRN_PREVIEW
loInvoice = createObject('_word')
loInvoice.m_print(tnInvoiceNr,tnOutput)
release loInvoice
In the _word class I have a method m_print, which contains:
...
if tnOutput=c_PRN_PREVIEW
this.oWord.visible = .t.
this.oDocNew.printpreview
this.oWord.visible = .f.
else
...
endif
Now when i run my app using print preview, i see word showing up and hides after one second or so.
I already tried the following
this.oWord.visible = .t.
this.oDocNew.printpreview
=inkey()
this.oWord.visible = .f.
Assuming the preview will show up, the user can close Word. How does FoxPro handles the procedure calls referring to the Word's object, I think a runtime error occurs.
So, what is the best way for previewing a word document.
André
I have created a class which supports both requests. I use the following code to create the class
lparameters tnInvoiceNr, tnOutput
*-- tnInvoiceNr = invoice number to print
*-- tnOutput = c_PRN_TO_PRINTER of c_PRN_PREVIEW
loInvoice = createObject('_word')
loInvoice.m_print(tnInvoiceNr,tnOutput)
release loInvoice
In the _word class I have a method m_print, which contains:
...
if tnOutput=c_PRN_PREVIEW
this.oWord.visible = .t.
this.oDocNew.printpreview
this.oWord.visible = .f.
else
...
endif
Now when i run my app using print preview, i see word showing up and hides after one second or so.
I already tried the following
this.oWord.visible = .t.
this.oDocNew.printpreview
=inkey()
this.oWord.visible = .f.
Assuming the preview will show up, the user can close Word. How does FoxPro handles the procedure calls referring to the Word's object, I think a runtime error occurs.
So, what is the best way for previewing a word document.
André