Memory increase problem in winword.exe in office automation word20

V

Vinita Batra

Hi,


I am using office automation in windows service,


I have one static object of ms word app that remains available
throughout the webservice.
i create the object when the windows service is started and this
object is destroyed when service is stopped.
my problem is that since winword object is destroyed when service is
stopped, throughout same word object is used. Now on doing word
operations, memory is getting increased.
I m using the following code. Please help me on this.


I m using following code in when i start windows service
private static Microsoft.Office.Interop.Word.ApplicationClass
oWordApp = null;
private static Microsoft.Office.Interop.Word.Document oWordDoc =
null;
oWordApp = new Microsoft.Office.Interop.Word.ApplicationClass();


oWordDoc = oWordApp.Documents.Add(ref missing, ref missing, ref
missing, ref missing);
// the abobe line is, so that if some body opens word doc by double
click on explorer and then on closing word doc, my winnword.exe does
not get killed.//


then operations for word are performed.
when service is stopped then i close word
if (oWordDoc != null)
{
oWordDoc.Close(ref missing, ref missing, ref
missing);
oWordDoc = null;


}
if (oWordApp != null)
{
oWordApp.Application.Quit(ref missing, ref missing,
ref missing);
oWordApp = null;
}


Regards,
Vinita>>
--
 
R

Robert M. Franz (RMF)

Hi Vinita

Vinita said:
I am using office automation in windows service,

I have one static object of ms word app that remains available
throughout the webservice.
[..]

you're chances of finding an expert for your problem in this "general
purpose" Word forum (or ".word.docmanagement" newsgroup, depending on
how you reach us) are slim at best.

Try one of the .word.vba groups for better luck if you think that the
experts with the Word OM might help you.

In the mean time, maybe the following articles may shed some light:

Considerations for server-side Automation of Office
http://support.microsoft.com/?scid=kb;en-us;257757&x=8&y=11

Basic Instincts – Server-Side Generation of Word 2007 Docs
http://msdn.microsoft.com/msdnmag/issues/06/11/BasicInstincts/default.aspx?loc=en

HTH
Robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top