How to create a word document directly into MemoryStream?

Hello,I have a new question in coding:
I create a word report in server,I want to let users download the it to his local machine,now I use “doc.Save(…)” to save the file first,and then generate a memory to download to users’ local,I know this way is so slowly,can I directly create a word document into MemoryStream without saving to the server ?

Thanks for your request. You can save your document directly into MemoryStream. See the following link for additional information.
Or if you use .NET version of Aspose.Words, you can save document to client browser. See the following link.
I hope that it will help you.

The links seems to have broken. Need help in saving the doc to a MemoryStream.

Thanks for your inquiry. You can use the following code.

MemoryStream stream = new MemoryStream();
doc.Save(stream, SaveFormat.Doc);

Please let me know if you would like to know something else.
Best regards.