Closed onizet closed 2 months ago
Hi Paul,
After your message, I take a fresh look on the code. I wrote this code so many years ago and I don't remember exactly the reason 😞
The fact that it's the half (or roughly) makes me think that due to level not starting at 0 but 1, the snippet avoids a special condition for the 1st level which mustn't have an indentation.
I did a try with:
prop.Indentation = level < 2? null : new Indentation() { Left = (level * 780).ToString(CultureInfo.InvariantCulture) }
and this seems ok. Note, since latest commit, I now push missing styles... including ListParagraph. So this ease also the Indentation (so to respond to your question, yes the style can also influence the indentation). I drop Hanging property which doesn't seem necessary.
I have committed that version. Feel free to come back if you found a better test case that fails. Thanks!
De : Paul Bentley notifications@github.com Envoyé : jeudi 4 janvier 2018 16:17:20 À : onizet/html2openxml Cc : Olivier Nizet; Mention Objet : Re: [onizet/html2openxml] Nested List Numbering Not Working (#11)
Hi @onizethttps://github.com/onizet,
Related to this - I notice that lists don't have an initial indent as they would if created in Word directly.
I just wondered if this was by design?
You have Hanging = "357", Left = (level 357) - in Word directly this would be Hanging = "360", Left = (level 720) to give an initial indentation from level 1.
Unless there is another way to have the initial indentation?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/onizet/html2openxml/issues/11#issuecomment-355308334, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AGZInEippJT_14wVqkK44witLZ43iSSFks5tHOuAgaJpZM4QBUY7.
I face some issues when converting such a nested numbered list. `
<li>
Issue 2 solutions
<ol start="3" style="list-style-type: lower-roman;">
<li>Solution X</li>
<li>Solution XX</li>
<li>Solution asdf</li>
</ol>
</li>
<li>
Issue 3 solutions
<ol start="6" style="list-style-type: lower-roman;">
<li>some solution</li>
</ol>
</li>
</ol>`
Issues:
I found some bugs on leveling, but I couldn't resolve it. How to keep level styles and numbering according to "start" attribute?
Thanks Baur
Hello Baur,
I'm afraid that the start
attribute is not supported but any PR is welcome :-)
In BeginList, you can see that I force the list to restart to 1 (StartOverrideNumberingValue). You can additionally check for the existence of the start attribute and acts accordingly. https://github.com/onizet/html2openxml/blob/f227f35f4f91b089855ceec7ddbd9e3fbe388883/src/Html2OpenXml/Collections/NumberingListStyleCollection.cs#L209
This is now supported in v3. Thanks for having shared with me this attribute.
[copied from codeplex]
I am currently trying to convert an HTML with ordered lists that is like this:
When in the browser it numbers correctly for order list under "Request the following information, per device". However when converted, it puts all child items in the order list as just a bullet. I have removed the sub child items that had the unique styling, and this did not have any effect. Has anyone else seen this? Is there a solution as to how to get order lists to use numbering when converted in a nested list?
Thanks James