onizet / 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.
MIT License
306 stars 107 forks source link

Add support for numbered headings #76

Closed DynaSpan closed 4 years ago

DynaSpan commented 4 years ago

I've added support for numbered headings + cleaned up the code a little.

It now supports headings starting with a number in the format [number]. [title] till 3 levels deep: [number].[number].[number]. [title]. It will automatically make these headings numbered (the specific numbers in the headings are ignored though).

Next to that I added a check for AbstractNums. If you call HtmlConverter multiple times on a Word document, it will add the AbstractNums to the doc every time. Now it will check if the AbstractNums we add are already defined, and if so, won't add them again.

P.S.: it's my first pull request ever, so if things aren't right let me know :)

DynaSpan commented 4 years ago

I've added commit 2f6930d as I found it otherwise won't properly close the list, which results in non-heading lists being indented and having wrong bullets/counters.

I've also messed with the commit history as I'm currently running my fork on a work project. You can basically ignore commit 0a9efd8.

If I need to cleanup the commit history, please let me know :)

onizet commented 4 years ago

Hello DynaSpan,

This is a very good work and I really appreciate it. I have 3 remarks:

Anyway, this is very good job !

DynaSpan commented 4 years ago

Hi Onizet,

Thanks for your feedback. I will close this PR and submit a new one.

I also saw some unnecessary code in my PR that I will refactor.