Skip to content

Commit 9b3ee48

Browse files
committed
Word2007 Reader: Fixed cast of spacing
1 parent dc13e4c commit 9b3ee48

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

docs/changes/1.2.0.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
## Bug fixes
1010

11+
- 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)
12+
1113
## Miscellaneous
1214

1315
## BC Breaks

src/PhpPresentation/Reader/PowerPoint2007.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,20 +1205,20 @@ protected function loadParagraph(XMLReader $document, DOMElement $oElement, $oSh
12051205
$oElementLineSpacingPoints = $document->getElement('a:lnSpc/a:spcPts', $oSubElement);
12061206
if ($oElementLineSpacingPoints instanceof DOMElement) {
12071207
$oParagraph->setLineSpacingMode(Paragraph::LINE_SPACING_MODE_POINT);
1208-
$oParagraph->setLineSpacing((int) $oElementLineSpacingPoints->getAttribute('val') / 100);
1208+
$oParagraph->setLineSpacing((int) ((int) $oElementLineSpacingPoints->getAttribute('val') / 100));
12091209
}
12101210
$oElementLineSpacingPercent = $document->getElement('a:lnSpc/a:spcPct', $oSubElement);
12111211
if ($oElementLineSpacingPercent instanceof DOMElement) {
12121212
$oParagraph->setLineSpacingMode(Paragraph::LINE_SPACING_MODE_PERCENT);
1213-
$oParagraph->setLineSpacing((int) $oElementLineSpacingPercent->getAttribute('val') / 1000);
1213+
$oParagraph->setLineSpacing((int) ((int) $oElementLineSpacingPercent->getAttribute('val') / 1000));
12141214
}
12151215
$oElementSpacingBefore = $document->getElement('a:spcBef/a:spcPts', $oSubElement);
12161216
if ($oElementSpacingBefore instanceof DOMElement) {
1217-
$oParagraph->setSpacingBefore((int) $oElementSpacingBefore->getAttribute('val') / 100);
1217+
$oParagraph->setSpacingBefore((int) ((int) $oElementSpacingBefore->getAttribute('val') / 100));
12181218
}
12191219
$oElementSpacingAfter = $document->getElement('a:spcAft/a:spcPts', $oSubElement);
12201220
if ($oElementSpacingAfter instanceof DOMElement) {
1221-
$oParagraph->setSpacingAfter((int) $oElementSpacingAfter->getAttribute('val') / 100);
1221+
$oParagraph->setSpacingAfter((int) ((int) $oElementSpacingAfter->getAttribute('val') / 100));
12221222
}
12231223

12241224
$oParagraph->getBulletStyle()->setBulletType(Bullet::TYPE_NONE);

src/PhpPresentation/Shape/RichText/Paragraph.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ public function getLineSpacing(): int
320320
*
321321
* @param int $lineSpacing
322322
*/
323-
public function setLineSpacing($lineSpacing): self
323+
public function setLineSpacing(int $lineSpacing): self
324324
{
325325
$this->lineSpacing = $lineSpacing;
326326

0 commit comments

Comments
 (0)