Free Support Forum - aspose.com

Aspose.Words Close document

With the .net product how do you close a word document in code?
This message was posted using Aspose.Live 2 Forum

Hi

Thanks for your inquiry. If you pass a file name, then the Document class opens and closes the file automatically. The Document class opens the file in the constructor, loads it fully into memory and closes it. Also, the Document class creates a file when you call Save and then closes it when Save returns.

If you pass a Stream object to load or save a document, then Aspose.Word does not close the stream as it regards that your code "owns" the stream.

Best regards.