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 #81

Closed CharlMeyers closed 2 months ago

CharlMeyers commented 3 years ago

Good day.

I am trying to add numbered list so that each nested list number has a "sub number". In other words I am trying to achieve the following:

  1. Main item 1.1 Nested item 1.2 Nested item
  2. Main item
  3. Main item 3.1 Nested item

I see that it is possible to do with css using the following styling rules:

ol {
  counter-reset: item
}
li {
  display: block
}
li:before {
  content: counters(item, ".") " ";
  counter-increment: item
}

But in order for this to work I need to specify it in a separate style tag, which I see is being ignored. Is there another way I can achieve this?

onizet commented 4 months ago

Unfortunately, there is no W3C standard to define that format. In v3, you will be able to use decimal-tiered.

<ol style="list-style-type:decimal-tiered">
      <li>Item 1
           <ol><li>Item 1.1</li></ol>
       </li>
      <li>Item 2</li>
</ol>