Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PowerPoint2007 Reader : Fixed reading of RichText shape in Note #782

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changes/1.1.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
- PowerPoint2007 Writer : Fixed broken video file relationship - [@potofcoffee](https://github.com/potofcoffee) in [#776](https://github.com/PHPOffice/PHPPresentation/pull/776)
- 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)
- 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)
- PowerPoint2007 Reader : Fixed reading of RichText shape in Note - [@aelliott1485](https://github.com/aelliott1485) in [#782](https://github.com/PHPOffice/PHPPresentation/pull/782)

## Miscellaneous

Expand Down
13 changes: 10 additions & 3 deletions src/PhpPresentation/Reader/PowerPoint2007.php
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,10 @@ protected function loadShapeDrawing(XMLReader $document, DOMElement $node, Abstr
$oSlide->addShape($oShape);
}

protected function loadShapeRichText(XMLReader $document, DOMElement $node, AbstractSlide $oSlide): void
/**
* @param AbstractSlide|Note $oSlide
*/
protected function loadShapeRichText(XMLReader $document, DOMElement $node, $oSlide): void
{
if (!$document->elementExists('p:txBody/a:p/a:r', $node)) {
return;
Expand Down Expand Up @@ -1386,11 +1389,15 @@ protected function loadSlideShapes($oSlide, DOMNodeList $oElements, XMLReader $x
}
switch ($oNode->tagName) {
case 'p:graphicFrame':
$this->loadShapeTable($xmlReader, $oNode, $oSlide);
if ($oSlide instanceof AbstractSlide) {
$this->loadShapeTable($xmlReader, $oNode, $oSlide);
}

break;
case 'p:pic':
$this->loadShapeDrawing($xmlReader, $oNode, $oSlide);
if ($oSlide instanceof AbstractSlide) {
$this->loadShapeDrawing($xmlReader, $oNode, $oSlide);
}

break;
case 'p:sp':
Expand Down
8 changes: 8 additions & 0 deletions tests/PhpPresentation/Tests/Reader/PowerPoint2007Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -643,4 +643,12 @@ public function testLoadFileWithInvalidImages(): void
self::assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation);
self::assertEquals(1, $oPhpPresentation->getSlideCount());
}

public function testLoadingFileWithNoteInSlide(): void
{
$file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/PPTX_SlideNoteWithRichText.pptx';
$object = new PowerPoint2007();
$oPhpPresentation = $object->load($file);
self::assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation);
}
}
Binary file not shown.
Loading