Page 1 of 1

Ordered Lists - showing bullet

PostPosted: Fri Jun 30, 2017 8:48 am
by laurenquintanilla
We have some nested tables and in some cases the translation to Word loses the lettered list items. For example
<div><ol><li>Item1<div><table class="TableWithBorders"><tr><td><strong>ColHeader1</strong></td><td><strong>ColHeader2</strong></td></tr><tr><td>Row1</td><td><div><p>Row1Text</p><ul><li>bullet1</li></ul></div></td></tr><tr><td>Row2</td><td><div><p>Row2Text</p><div><table class="TableWithoutBorders"><tr><td><strong>Response</strong></td><td><strong>Action</strong></td></tr><tr><td>No</td><td><div><p>No info here.</p></div></td></tr><tr><td>Yes</td><td><div><ol style="list-style-type: lower-alpha"><li>ListItem1 should have letter.</li></ol></div></td></tr></table></div></div></td></tr></table></div></li></ol></div>

ListItem1 should have letter. shows up with just a bullet in word.

Any way I can force it to show the letter as indicated in the <ol style="list-style-type: lower-alpha"><li>ListItem1 should have letter

Re: Ordered Lists - showing bullet

PostPosted: Wed Jul 26, 2017 8:02 am
by laurenquintanilla
Hi. We are still losing list item info when using XHTMLImporter.convert( xhtml, null) when these items are in a nested table. For example, the HTML specifies <ol style="list-style-type: lower-alpha">, but the resulting items in word are just regular bullets. We are using latest docx4j-ImportXHTML-nightly-20170707.

Any suggestions on how to convert all the list items successfully in Word please?

Thanks!!!

Re: Ordered Lists - showing bullet

PostPosted: Thu Jul 27, 2017 12:30 pm
by jason
Simplifying your example, we have:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
<div>
        <ol>
                <li>Item1
                        <div>

                                <ul>
                                        <li>bullet1</li>
                                </ul>
                        </div>

                        <div>
                                <ol style="list-style-type: lower-alpha">
                                        <li>ListItem1 should have letter.</li>
                                </ol>
                        </div>

                </li>
        </ol>
</div>
 
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


The code treats this as a 2 level list, with the second level defined when the ul containing bullet1 is encountered.

So when ol style="list-style-type: lower-alpha" second level item is later encountered, the code ignores that, as we already have a definition for that level.

To address this edge case, the code would have to detect this (in ListHelper.addNumbering at line 402), and add a list level override for it.