Open
Description
Describe the Bug
When exporting HTML content to a Word document using the PHPWord library, there is an issue with the formatting of lists. The numbering of lists is not displaying correctly, and it appears to be continuous instead of restarting the numbering lists or follow the correct list hierarchy.
Steps to Reproduce
What i have:
- template document mytemplate.docx
- a custom template processor i found at: https://stackoverflow.com/questions/63756543/replace-html-tags-in-text-with-formatting-in-phpword#answers-header
My code goes:
$template = new HTMLTemplateProcessor($documentdir.'mytemplate.docx');
// Read content HTML into placeholders
// sample $content value..
<p> Bug Report:</p>
<p><span style="background-color: #ff0000;">BugTracker X</span> is facing an issue when converting HTML content to a Word document. The problem lies in the formatting of lists. The numbering of lists appears to be continuous instead of restarting for nested lists.</p>
<ol>
<li>Items in the first level of the list
<ol>
<li>Sub-item 1</li>
</ol>
</li>
<li> Another item at the first level</li>
<li>Yet another item at the first level
<ol>
<li>Sub-item 1</li>
<li>Sub-item 2</li>
</ol>
<p><span style="background-color: #ff0000;">BugTracker X</span> is facing an issue when converting HTML content to a Word document. The problem lies in the formatting of lists. The numbering of lists appears to be continuous instead of restarting for nested lists.</p>
$template->setHtmlBlockValue('content', "<br/>".$content."<br/>");
Expected Behavior
I expect the HTML to Word document conversion to produce a properly formatted list with correct numbering, especially for nested lists. Each level of the list should have its own numbering, and the numbering should restart appropriately for sub-lists.
Current Behavior

Context
- PHP Version: 8
- PHPWord Version: 1.2.0 (latest)