Skip to content

Conversation

@waltertamboer
Copy link
Contributor

Description

This commit fixes issue #1529

This commit prevents nested w:pPr elements when using a ListItemRun with
a paragraph style. The different between a ListItem and a ListItem run
is that the setWithoutPPR method is called on the ParagraphStyleWriter
(PhpOffice\PhpWord\Writer\Word2007\Style\Paragraph).

According to the specs it's not allowed to have nested w:pPr elements.
See http://www.datypic.com/sc/ooxml/e-w_pPr-2.html

Checklist:

  • I have run composer run-script check --timeout=0 and no errors were reported
  • The new code is covered by unit tests (check build/coverage for coverage report)
  • I have updated the documentation to describe the changes

This commit fixes issue #1529

This commit prevents nested w:pPr elements when using a ListItemRun with
a paragraph style. The different between a ListItem and a ListItem run
is that the setWithoutPPR method is called on the ParagraphStyleWriter
(PhpOffice\PhpWord\Writer\Word2007\Style\Paragraph).

According to the specs it's not allowed to have nested w:pPr elements.
See http://www.datypic.com/sc/ooxml/e-w_pPr-2.html

$styleWriter = new ParagraphStyleWriter($xmlWriter, $element->getParagraphStyle());
$styleWriter->setIsInline(true);
$styleWriter->setWithoutPPR(true);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The magic.

@waltertamboer
Copy link
Contributor Author

I've also created smaller methods to make the code a bit more easy to follow.

@coveralls
Copy link

coveralls commented May 9, 2019

Coverage Status

Coverage increased (+0.003%) to 94.633% when pulling 3c6a1a1 on waltertamboer:feature/fix-issue-1529 into fe531ca on PHPOffice:develop.

@troosan troosan added this to the v0.17.0 milestone Jun 13, 2019
@troosan troosan merged commit 815bb52 into PHPOffice:develop Aug 8, 2019
@waltertamboer waltertamboer deleted the feature/fix-issue-1529 branch September 28, 2021 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants