Free Support Forum - aspose.com

Does Aspose implement IDisposable?

Hello,

I'm wodering if aspose has a way to clean up after itself? Specifically, does the document class, for example, implement IDisposable? I don't see anything on the API documention that suggests that it does. I also don't see any close methods.

We're having issues cleaning up files, after aspose is finished with them. We need to find a way to force aspose to clean up or let go of its handles on certain word files.

-Randall

Aspose.Words does not implement IDisposable because there is no need to. The Document class does not keep any files or streams open.

If you pass a file name to a constructor (for loading) or to the Save method, it will open the file for the duration of the operation and close it before returning to you. The closing is guaranteed because the "using" constructs are always employed on streams opened internally by Aspose.Words.

If you pass an already open stream to a constructor or to the Save method, you need to close the stream yourself. This is mentioned in the documentation for the relevant methods.