Forum


Replies: 3   Views: 2002
How to get nested numeric lists?
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by rapidtech  · 26-11-2019 - 14:05

I have the following HTML code

$docx = new CreateDocx();
$html = '
            <style>
                ol.decimal {
                        counter-reset: item;
                }
                
                ol.decimal li {
                        display: block;
                        position: relative;
                }
                
                ol.decimal li:before {
                        content: counters(item, ".")".";
                        counter-increment: item;
                        position: absolute;
                        margin-right: 100%;
                        right: 10px;
                }
            </style>
            <ol class="decimal">
                <li>Item</li>
                <li>Item</li>
                <li>Item</li>
                <li>Item
                    <ol class="decimal">
                        <li>Item</li>
                        <li>Item</li>
                        <li>Item</li>
                        <li>Item
                            <ol class="decimal">
                                <li>Item</li>
                                <li>Item</li>
                                <li>Item</li>
                                <li>Item</li>
                            </ol>
                        </li>
                    </ol>
                </li>
            </ol>';
$docx->embedHTML($html);
$docx->createDocx('output');

Which should give me in a result

1. Item

2. Item

2. Item

4. Item

    4.1 Item

    4.2 Item

    4.3 Item

    4.4 Item

        4.4.1 Item

        4.4.2 Item

        4.4.3 Item

        4.4.4 Item

But instead of this, I am getting simple numeric lists. I guess that 'counter-increment' is not supported. Please, advise me on how to achieve the necessary look?