We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

DOCIO WordDocument

Hi, 

I',m using WordDocument as mailmerge generator  within loop inside windows service

How i should properly dispose worddocument instance ?
There is no dispose method or IDisposable interface implemented.

Now i create one instance per loop.
Should i share only one for all loops. If so, how properly cleanup worddocument befor every loop.

What do you suggest ?

Thanks for advance.

Edvin



3 Replies

NB Nithya B Syncfusion Team July 14, 2014 01:02 PM UTC

Hi Edvin,

Thank you for using Syncfusion products.

In the DocIO DOM we have reference properties in each element to preserve the parent, child relation between all the document elements. Whereas in Close() method we have explicitly unlink the child elements from its parent element by removing the reference to the parent element and clear all the child elements from parent’s child collection. This operation is required specifically to remove references of all the instances used by DocIO DOM, in order to ensure no instance is referred anywhere/alive in the current scope and the used resources can be freed.

 

Kindly invoke Close() method of WordDocument class to free the resources used  by each WordDocument instance. Please find the code snippet below for your reference.

[C#]

 

//Releases the resources used by the WordDocument instance.

doc.Close();

 

[VB.NET]

 

'Releases the resources used by the WordDocument instance.

doc.Close()

Let me know if you have any questions.

 

Regards,

Nithya



ED Edvin July 15, 2014 09:47 AM UTC

Thanks for explanation.

Edvin


NB Nithya B Syncfusion Team July 15, 2014 01:05 PM UTC

Hi Edvin

Thanks for update.

Please let us know if you have any other questions.

 

Regards,

Nithya


Loader.
Live Chat Icon For mobile
Up arrow icon