Replies: 1   Views: 939
Html styling for paragraph within a list
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 vpratfr  · 06-07-2020 - 18:05


I cannot seem to be able to indent properly nested content located within a list item

This is the HTML code:

        <p>Some content</p>

« Something » is properly indented with the bullet

However « Some content » is not indented at all: it gets aligned to the left of the page.

Same goes with tables.

I have a PDF rendered for that same HTML based on DomPDF which properly indents everything.

Which trick can be applied to get everything indented at the same level as the list text ? (some of our bullet lists do not just contain Ps, they can also feature tables)


PS: using advanced license

Posted by admin  · 06-07-2020 - 18:25


phpdocx doesn't allow adding p or other block contents to list items (this limitation comes from the OOXML standard, that doesn't allow adding a w:p tag in a w:p tag, DOCX handles list as paragraphs but with an extra style). You need to remove block contents when working with lists, only inline items are allowed:

        Something<br/>Some content

Also note that MS Word neither allow adding some content types in lists. You can apply indent values to paragraph and other contents such as tables if needed to get the same indentation.