Replies: 2   Views: 161
Line spacing when inserting a list of html using a template

Posted by neu_katayama  · 17-06-2019 - 02:38

Implements a function to insert HTML list (ol, li) into template word file.

At that time, where should I set the paragraph height of the list?

I can not find the place to set.

$ docx-> createListStyle ('customList', $ ListOpt);

Also, even if the setting is made with HTML CSS (line-height: 1.5em), it will not be reflected as "Line spacing> Multiple".


Please let me know the implementation method.

Posted by admin  · 17-06-2019 - 07:27


Setting a custom list style and CSS line-height style, spacing value is set. For example, running the following script:

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

$html = '
    li {
        line-height: 2em;
<ul class="latin">
    <li>Item A</li>
    <li>Item B</li>
    <li>Item C</li>
$docx->embedHTML($html, array('customListStyles' => true));

All list items have Line spacing as Multiple and 1,67 as value.


Posted by neu_katayama  · 19-07-2019 - 07:23

It was realized by changing the setting of the number of lines of page setup of MSword of the template.