Free Support Forum - aspose.com

Send streaming file as attachment

Actually, I am tring Aspose… Now, I can send the word document(real & physically) as attachment.

But I don’t want to keep all indivduals word documents, I want to make a streaming word document and send as attachment. Can i do that?

Thank you!

Do you mean to save into a Stream object or to a Response object so it goes down to the client browser? Both is possible, there is example code how to do this in the demo projects and in the documentation. Let me know if you need more help.

Yes. I want to save to stream object and send as attachment, I only find the demo for “go to the client browser” only, can’t find how to manage the stream object…

If you can write it down here, that will be great! Thank you very much!

To save into .NET Stream object just use Document.Save method takes Stream as a parameter:

mergeDoc.Save(stream, SaveFormat.FormatDocument);

I’m not sure what do you mean by “attachment”. Is it an attachment to some email message class? Then you need to check documentation of that class how to send a stream along with it as an attachment. I’m afraid this out of scope for Aspose.Word or I don’t understand something.

Hi romank,

I am newbie of dotnet, how i can define the stream in my code.? thx!

I suggest you read about streams in MSDN or in other general .NET articles or forums.

To point you in the right direction you need to look at System.IO namespace and classes inside it, also Working With I/O.