-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exported Word Document Content Issue with List (numbering) #2557
Comments
The sample code you supplied is missing one $html ='
<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</li>
<ol>
<li>Sub-item 1</li>
<li>Sub-item 2</li>
</ol>
</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>
';
$phpWord = new PhpWord();
$section = $phpWord->addSection();
Html::addHtml($section, $html, false, false);
$outputFile = 'word.2557.docx';
$phpWord->save($outputFile); |
Hi, @oleibman, @marievyyy I have the same problem. The strange thing is that if you put 2 numbered lists in 1 same variable, the numbering is respected, but when you change the variable and print another html list (with different numbering), the numbering is inherited from the first list that was printed. I have tried many ways and none of them work like: adding a starts in 'ol' tags, adding page breaks in template, adding the element as a setValue and setComplexBlock via a Table() or Section() object, parsing the html content with another library using HTMLtoOpenXML\Parser() from rkorebrits/htmltoopenxml, and of course using the Shared\Html::addHtml(), and nothing works. Thanks! |
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:
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.
![Screen Shot 2024-01-25 at 2 41 21 PM](https://private-user-images.githubusercontent.com/25134135/299815167-ac34c599-2e9b-4ce0-9987-1ba542eba3fa.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE3NjkwNDUsIm5iZiI6MTcyMTc2ODc0NSwicGF0aCI6Ii8yNTEzNDEzNS8yOTk4MTUxNjctYWMzNGM1OTktMmU5Yi00Y2UwLTk5ODctMWJhNTQyZWJhM2ZhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzIzVDIxMDU0NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTk2ZmMyMDc3MjZiNTIyOTBkOTE1ZjAyNjUxNzNmMjE4NTUzZWE0YjUyODhkMzQwYzQ3YmFkYzE0MTk1YWNhMzAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.JoLBgY5lHfGosM_S1DWvvWyxjrWTOHdlGF8EoI2_XFA)
Current Behavior
Context
The text was updated successfully, but these errors were encountered: