The following example shows you how to export a workbook to HTML format with a single call. The SaveAsHtml method writes every worksheet as an HTML table, preserving cell values, number formats, fonts, colors, borders and merged cells.
Use the GetHtml method when you need the HTML markup as a string, for example to return it from a web request or embed it in a larger page instead of writing a file.
The SaveAsHtml method also has an overload that writes to any System.IO.Stream, which is convenient when the HTML is streamed directly to the client and never stored on disk.