Forum


Replies: 2   Views: 2764
Line spacing when inserting a list of html using a template
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 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

Hello,

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

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

Regards.

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.