-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Ordered Lists from HTML don't restart numbering #508
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
Comments
This issue persists. In addition it does not allow any html tags inside |
+1 |
1 similar comment
+1 |
seems like the issue still persists |
In my issue I've made new Class extends |
@pankamilr looking forward on it. As i need them urgently. |
@metallurgical I create a gist with it. Please take a look if you need it and let me know if its good for your |
@pankamilr this looks really promising! You made a lot of changes which makes it a bit hard to understand and test. It looks like your gist tackles quite a bunch of long lasting problems. |
I do not yet understand enough of the arcane magic of numbering in docx but I try to push a fix to this very old and obviously hard to tackle bug by providing a test. I read quite a lot in the numbering issues (like e.g. as far as I know never fixed #10 and #193) and I think at least I understood, that the numId of two HTML ordered lists that should not share a numbering must always be different. This is what is tested. Please correct me if I am wrong, maybe someone could guide me into some direction where and how to fix this. I am willing to try to do it, I just didn't manage to succeed. /**
* Tests parsing of ul/li
*/
public function testOrderedListNumbering()
{
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$html = '<ol>
<li>List 1 item 1</li>
<li>List 1 item 2</li>
</ol>
<p>Some Text</p>
<ol>
<li>List 2 item 1</li>
<li>List 2 item 2</li>
</ol>';
Html::addHtml($section, $html, false, false);
$doc = TestHelperDOCX::getDocument($phpWord, 'Word2007');
$this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:pPr/w:numPr/w:numId'));
$this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:t'));
$this->assertEquals('List 1 item 1', $doc->getElement('/w:document/w:body/w:p[1]/w:r/w:t')->nodeValue);
$this->assertEquals('List 2 item 1', $doc->getElement('/w:document/w:body/w:p[4]/w:r/w:t')->nodeValue);
$firstListnumId = $doc->getElementAttribute('/w:document/w:body/w:p[1]/w:pPr/w:numPr/w:numId', 'w:val');
$secondListnumId = $doc->getElementAttribute('/w:document/w:body/w:p[4]/w:pPr/w:numPr/w:numId', 'w:val');
$this->assertNotEquals($firstListnumId, $secondListnumId);
} |
fixed in develop (0.15.x) |
PDF Writer is not adding numbering used dompdf |
Have a loop which inserts html from a database. When a second ordered list is added (in a new section), the numbering does not restart. For example:
Might result in something like this:
Section Title
bla bla
New section title
text bla bla
3. list item
4. list item
I have to go into Word to manually set the starting number to 1.
I will see if I can dig into the code and find where this is set.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: