C
Chris Ericoli
Hi,
I am attempting to convert .doc files into PDF files through word
automation. My code performs as expected, with the unusual side effect of
spawning 2 winword.exe processes when instantiating the
Word.ApplicationClass object. As you will see from the code, I am only
calling one instance, and using the .Quit() method to close the COM object
(in all of the posts i have read concerning this - this appears to be the
problem that people overlook).
--== CODE ==--
Dim _wdApp As Microsoft.Office.Interop.Word.Application
_wdApp = New Microsoft.Office.Interop.Word.ApplicationClass
_wdApp.DisplayAlerts =
Microsoft.Office.Interop.Word.WdAlertLevel.wdAlertsNone
_wdDoc = _wdApp.Documents.Open("c:\test.doc", False, True)
'Printing code ommitted
_wdDoc.Close(False)
_wdApp.Quit(Type.Missing, Type.Missing, Type.Missing)
_wdApp = Nothing
When stepping through the code, I have noticed something very odd. The
debugger steps through the (_wdApp = New Microsoft.Office.Interop.Word etc
etc) two times. When I examine the processes in Task Manager, I notice that
each time the debugger steps through this line of code, a winword.exe
process is spawned. This means that when i call the _wdApp.Quit method,
only one of the processes ends, leaving a second process behind (which I
can't close).
I have tried using
System.Runtime.InteropServices.Marshal.ReleaseComObject(_wdApp) but this is
the same as the Quit method.
I am very confused by this behaviour - and would really appreciate any help
whatsoever. I understand the limitations of running Word on the IIS server,
but I have no choice.
Other info:
VSNET 2003
Office 2003 (Office 11 Object Library)
Cheers
Chris
I am attempting to convert .doc files into PDF files through word
automation. My code performs as expected, with the unusual side effect of
spawning 2 winword.exe processes when instantiating the
Word.ApplicationClass object. As you will see from the code, I am only
calling one instance, and using the .Quit() method to close the COM object
(in all of the posts i have read concerning this - this appears to be the
problem that people overlook).
--== CODE ==--
Dim _wdApp As Microsoft.Office.Interop.Word.Application
_wdApp = New Microsoft.Office.Interop.Word.ApplicationClass
_wdApp.DisplayAlerts =
Microsoft.Office.Interop.Word.WdAlertLevel.wdAlertsNone
_wdDoc = _wdApp.Documents.Open("c:\test.doc", False, True)
'Printing code ommitted
_wdDoc.Close(False)
_wdApp.Quit(Type.Missing, Type.Missing, Type.Missing)
_wdApp = Nothing
When stepping through the code, I have noticed something very odd. The
debugger steps through the (_wdApp = New Microsoft.Office.Interop.Word etc
etc) two times. When I examine the processes in Task Manager, I notice that
each time the debugger steps through this line of code, a winword.exe
process is spawned. This means that when i call the _wdApp.Quit method,
only one of the processes ends, leaving a second process behind (which I
can't close).
I have tried using
System.Runtime.InteropServices.Marshal.ReleaseComObject(_wdApp) but this is
the same as the Quit method.
I am very confused by this behaviour - and would really appreciate any help
whatsoever. I understand the limitations of running Word on the IIS server,
but I have no choice.
Other info:
VSNET 2003
Office 2003 (Office 11 Object Library)
Cheers
Chris