Aspose not immediately releasing a word document

We are evaluating Aspose.Words for performing a mail merge and printing the resultant document.

The merge and print are OK but appears that Aspose does not immediately release the document after it is saved. If an attempt is made to open the saved document in Word straight away we get a document in use error. After around 3 minutes the document does become available to other users.

Is there something we should be doing to release the docuemnt after performing:

document.save(“test.doc”, SaveFormat.Doc)

Thanks,
Mike

Hi Mike,

Thanks for your inquiry. You do not need to do something to release a document. The document should be released once Save method finished saving the document. You should note that if document is large, it can take time to save such document to file. Could you please create simple application, which will allow me to reproduce the problem on my side? I will check it an provide you more information.

Best regards.

Hi Alexey,

We use a Web Service that references the Aspose.Words DLL which is called to mail merge, print and save a .doc . These operations are successful but the .doc remains locked for a few minutes - presumably until a timeout occurs. So if I call the WS again using the same file I get the “in use by another process message”. Process Explorer reveals that an instance of svchost has the file.

As you suggested, I created a simpler WS that just does the Aspose calls. I used the same file and merge data and that works fine and doesn’t leave the .doc locked.

The error is caught by a try … catch around the Aspose doc.Save call, can you suggest something else that I could try?

Thanks,
Mike

Hi Alexey,

I have found the problem, it is not due caused by Aspose.

I was attaching the document to an email and it was the mailMessage that had hold of the document. I thought that setting the mailMessage to null would have released it but it needed a mailMessage.Attachments.Dispose() before nulling .

Sorry to have misled you.

Best wishes,
Mike

Hi Mike,

It is perfect that you already found the reason of the problem and managed to resolve it. Please let me know in case of any other issues, I will be glad to help you.

Best regards.