Fei-Sheng-Wu / XlsxToHtmlConverter

A Xlsx to Html file converter and parser. Support cell fill, font, border, alignment and other styles. Support custom column width and row height. Support vertical and/or horizontal merged cells. Support sheet tab color and hidden sheet. Support pictures. Support progress callback. It only depends on the Microsoft Open Xml SDK.

Home Page:https://www.nuget.org/packages/XlsxToHtmlConverter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

XlsxToHtmlConverter

Target Framework Nuget Lincense

A xlsx to html file converter. Support cell fill, font, border, alignment and other styles. Support custom column width and row height. Support vertical and/or horizontal merged cells. Support sheet tab color and hidden sheet. Support pictures drawing. Support progress callback event. It uses .Net 6.0 as framework and only depends on the Open Xml SDK.

Dependencies

.Net >= 6.0
DocumentFormat.OpenXml = 2.10.1

Main Features

  • Cell fill, font, border, alignment, and other styles
  • Custom column width and row height
  • Vertical and/or horizontal merged cells
  • Sheet tab color and hidden sheet
  • Pictures drawing
  • Progress callback event

How to Use

Only one line to convert xlsx file to html string.

string html = XlsxToHtmlConverter.Converter.ConvertXlsx(xlsxFileName);

Or if xlsx file data is in the stream, convert the stream.

string html = XlsxToHtmlConverter.Converter.ConvertXlsx(xlsxFileStream);

You can even set your custom converter config.

XlsxToHtmlConverter.ConverterConfig config = new XlsxToHtmlConverter.ConverterConfig()
{
    PageTitle = "My Title",
    PresetStyles = "body { background-color: skyblue; } table { width: 100%; }",
    ErrorMessage = "Oh, no. It's error.",
    IsConvertStyles = true,
    IsConvertSizes = false,
    IsConvertPicture = true,
    IsConvertHiddenSheet = false
}

string html = XlsxToHtmlConverter.Converter.ConvertXlsx(xlsxFileName, config);

And you can convert file with progress callback event.

EventHandler<XlsxToHtmlConverter.ConverterProgressCallbackEventArgs> converterProgressCallbackEvent = null;
converterProgressCallbackEvent += ConverterProgressCallback;

string html = XlsxToHtmlConverter.Converter.ConvertXlsx(xlsxFileName, converterProgressCallbackEvent);

Also, you can use custom config and progress callback event together.

string html = XlsxToHtmlConverter.Converter.ConvertXlsx(xlsxFileName, config, converterProgressCallbackEvent);

License

This project is under the MIT License.

About

A Xlsx to Html file converter and parser. Support cell fill, font, border, alignment and other styles. Support custom column width and row height. Support vertical and/or horizontal merged cells. Support sheet tab color and hidden sheet. Support pictures. Support progress callback. It only depends on the Microsoft Open Xml SDK.

https://www.nuget.org/packages/XlsxToHtmlConverter

License:MIT License


Languages

Language:C# 100.0%