Search code examples
c#.netoffice-interop

How to convert an Interop.Word.Document object to a stream or byte array?


I'm trying to upload a word document I have created in memory to Sharepoint 2010 and it looks like the only way to do this is to convert it to a byte array or a stream. Is there anyway I can do this without saving it to disk first?


Solution

  • this link: http://social.msdn.microsoft.com/forums/en-US/vsto/thread/84f1ac3f-f078-4087-a627-351d6bb57173/

    suggests that the correct way is to either

    • copy the document to the clipboard, then stream the data off the clipboard, or...
    • read the document Range's XML.