Forum


Replies: 4   Views: 2195
Sub-ol list style issue
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 admin  · 13-02-2019 - 08:06

Hello,

Thanks for sending the information about your license.

About your question, we have tested it and it's working perfectly. If we run the following code (it's very similar to one of the included samples in the package):

require_once 'classes/CreateDocx.php';

$docx = new CreateDocx();

$html = '
<style>
ol.c {list-style-type: upper-roman;}
ol.d {list-style-type: decimal;}
</style>
</head>
<body>
    <ol class="c">
        <li>Item 1</li>
        <li>Item 2</li>
        <li>Item 3</li>
        <li>Other items:
            <ol class="d">
                <li>Item 3.A</li>
                <li>Item 3.B</li>
                <li>Item 3.C</li>
            </ol>
        </li>
        <li>Item 4</li>
    </ol>
</body>
';
$docx->embedHTML($html);

$docx->createDocx('output');

And the list and its sublist are correct opening it with MS Word 2007 to MS Word 2016, LibreOffice 5 , LibreOffice 6 and other DOCX readers. Please run this code standalone with your license of phpdocx 8.5.

You can also use custom list styles. On https://www.phpdocx.com/documentation/introduction/html-to-word-PHP (List section) you can see a sample about how to use MS Word numbering styles to style HTML lists.

Regards.