'HTML export on EPPlus?

Had a quick question about the EPPlus library. Can it export an excel spreadsheet as an HTML page? The application I am writing needs to be able to do this.



Solution 1:[1]

You can use Spire.XLS which enables developers to convert Excel to other popular formats, such as PDF, XML, HTML, CSV, Image format etc

Its @ Nuget, Install-Package Spire.XLS -Version 8.4.13

Solution 2:[2]

You could extract datatable from excel file using EPPlus and convert it to HTML using the code described here: https://www.c-sharpcorner.com/UploadFile/deveshomar/export-datatable-to-html-in-C-Sharp/

Afterwards, you can export the html string to excel file as:

private void ExportToXLS(string data)
{
        HttpContext.Current.Response.ClearContent();
        HttpContext.Current.Response.AddHeader("content-disposition",
                                               "attachment;filename=Your_File_Name.xls");
        HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";
        EnableViewState = false;
        HttpContext.Current.Response.Write(HttpUtility.UrlDecode(data));
        HttpContext.Current.Response.End();
}

Solution 3:[3]

EPPlus 6, released April 2022, has support for exporting ranges and tables to html with separate css. See these samples https://samples.epplussoftware.com/HtmlExport/

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Rajendra Tripathy
Solution 2 Sanjay
Solution 3 swmal