What is the easiest way to get a text representation (such as Aspose.Words Document.ToTxt() method) of an Excel spreadsheet? An HTML version would be fine.
The main trick is that I would like to avoid saving anything to a file as the text is being stored directly into a database. With Document.ToTxt(), I can just save the information directly to the database and not have to deal with any files. How can I perform the equivalent with an Excel spreadsheet?
Thanks,
Todd
Hi Todd,
I think you may use the following overloaded versions of the Workbook.Save method:
Workbook.Save(Stream, separator)
Workbook.Save(Stream, FileFormatType)
Check the API Reference:
http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/aspose.cells.workbook.save_overloads.html
Thank you.
Do you have any suggestions on how best to accomplish this? As I stated in my initial email, I don't want to generate any actual files here. As far as I know, that leaves me with having to use a MemoryStream but I am unsure how to get the MemoryStream to work in this situation.
Thanks,
Todd
Hi,
I think you may like:
Workbook workbook = new Workbook();
workbook.Open(@"d:\test\Book1.xls");
MemoryStream msSave = new MemoryStream();
workbook.Save(msSave, ',');
byte[] exceldata = msSave.ToArray();
............
Thank you.