Save workbook into a stream instead of a file
Is it possible (and how) to save an Microsoft Excel workbook into a stream instead of a file?
what I have now is:
using System.Runtime.InteropServices; // Microsoft Excel 14.0 Object Library
.......
workbook.SaveAs(Filename: fileName, FileFormat: XlFileFormat.xlWorkbookNormal);
But both doc开发者_如何学JAVAumentation as intellisense give me no clue how to put this in a stream
and write it with a BinaryWriter
e.g. to output it via the browser.
Office Automation provides an API to control tge office UI. It does not provide a way to store a workbook to a stream. To do that you need something lower level like a binary writer (POI) or Office Open XML SDK.
精彩评论