I'm trying to find examples of how to save a WorkSheet and Workbook to a stream and convert to HTML. When I try to convert to HTML and return that as a stream I just get binary data. Loading is fine and works.
I'm doing the following (simplified):
- Code: Select all
Workbook workbook = new Workbook();
MemoryStream stream = new MemoryStream();
workbook.LoadFromStream(fileToConvert);
workbook.SaveToStream(stream, Spire.Xls.FileFormat.HTML)
stream.Seek(0, SeekOrigin.Begin);
return stream;
I've also tried a sheet as follows:
- Code: Select all
var activeWorksheet = workbook.ActiveSheetIndex;
Worksheet sheet = workbook.Worksheets[activeWorksheet];
sheet.SaveToStream(stream, "");
I don't know what the separator parameter is or how to convert this to HTML as sheet.SaveToStream(stream, Spire.Xls.FileFormat.HTML) does not work?
Any help would be appreciated.
Thanks.