I can ble to convert from HTML to Excel file from below code. but is there option to convert from HTML to Excel stream? Becase, I need to convert this stream to bytes and need to store in db.
// Convert Word document to Excel Spreadsheet in C#
using (Converter converter = new Converter(“document.html”))
{
SpreadsheetConvertOptions options = new SpreadsheetConvertOptions();
converter.Convert(“outputpath/convertedSpreadsheet.xlsx”, options);
}
@nivas.svr
Please take a look at this topic. You can save output to stream.
The Converter API supports writing to a stream: create a MemoryStream, pass it to the Convert overload together with SpreadsheetConvertOptions, then use the completed stream’s bytes for your database insert. Keep the stream alive until conversion finishes, and reset its position before reading if needed. If you also need a file, convert once to the stream and write those bytes to disk rather than converting twice.