Spreadsheet .NET > Tutorial > Save workbook as HTML

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.

C# example
VB example

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.

C# example
VB example

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.

C# example
VB example

Need help? Ask our developers: