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 into templated Word.
MIT License
334 stars 113 forks source link

Nested lists - bug in numbering #176

Open lofcz opened 2 weeks ago

lofcz commented 2 weeks ago

Describe the bug If there is a ol nested in a ul's li, the first marker is incorrectly swapped.

Repro

<ul>
  <li>
    <h3>Text1</h3>
    <ol>
      <li>Text2</li>
    </ol>
    <ul>
      <li>Text3</li>
    </ul>
    <ol start="2">
      <li>Text4</li>
    </ol>
    <ul>
      <li>Text5</li>
      <li>Text6</li>
    </ul>
    <ol start="3">
      <li>Text7</li>
    </ol>
  </li>
</ul>

Should be: image

Currently renders as: image

Also, are nested lists of level 3+ not supported? Converting the same document with Pandoc handles them correctly: image

onizet commented 5 days ago

Hi I was looking at your issue and would like to suggest you to set 2 options: converter.ContinueNumbering = false

and for the heading, I'm not sure what you would really expect (just the style applied or having numbered heading?) but you can try also with converter.SupportsHeadingNumbering = false (sorry this is not yet published to a proper nuget package, still working on this release).

Let me know if that sounds okay to you.