Skip to content

Commit

Permalink
Word2007 Reader: Fixed cast of spacing (#818)
Browse files Browse the repository at this point in the history
  • Loading branch information
Progi1984 authored Sep 5, 2024
1 parent dc13e4c commit 8b75773
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 2 additions & 0 deletions docs/changes/1.2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions src/PhpPresentation/Reader/PowerPoint2007.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 1 addition & 3 deletions src/PhpPresentation/Shape/RichText/Paragraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 8b75773

Please sign in to comment.