HtmlToOpenXml.dll 3.2.5
What is HtmlToOpenXml?
HtmlToOpenXml is a small .Net library that convert simple or advanced HTML to plain OpenXml components. This program has started in 2009, initially to convert user's comments into Word.
This library supports both .Net Framework 4.6.2, .NET Standard 2.0 and .NET 8 which are all LTS.
Depends on DocumentFormat.OpenXml and AngleSharp.
See Also
- Documentation
- How to deliver a generated DOCX from server Asp.Net/SharePoint?
- Prevent Document Edition
- Convert dotx to docx
Supported Html tags
Refer to w3schools’ tag list to see their meaning
ah1-h6abbrandacronymb,i,u,s,del,ins,em,strike,strongbrandhrimg,figcaptionandsvgtable,td,tr,th,tbody,thead,tfoot,captionandcolcitediv,span,time,fontandppresubandsupul,olandliddanddtq,blockquote,dfnarticle,aside,sectionare considered likediv
Javascript (script), CSS style, meta, comments, buttons and input controls are ignored.
Other tags are treated like div.
In v1 and v2, Javascript (script), CSS style, meta, comments and other not supported tags does not generate an error but are ignored.
Html Parser
In v3, the parsing of the Html relies on AngleSharp package, which follows the W3C specifications and actively supports Html5.
In v1 and v2, the parsing of the Html was done using a custom Regex-based enumerator and was more flexible, but leaving a complex code, hard to maintain.
How to implement or debug features
My reference bibles cover both OpenXml and HTML:
Open MS Word or Apple Pages and design your expected output. Save as a DOCX file, then rename as a ZIP. Extract the content and inspect those files:
document.xml, numbering.xml (for list) and styles.xml.
Acknowledgements
Thank you to all contributors that share their bug fixes (in no particular order): scwebgroup, ddforge, daviderapicavoli, worstenbrood, jodybullen, BenBurns, OleK, scarhand, imagremlin, antgraf, mdeclercq, pauldbentley, xjpmauricio, jairoXXX, giorand, bostjanKlemenc, AaronLS, taishmanov. And thanks to David Podhola for the Nuget package.
Logo provided with the permission of Enhanced Labs Design Studio.
Support
This project is open source and I do my best to support it in my spare time. I'm always happy to receive Pull Request and grateful for the time you have taken. Please target branch dev only.
If you have questions, don't hesitate to get in touch with me!
Showing the top 20 packages that depend on HtmlToOpenXml.dll.
| Packages | Downloads |
|---|---|
|
Magicodes.IE.Word
Import and export general library, support Dto import and export, template export, fancy export and dynamic export, support Excel, Csv, Word, Pdf and Html.
导入导出通用库,支持Dto导入导出、模板导出、花式导出以及动态导出,支持Excel、Csv、Word、Pdf和Html。
开源库地址:https://github.com/xin-lai
博客地址:http://www.cnblogs.com/codelove/
更新记录:https://github.com/dotnetcore/Magicodes.IE/blob/master/RELEASE.md
公众号:麦扣聊技术
交流QQ群:85318032
|
7 |
|
Magicodes.IE.Word
导入导出通用库,通过导入导出DTO模型来控制导入和导出,支持Excel、Word、Pdf和Html。
开源库地址:https://github.com/xin-lai
博客地址:http://www.cnblogs.com/codelove/
交流QQ群:85318032
|
2 |
|
Magicodes.IE.Word
Import and export general library, support Dto import and export, template export, fancy export and dynamic export, support Excel, Csv, Word, Pdf and Html.
导入导出通用库,支持Dto导入导出、模板导出、花式导出以及动态导出,支持Excel、Csv、Word、Pdf和Html。
开源库地址:https://github.com/xin-lai
博客地址:http://www.cnblogs.com/codelove/
更新记录:https://github.com/dotnetcore/Magicodes.IE/blob/master/RELEASE.md
公众号:麦扣聊技术
交流QQ群:85318032
|
2 |
|
Magicodes.IE.Word
导入导出通用库。
官方网址:http://xin-lai.com
开源库地址:https://github.com/xin-lai
博客地址:http://www.cnblogs.com/codelove/
交流QQ群:85318032
小店地址:https://shop113059108.taobao.com/
|
2 |
|
Magicodes.IE.Word
Import and export general library, support Dto import and export, template export, fancy export and dynamic export, support Excel, Csv, Word, Pdf and Html.
导入导出通用库,支持Dto导入导出、模板导出、花式导出以及动态导出,支持Excel、Csv、Word、Pdf和Html。
开源库地址:https://github.com/xin-lai
博客地址:http://www.cnblogs.com/codelove/
更新记录:https://github.com/dotnetcore/Magicodes.IE/blob/master/RELEASE.md
公众号:麦扣聊技术
交流QQ群:85318032
|
2 |
|
Magicodes.IE.Word
Import and export general library, support Dto import and export, template export, fancy export and dynamic export, support Excel, Csv, Word, Pdf and Html.
导入导出通用库,支持Dto导入导出、模板导出、花式导出以及动态导出,支持Excel、Csv、Word、Pdf和Html。
开源库地址:https://github.com/xin-lai
博客地址:http://www.cnblogs.com/codelove/
更新记录:https://github.com/dotnetcore/Magicodes.IE/blob/master/RELEASE.md
公众号:麦扣聊技术
交流QQ群:85318032
**2022.03.02**
- Excel导入时增加回调函数,方便增加自定义验证
- 优化获取DisplayName的逻辑
- 导出CSV支持ColumnIndex
- 优化Pdf导出逻辑,统一各平台导出代码
**2021.11.28**
- 修复未及时回收问题
**2021.11.28**
- 添加两个动态验证特性(见PR[#319 by Afonsof91](https://github.com/dotnetcore/Magicodes.IE/pull/359)),DynamicStringLengthAttribute及RequiredIfAttribute
- CSV添加对分隔符的配置,具体见PR[#319 by Afonsof91](https://github.com/dotnetcore/Magicodes.IE/pull/319)
- Excel导入添加对`TimeSpan`类型的支持,使用参考`TimeSpan_Test`
- 初步添加对.NET6的适配
**2021.10.23**
- 导出日期格式化支持'DateTimeOffset'类型,具体见PR[#349](https://github.com/dotnetcore/Magicodes.IE/pull/349),感谢[YaChengMu](https://github.com/YaChengMu)
- 修改Magicodes.IE.EPPlus的包依赖PR[#351](https://github.com/dotnetcore/Magicodes.IE/pull/351)
|
2 |
|
Magicodes.IE.Word
导入导出通用库,通过导入导出DTO模型来控制导入和导出,支持Excel、Word、Csv、Pdf和Html以及动态导出。
开源库地址:https://github.com/xin-lai
博客地址:http://www.cnblogs.com/codelove/
交流QQ群:85318032
**2020.06.17**
- ** 【Nuget】版本更新到2.2.7**
- ** 【HTML导出】添加对NETCore2.2模板引擎的支持
**2020.06.16**
- ** 【Nuget】版本更新到2.2.6**
- ** 【HTML导出】添加对NETCore2.2模板引擎的支持
**2020.06.14**
- ** 【Nuget】版本更新到2.2.5**
- ** 【Excel导出】增加分栏、分sheet、追加rows导出 [#74](https://github.com/dotnetcore/Magicodes.IE/issues/74)**
- exporter.Append(list1).SeparateByColumn().Append(list2).ExportAppendData(filePath);
- exporter.Append(list1).SeparateBySheet().Append(list2).ExportAppendData(filePath);
- exporter.Append(list1).SeparateByRow().AppendHeaders().Append(list2).ExportAppendData(filePath);
- ** [Excel导出】修复‘IsAllowRepeat=true’ [#107](https://github.com/dotnetcore/Magicodes.IE/issues/107) **
- ** [Pdf导出】增加PDF扩展方法,支持通过以参数形式传递特性参数 [#104](https://github.com/dotnetcore/Magicodes.IE/issues/104) **
- `ExportListBytesByTemplate<T>(ICollection<T> data, PdfExporterAttribute pdfExporterAttribute,string temple);`
- `ExportBytesByTemplate<T>(T data, PdfExporterAttribute pdfExporterAttribute,string template);`
**2020.06.07**
- ** 【Nuget】版本更新到2.2.4**
- ** 【Excel导入】增加`导入失败`仅返回错误行功能**
- ** 【Excel导入】修复导入的空行标注位置偏移**
- ** 【Excel导出】增加`SeparateByColumn`进行分割追加列**
|
2 |
|
Magicodes.IE.Word
Package Description
|
2 |
|
Magicodes.IE.Word
导入导出通用库,通过导入导出DTO模型来控制导入和导出,支持Excel、Word、Csv、Pdf和Html以及动态导出。
开源库地址:https://github.com/xin-lai
博客地址:http://www.cnblogs.com/codelove/
交流QQ群:85318032
**2020.05.24**
- **【Nuget】版本更新到2.2.2**
- **【Excel导入】增加了stream导入扩展方法
- **【Excel导出】增加了内容居中(单列居中、整表居中)
- **【导出】对一些中间件代码进行了修复及优化
**2020.05.16**
- **【Nuget】版本更新到2.2.1**
【PDF导出】对模板引擎进行升级更新
**2020.05.12**
- **【Nuget】版本更新到2.2.0**
- **【Excel模板导出】支持导出字节**
- **【文档】Magicodes.IE Csv导入导出**
- **【Excel导入导出】修复标注的添加问题**
- **【导出】ASP.NET Core Web API 中使用自定义格式化程序导出Excel、Pdf、Csv等内容** [#64](https://github.com/dotnetcore/Magicodes.IE/issues/64)
- **【导入导出】支持使用System.ComponentModel.DataAnnotations命名空间下的部分特性来控制导入导出** [#63](https://github.com/dotnetcore/Magicodes.IE/issues/63)
|
2 |
|
Magicodes.IE.Word
Import and export general library, support Dto import and export, template export, fancy export and dynamic export, support Excel, Csv, Word, Pdf and Html.
导入导出通用库,支持Dto导入导出、模板导出、花式导出以及动态导出,支持Excel、Csv、Word、Pdf和Html。
开源库地址:https://github.com/xin-lai
博客地址:http://www.cnblogs.com/codelove/
公众号:麦扣聊技术
交流QQ群:85318032
**2021.03.08**
- Excel模板导出支持使用JSON对象完成动态导出
**2021.03.05**
- Excel导入支持合并行数据 [#239](https://github.com/dotnetcore/Magicodes.IE/issues/239)
**2021.02.23**
- 【Nuget】版本更新到2.5.1.8
- Input string was not in a correct format.[#241](https://github.com/dotnetcore/Magicodes.IE/issues/241)
- 使用Stream方式导入xlsx,rowErrors里的rowIndex位置不对[#236](https://github.com/dotnetcore/Magicodes.IE/issues/236)
**2021.02.20**
- 【Nuget】版本更新到2.5.1.7
- Excel支持Base64导出 [#219](https://github.com/dotnetcore/Magicodes.IE/issues/219)
- 修复 [#214](https://github.com/dotnetcore/Magicodes.IE/issues/214)
**2021.01.31**
- 【Nuget】版本更新到2.5.1.6
- 部分重构模板导出
- Excel模板导出语法解析加强 #211
- 修复当表格下面存在变量时,无法渲染的Bug
**2021.01.29**
- 【Nuget】版本更新到2.5.1.5
- 移除模板导出时的控制台日志输出
**2021.01.09**
- 【Nuget】版本更新到2.5.1.4
- 修复Excel导出列头索引与内容排序不一致问题及单测 [#226](https://github.com/dotnetcore/Magicodes.IE/issues/226)
|
2 |
|
Magicodes.IE.Word
Import and export general library, support Dto import and export, template export, fancy export and dynamic export, support Excel, Csv, Word, Pdf and Html.
导入导出通用库,支持Dto导入导出、模板导出、花式导出以及动态导出,支持Excel、Csv、Word、Pdf和Html。
开源库地址:https://github.com/xin-lai
博客地址:http://www.cnblogs.com/codelove/
更新记录:https://github.com/dotnetcore/Magicodes.IE/blob/master/RELEASE.md
公众号:麦扣聊技术
交流QQ群:85318032
**2021.11.28**
- 修复未及时回收问题
**2021.11.28**
- 添加两个动态验证特性(见PR[#319 by Afonsof91](https://github.com/dotnetcore/Magicodes.IE/pull/359)),DynamicStringLengthAttribute及RequiredIfAttribute
- CSV添加对分隔符的配置,具体见PR[#319 by Afonsof91](https://github.com/dotnetcore/Magicodes.IE/pull/319)
- Excel导入添加对`TimeSpan`类型的支持,使用参考`TimeSpan_Test`
- 初步添加对.NET6的适配
**2021.10.23**
- 导出日期格式化支持'DateTimeOffset'类型,具体见PR[#349](https://github.com/dotnetcore/Magicodes.IE/pull/349),感谢[YaChengMu](https://github.com/YaChengMu)
- 修改Magicodes.IE.EPPlus的包依赖PR[#351](https://github.com/dotnetcore/Magicodes.IE/pull/351)
**2021.10.13**
- 支持自定义列字体颜色,具体见PR[#342](https://github.com/dotnetcore/Magicodes.IE/pull/342),感谢[xiangxiren](https://github.com/xiangxiren)
- 修复日期格式化的问题,具体见PR[#344](https://github.com/dotnetcore/Magicodes.IE/pull/344),感谢[ccccccmd](https://github.com/ccccccmd)
|
2 |
.NET Framework 4.6.2
- AngleSharp (>= 1.2.0)
- DocumentFormat.OpenXml (>= 3.1.0)
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
- System.ValueTuple (>= 4.5.0)
.NET 8.0
- AngleSharp (>= 1.2.0)
- DocumentFormat.OpenXml (>= 3.1.0)
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
.NET Standard 2.0
- AngleSharp (>= 1.2.0)
- DocumentFormat.OpenXml (>= 3.1.0)
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
| Version | Downloads | Last updated |
|---|---|---|
| 3.2.8 | 2 | 2025/11/19 |
| 3.2.7 | 1 | 2025/11/19 |
| 3.2.6 | 2 | 2025/8/26 |
| 3.2.5 | 2 | 2025/8/26 |
| 3.2.4 | 2 | 2025/8/26 |
| 3.2.3 | 2 | 2025/8/26 |
| 3.2.2 | 2 | 2025/8/26 |
| 3.2.1 | 2 | 2025/8/26 |
| 3.2.0 | 3 | 2025/8/26 |
| 3.1.1 | 2 | 2025/8/26 |
| 3.1.0 | 7 | 2025/7/11 |
| 3.0.1 | 2 | 2025/8/26 |
| 3.0.0 | 2 | 2025/8/26 |
| 3.0.0-beta | 2 | 2025/8/26 |
| 2.4.2 | 2 | 2025/8/26 |
| 2.4.1 | 2 | 2025/8/26 |
| 2.4.0 | 3 | 2025/8/26 |
| 2.3.0 | 2 | 2025/8/26 |
| 2.2.0 | 3 | 2025/8/26 |
| 2.1.0 | 2 | 2025/8/26 |
| 2.0.3 | 2 | 2025/8/26 |
| 2.0.2 | 2 | 2025/8/26 |
| 2.0.1 | 2 | 2025/8/26 |
| 2.0.0 | 2 | 2025/8/26 |
| 1.5.0 | 2 | 2025/8/26 |
| 1.4.1 | 2 | 2025/8/26 |