I\'m trying to return a openXML spreadsheetdocument as a byte[] which I can then use to allow my MVC to send that file to a user. here is my spreadsheetdocument method to re
I had a similar problem with a Word document. I solved this by using the byte array outsite the using, like:
byte[] returnBytes = null; using (MemoryStream mem = new MemoryStream()) { // your code returnBytes = mem.ToArray(); } return returnBytes;