I need to get data from the database and send it to the FTP server in XLS format. I have done the same for XML using memory stream. But, I am not sure how to format and load XLS to memory stream. Any idea or approach? Sample code always helps.
Asked
Active
Viewed 574 times
2 Answers
0
I misunderstood your question. Read file to stream is standard for all files.
new MemoryStream(File.ReadAllBytes(inputFilename))

Osa E
- 1,711
- 1
- 15
- 26
-
It's good for saving XLS locally, but I still don't get how to load the XLS formatted data to memory stream directly. Any idea? – Learner Feb 22 '13 at 19:38
-
Look at the code link above (http://code.google.com/p/excellibrary/source/browse/trunk/src/ExcelLibrary/Office/Excel/SpreadSheet/Workbook.cs). I do see "public void Save(Stream stream)" – Osa E Feb 22 '13 at 19:40
-
Yes, but that means it's expecting stream as a parameter and not that it converts it to stream. – Learner Feb 22 '13 at 19:42
0
Please see this answer, which uses the Excel OpenXML format. The fastest way to get an Excel without any external library.
-
It's good for saving XLS locally, but I still don't get how to load the XLS formatted data to memory stream. Any idea? – Learner Feb 22 '13 at 19:38