We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Adding two comments to the same text object only shows one in Word.
<?php require __DIR__ . '/vendor/autoload.php'; $phpWord = new \PhpOffice\PhpWord\PhpWord(); $section = $phpWord->addSection(); $comment1 = new \PhpOffice\PhpWord\Element\Comment('Author', new \DateTime()); $comment1->addText('Comment1'); $phpWord->addComment($comment1); $comment2 = new \PhpOffice\PhpWord\Element\Comment('Author', new \DateTime()); $comment2->addText('Comment2'); $phpWord->addComment($comment2); $start = $section->addText('Hello'); $start->setCommentRangeStart($comment1); $start->setCommentRangeStart($comment2); $writer = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord); $writer->save(__DIR__ . '/out.docx');
The generated xml has no id for the first comment and only references the second one, weirdly Word shows the first one.
comments.xml
<w:comment w:id="" w:author="Author" w:date="2021-06-28T12:51:44-03:00"> <w:p> <w:pPr/> <w:r> <w:rPr/> <w:t xml:space="preserve">Comment1</w:t> </w:r> </w:p> </w:comment> <w:comment w:id="2f939d" w:author="Author" w:date="2021-06-28T12:51:44-03:00"> <w:p> <w:pPr/> <w:r> <w:rPr/> <w:t xml:space="preserve">Comment2</w:t> </w:r> </w:p> </w:comment> </w:comments>
document.xml
<w:p> <w:pPr/> <w:commentRangeStart w:id="2f939d"/> <w:r> <w:rPr/> <w:t xml:space="preserve">Hola</w:t> </w:r> <w:commentRangeEnd w:id="2f939d"/> <w:r> <w:commentReference w:id="2f939d"/> </w:r> </w:p>
Show both comments.
Something like this on document.xml
<w:p> <w:pPr/> <w:commentRangeStart w:id="[id comment1]"/> <w:commentRangeStart w:id="[id comment2]"/> <w:r> <w:rPr/> <w:t xml:space="preserve">Hola</w:t> </w:r> <w:commentRangeEnd w:id="[id comment1]"/> <w:r> <w:commentReference w:id="[[id comment1]"/> </w:r> <w:commentRangeEnd w:id="[id comment2]"/> <w:r> <w:commentReference w:id="[[id comment2]"/> </w:r> </w:p>
Shows only one comment (Comment1).
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Describe the Bug
Adding two comments to the same text object only shows one in Word.
Steps to Reproduce
The generated xml has no id for the first comment and only references the second one, weirdly Word shows the first one.
comments.xml
document.xml
Expected Behavior
Show both comments.
Something like this on document.xml
Current Behavior
Shows only one comment (Comment1).
Context
The text was updated successfully, but these errors were encountered: