Forum


Replies: 1   Views: 966
Left margin/padding of ol and 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  · 17-05-2022 - 05:45

Hello,

To set left margins to list items when importing HTML a custom list style must be used:

$myListStyle = array();
$myListStyle[0]['left'] = 900;
$docx->createListStyle('myliststyle', $myListStyle);

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

Changing left margins of list items isn't supported applying CSS styles. Paragraphs and other elements support setting custom margins using CSS styles.

Regards.