Forum


Replies: 11   Views: 2576
Handling of 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  · 23-08-2019 - 07:20

Hello,

We have run the image approach, and after closing the first li tag correctly:

$html = '
    <ul><li>Question 1</li></ul>
    <img src="image.png" style="height: 120px" />
    <ul><li>Question 2</li></ul>
    <img src="image.png" style="height: 120px" />
';
$docx->embedHTML($html);

The image is added fine after each list item.

Anyway, the easiest approaches to accomplish that task are:

  • Adding br tags out of each list item:
$html = '
    <ul>
        <li>Question 1</li>
        <br /><br /><br /><br />
        <li>Question 2</li>
        <br /><br /><br /><br />
    </ul>
';
$docx->embedHTML($html);
  • Using a CSS style:
$html = '
    <ul>
        <li style="margin-bottom: 100px;">Question 1</li>
        <li>Question 2</li>
    </ul>
';
$docx->embedHTML($html);

Or you can use a custom numbering style.

Regards.