Forum


Replies: 1   Views: 1990
Styling <ul> 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 admin  · 22-10-2019 - 08:11

Hello,

MS Word style can be applied to HTML lists setting the customListStyles option as true. On https://www.phpdocx.com/documentation/introduction/html-to-word-PHP you can find the following sample:

$latinListOptions = array();
$latinListOptions[0]['type'] = 'lowerLetter';
$latinListOptions[0]['format'] = '%1.';
$latinListOptions[1]['type'] = 'lowerRoman';
$latinListOptions[1]['format'] = '%1.%2.';
$docx->createListStyle('latin', $latinListOptions);

$html = '<ul class="latin">
    <li>First item.</li>
    <li>Second item with subitems:
        <ul>
            <li>First subitem.</li>
            <li>Second subitem.</li>
        </ul>
    </li>
    <li>Third subitem.</li>
</ul>';
$docx->embedHTML($html, array('customListStyles' => true));

Note that lists always include a numbering style and can also have a paragraph style; both styles can be applied to the same list. DOCXCustomizer can be very useful for this tasks, and the parseStyles method returns the information about existing styles, maybe you are not applying the correct style name/id.

As this is a very specific task, we recommend you to open a ticket (https://www.phpdocx.com/support) and attach your template. The dev team can generate a custom sample using your template.

Regards.