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

Nested numbered list doesn't reset between lists on the same HTML #83

Closed caiotoptal closed 2 months ago

caiotoptal commented 3 years ago

I have this very simple HTML

  1. test 1
    1. test 2
      1. test 3
    2. test 4
  2. test 5

new paraghraph for testing

  1. another test 1
    1. another test 2
      1. another test 3
      2. another test 4
      3. another test 5
    2. another test 6
  2. another test 7
  3. another test 8

The nested list is getting continued as such:

image

Anyone has faced this issue and was able to solve it somehow?

SolarFlareSoftware commented 3 years ago

I am also experiencing this bug. I just started looking at the source code for this today. I will let you know if I find a solution. Have you found a fix since you posted this?

berthendrickx commented 2 months ago

I believe the bug is still present in the latest beta release:

This html produces the bug:

<ol style="list-style-type: decimal;">
<li>
  item one
  <ol style="list-style-type: lower-alpha;">
    <li>item a</li>
    <li>item b</li>
  </ol>
</li>
<li>item two</li>
</ol>

<br><br>

<ol style="list-style-type: decimal;">
<li>
  item one
  <ol style="list-style-type: lower-alpha;">
    <li>item a</li>
    <li>item b</li>
  </ol>
</li>
<li>item two</li>
</ol>

In the second nested list, items a and b get the prefix c and d..

onizet commented 2 months ago

it seems yes 😅 . The good news is that I worked on that bug since your message and I'm close to a solution!