Convert to HTML

This demo uses the DevExpress Spreadsheet Document API to convert Excel worksheets to HTML pages. You can process the sample file or supply your own document. To do the latter, select Upload a File in the file selection drop-down menu.

Specify the worksheet index and check the Export Images box to keep images in the resulting HTML page. Click Convert Document to generate and download the result.

Select a Document
InvestmentPortfolio.xlsx



using DevExpress.Spreadsheet;
using DevExpress.XtraSpreadsheet.Export;

Stream ConvertToHtml(Stream inputStream, int sheetIndex, bool exportImages) {
    // Create Workbook instance
    using var workbook = new Workbook();

    // Load the input document
    workbook.LoadDocument(inputStream);

    // Create output stream
    var outputStream = new MemoryStream();

    // Create export options
    var exportOptions = new HtmlDocumentExporterOptions() {
        SheetIndex = sheetIndex,
        EmbedImages = true,
        ExportImages = exportImages
    };

    // Save document in target format
    workbook.ExportToHtml(outputStream, exportOptions);

    outputStream.Position = 0;
    return outputStream;
}