Forum


Replies: 4   Views: 2360
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 slavkovl  · 11-02-2019 - 17:07

I have a <ol> list with a  {list-style-type: upper-roman} . Inside of it is another <ol> list wich is decimal by default. But after converting HTML to DOCX this inner <ol> list becomes "upper-alpha". I was trying to set a class for the inner <ol> with a style="list-style-type: decimal" but it doesn't work.

Posted by admin  · 11-02-2019 - 18:08

Hello,

What license and version of phpdocx are you using?

Regards.

Posted by slavkovl  · 12-02-2019 - 17:38

Basic License, phpDocx 8.5

Posted by admin  · 12-02-2019 - 17:59

Hello,

Your username doesn't have any license tied. Please send to contact[at]phpdocx.com the username or e-mail of the user that has purchased the license.

Regards.

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.