Skip to content

Commit cf81381

Browse files
aelliott-atlasProgi1984
authored andcommitted
PowerPoint2007 Reader : Fixed reading of RichText shape in Note
1 parent ad70328 commit cf81381

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

docs/changes/1.1.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
- PowerPoint2007 Writer : Fixed broken video file relationship - [@potofcoffee](https://github.com/potofcoffee) in [#776](https://github.com/PHPOffice/PHPPresentation/pull/776)
3131
- PowerPoint2007 Writer : Fixed issue when first element in series is null - [@ksmeeks0001](https://github.com/ksmeeks0001) in [#778](https://github.com/PHPOffice/PHPPresentation/pull/778)
3232
- PowerPoint2007 & ODPresentation Writer : Use of the disk caching directory for temporary files - [@nhalle](https://github.com/nhalle) in [#781](https://github.com/PHPOffice/PHPPresentation/pull/781)
33+
- PowerPoint2007 Reader : Fixed reading of RichText shape in Note - [@aelliott1485](https://github.com/aelliott1485) in [#782](https://github.com/PHPOffice/PHPPresentation/pull/782)
3334

3435
## Miscellaneous
3536

src/PhpPresentation/Reader/PowerPoint2007.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,10 @@ protected function loadShapeDrawing(XMLReader $document, DOMElement $node, Abstr
890890
$oSlide->addShape($oShape);
891891
}
892892

893-
protected function loadShapeRichText(XMLReader $document, DOMElement $node, AbstractSlide $oSlide): void
893+
/**
894+
* @param AbstractSlide|Note $oSlide
895+
*/
896+
protected function loadShapeRichText(XMLReader $document, DOMElement $node, $oSlide): void
894897
{
895898
if (!$document->elementExists('p:txBody/a:p/a:r', $node)) {
896899
return;
@@ -1386,11 +1389,15 @@ protected function loadSlideShapes($oSlide, DOMNodeList $oElements, XMLReader $x
13861389
}
13871390
switch ($oNode->tagName) {
13881391
case 'p:graphicFrame':
1389-
$this->loadShapeTable($xmlReader, $oNode, $oSlide);
1392+
if ($oSlide instanceof AbstractSlide) {
1393+
$this->loadShapeTable($xmlReader, $oNode, $oSlide);
1394+
}
13901395

13911396
break;
13921397
case 'p:pic':
1393-
$this->loadShapeDrawing($xmlReader, $oNode, $oSlide);
1398+
if ($oSlide instanceof AbstractSlide) {
1399+
$this->loadShapeDrawing($xmlReader, $oNode, $oSlide);
1400+
}
13941401

13951402
break;
13961403
case 'p:sp':

tests/PhpPresentation/Tests/Reader/PowerPoint2007Test.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,4 +643,12 @@ public function testLoadFileWithInvalidImages(): void
643643
self::assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation);
644644
self::assertEquals(1, $oPhpPresentation->getSlideCount());
645645
}
646+
647+
public function testLoadingFileWithNoteInSlide(): void
648+
{
649+
$file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/PPTX_SlideNoteWithRichText.pptx';
650+
$object = new PowerPoint2007();
651+
$oPhpPresentation = $object->load($file);
652+
$this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation);
653+
}
646654
}
Binary file not shown.

0 commit comments

Comments
 (0)