Penman.Html2OpenXml
2.4.0.4
dotnet add package Penman.Html2OpenXml --version 2.4.0.4
NuGet\Install-Package Penman.Html2OpenXml -Version 2.4.0.4
<PackageReference Include="Penman.Html2OpenXml" Version="2.4.0.4" />
paket add Penman.Html2OpenXml --version 2.4.0.4
#r "nuget: Penman.Html2OpenXml, 2.4.0.4"
// Install Penman.Html2OpenXml as a Cake Addin #addin nuget:?package=Penman.Html2OpenXml&version=2.4.0.4 // Install Penman.Html2OpenXml as a Cake Tool #tool nuget:?package=Penman.Html2OpenXml&version=2.4.0.4
What is Html2OpenXml?
Html2OpenXml 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 from SharePoint to Word.
This library supports both .Net Core (netstandard1.3) and .Net Framework 4.6.
Depends on DocumentFormat.OpenXml.
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>
- <table>, <td>, <tr>, <th>, <tbody>, <thead>, <tfoot> and <caption>
- <cite>
- <div>, <span>, <font> and <p>
- <pre>
- <sub> and <sup>
- <ul>, <ol> and <li>
- <dd> and <dt>
- <q> and <blockquote> (since 1.5)
- <article>, <aside>, <section> are considered like <div>
Javascript (<script>), CSS <style>, <meta> and other not supported tags does not generate an error but are ignored.
Tolerance for bad formed HTML
The parsing of the Html is done using a custom Regex-based enumerator. These are supported:
samples | |
---|---|
Ignore case | <span>Some text<SPAN> |
Missing closing tag or invalid tag position | <i>Here<b> is </i> some</b> bad formed html. |
no need to be XHTML compliant | Both <br> and <br/> are valid |
Color | red, #ff0000, #f00, rgb(255,0,0,.5), hsl(0, 100%, 50%) are all the red color |
Attributes | <table id=table1> or <table id="table1"> |
Acknowledgements
Thank you to all contributors that share their bug fixes: 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 If you have questions, don't hesitate to get in touch with me!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- DocumentFormat.OpenXml (>= 2.20.0)
- System.Diagnostics.TraceSource (>= 4.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.