Skip to content

Commit

Permalink
Word2007 Reader: Fixed cast of spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
Progi1984 committed Sep 5, 2024
1 parent dc13e4c commit 55f36ff
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 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) ($oElementLineSpacingPoints->getAttribute('val') / 100));

Check failure on line 1208 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (8.2)

Binary operation "/" between string and 100 results in an error.

Check failure on line 1208 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (8.3)

Binary operation "/" between string and 100 results in an error.

Check failure on line 1208 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (7.4)

Binary operation "/" between string and 100 results in an error.

Check failure on line 1208 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (7.3)

Binary operation "/" between string and 100 results in an error.

Check failure on line 1208 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (8.0)

Binary operation "/" between string and 100 results in an error.

Check failure on line 1208 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (8.1)

Binary operation "/" between string and 100 results in an error.

Check failure on line 1208 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (7.2)

Binary operation "/" between string and 100 results in an error.

Check failure on line 1208 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (7.1)

Binary operation "/" between string and 100 results in an error.
}
$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) ($oElementLineSpacingPercent->getAttribute('val') / 1000));

Check failure on line 1213 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (8.2)

Binary operation "/" between string and 1000 results in an error.

Check failure on line 1213 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (8.3)

Binary operation "/" between string and 1000 results in an error.

Check failure on line 1213 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (7.4)

Binary operation "/" between string and 1000 results in an error.

Check failure on line 1213 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (7.3)

Binary operation "/" between string and 1000 results in an error.

Check failure on line 1213 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (8.0)

Binary operation "/" between string and 1000 results in an error.

Check failure on line 1213 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (8.1)

Binary operation "/" between string and 1000 results in an error.

Check failure on line 1213 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (7.2)

Binary operation "/" between string and 1000 results in an error.

Check failure on line 1213 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (7.1)

Binary operation "/" between string and 1000 results in an error.
}
$oElementSpacingBefore = $document->getElement('a:spcBef/a:spcPts', $oSubElement);
if ($oElementSpacingBefore instanceof DOMElement) {
$oParagraph->setSpacingBefore((int) $oElementSpacingBefore->getAttribute('val') / 100);
$oParagraph->setSpacingBefore((int) ($oElementSpacingBefore->getAttribute('val') / 100));

Check failure on line 1217 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (8.2)

Binary operation "/" between string and 100 results in an error.

Check failure on line 1217 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (8.3)

Binary operation "/" between string and 100 results in an error.

Check failure on line 1217 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (7.4)

Binary operation "/" between string and 100 results in an error.

Check failure on line 1217 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (7.3)

Binary operation "/" between string and 100 results in an error.

Check failure on line 1217 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (8.0)

Binary operation "/" between string and 100 results in an error.

Check failure on line 1217 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (8.1)

Binary operation "/" between string and 100 results in an error.

Check failure on line 1217 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (7.2)

Binary operation "/" between string and 100 results in an error.

Check failure on line 1217 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (7.1)

Binary operation "/" between string and 100 results in an error.
}
$oElementSpacingAfter = $document->getElement('a:spcAft/a:spcPts', $oSubElement);
if ($oElementSpacingAfter instanceof DOMElement) {
$oParagraph->setSpacingAfter((int) $oElementSpacingAfter->getAttribute('val') / 100);
$oParagraph->setSpacingAfter((int) ($oElementSpacingAfter->getAttribute('val') / 100));

Check failure on line 1221 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (8.2)

Binary operation "/" between string and 100 results in an error.

Check failure on line 1221 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (8.3)

Binary operation "/" between string and 100 results in an error.

Check failure on line 1221 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (7.4)

Binary operation "/" between string and 100 results in an error.

Check failure on line 1221 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (7.3)

Binary operation "/" between string and 100 results in an error.

Check failure on line 1221 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (8.0)

Binary operation "/" between string and 100 results in an error.

Check failure on line 1221 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (8.1)

Binary operation "/" between string and 100 results in an error.

Check failure on line 1221 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (7.2)

Binary operation "/" between string and 100 results in an error.

Check failure on line 1221 in src/PhpPresentation/Reader/PowerPoint2007.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis (7.1)

Binary operation "/" between string and 100 results in an error.
}

$oParagraph->getBulletStyle()->setBulletType(Bullet::TYPE_NONE);
Expand Down
2 changes: 1 addition & 1 deletion src/PhpPresentation/Shape/RichText/Paragraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ public function getLineSpacing(): int
*
* @param int $lineSpacing
*/
public function setLineSpacing($lineSpacing): self
public function setLineSpacing(int $lineSpacing): self
{
$this->lineSpacing = $lineSpacing;

Expand Down

0 comments on commit 55f36ff

Please sign in to comment.