diff --git a/docs/changes/1.2.0.md b/docs/changes/1.2.0.md index b1f048265..daf2ed594 100644 --- a/docs/changes/1.2.0.md +++ b/docs/changes/1.2.0.md @@ -8,6 +8,8 @@ ## Bug fixes +- Word2007 Reader: Fixed cast of spacing fixing [#729](https://github.com/PHPOffice/PHPPresentation/pull/729), [#796](https://github.com/PHPOffice/PHPPresentation/pull/796) in [#818](https://github.com/PHPOffice/PHPPresentation/pull/818) + ## Miscellaneous ## BC Breaks diff --git a/src/PhpPresentation/Reader/PowerPoint2007.php b/src/PhpPresentation/Reader/PowerPoint2007.php index 140c2f4a5..939f1c4ba 100644 --- a/src/PhpPresentation/Reader/PowerPoint2007.php +++ b/src/PhpPresentation/Reader/PowerPoint2007.php @@ -1205,20 +1205,20 @@ protected function loadParagraph(XMLReader $document, DOMElement $oElement, $oSh $oElementLineSpacingPoints = $document->getElement('a:lnSpc/a:spcPts', $oSubElement); if ($oElementLineSpacingPoints instanceof DOMElement) { $oParagraph->setLineSpacingMode(Paragraph::LINE_SPACING_MODE_POINT); - $oParagraph->setLineSpacing((int) $oElementLineSpacingPoints->getAttribute('val') / 100); + $oParagraph->setLineSpacing((int) ((int) $oElementLineSpacingPoints->getAttribute('val') / 100)); } $oElementLineSpacingPercent = $document->getElement('a:lnSpc/a:spcPct', $oSubElement); if ($oElementLineSpacingPercent instanceof DOMElement) { $oParagraph->setLineSpacingMode(Paragraph::LINE_SPACING_MODE_PERCENT); - $oParagraph->setLineSpacing((int) $oElementLineSpacingPercent->getAttribute('val') / 1000); + $oParagraph->setLineSpacing((int) ((int) $oElementLineSpacingPercent->getAttribute('val') / 1000)); } $oElementSpacingBefore = $document->getElement('a:spcBef/a:spcPts', $oSubElement); if ($oElementSpacingBefore instanceof DOMElement) { - $oParagraph->setSpacingBefore((int) $oElementSpacingBefore->getAttribute('val') / 100); + $oParagraph->setSpacingBefore((int) ((int) $oElementSpacingBefore->getAttribute('val') / 100)); } $oElementSpacingAfter = $document->getElement('a:spcAft/a:spcPts', $oSubElement); if ($oElementSpacingAfter instanceof DOMElement) { - $oParagraph->setSpacingAfter((int) $oElementSpacingAfter->getAttribute('val') / 100); + $oParagraph->setSpacingAfter((int) ((int) $oElementSpacingAfter->getAttribute('val') / 100)); } $oParagraph->getBulletStyle()->setBulletType(Bullet::TYPE_NONE); diff --git a/src/PhpPresentation/Shape/RichText/Paragraph.php b/src/PhpPresentation/Shape/RichText/Paragraph.php index 2eb173a62..bbd2e2dcb 100644 --- a/src/PhpPresentation/Shape/RichText/Paragraph.php +++ b/src/PhpPresentation/Shape/RichText/Paragraph.php @@ -317,10 +317,8 @@ public function getLineSpacing(): int /** * Value in points. - * - * @param int $lineSpacing */ - public function setLineSpacing($lineSpacing): self + public function setLineSpacing(int $lineSpacing): self { $this->lineSpacing = $lineSpacing;