百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
H

html2openxml

> 编程语言
开源

Html2OpenXml 是一个小型 .Net 库,可将简单或高级的 HTML 转换为纯粹的 OpenXml 组件。此程序始于 2009 年,最初是为了将我们的 HTML 文档转换为 OpenXml 文档。

395 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

Html2OpenXml 是一个小型 .Net 库,可将简单或高级的 HTML 转换为纯粹的 OpenXml 组件。此程序始于 2009 年,最初是为了将我们的 HTML 文档转换为 OpenXml 文档。

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, .NET 8 .NET 10 which are all LTS.

Depends on DocumentFormat.OpenXml and AngleSharp.

-> Official Nuget Package

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

  • a
  • h1-h6
  • abbr and acronym
  • b, i, u, s, del, ins, em, strike, strong
  • br and hr
  • img, figcaption and svg
  • table, td, tr, th, tbody, thead, tfoot, caption and col
  • cite
  • div, span, time, font and p
  • pre
  • sub and sup
  • ul, ol and li
  • dd and dt
  • q, blockquote, dfn
  • article, aside, section are considered like div

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:

  • MDN
  • W3Schools
  • OpenXml MSDN

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!

Issues· 8 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#docxdotnet-coreopenxmlopenxml-sdk

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言