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

Notes in pptx gives error on reader #751

Open
Offbeatmammal opened this issue Aug 14, 2023 · 2 comments
Open

Notes in pptx gives error on reader #751

Offbeatmammal opened this issue Aug 14, 2023 · 2 comments

Comments

@Offbeatmammal
Copy link

if I have an Office365 edited PPTX with no notes, I am able to open and enumerate the slides with no issue.
if however I have notes on the slides I get the error below.

Able to repro using the sample_12.pptx from here (before works fine, add a simple letter to the Notes on slide1 and it breaks. removing the Note doesn't help).

require_once 'vendor/autoload.php';
use PhpOffice\PhpPresentation\IOFactory;

$oReader = \PhpOffice\PhpPresentation\IOFactory::createReader('PowerPoint2007');
$oPresentation04 = $oReader->load('Sample_12.pptx');

Fatal error: Uncaught TypeError: PhpOffice\PhpPresentation\Reader\PowerPoint2007::loadShapeRichText(): Argument #3 ($oSlide) must be of type PhpOffice\PhpPresentation\Slide\AbstractSlide, PhpOffice\PhpPresentation\Slide\Note given, called in C:\AP-Web\engine-word\vendor\phpoffice\phppresentation\src\PhpPresentation\Reader\PowerPoint2007.php on line 1375 and defined in C:\AP-Web\engine-word\vendor\phpoffice\phppresentation\src\PhpPresentation\Reader\PowerPoint2007.php:888
Stack trace:
#0 C:\AP-Web\engine-word\vendor\phpoffice\phppresentation\src\PhpPresentation\Reader\PowerPoint2007.php(1375): PhpOffice\PhpPresentation\Reader\PowerPoint2007->loadShapeRichText(Object(PhpOffice\Common\XMLReader), Object(DOMElement), Object(PhpOffice\PhpPresentation\Slide\Note))
#1 C:\AP-Web\engine-word\vendor\phpoffice\phppresentation\src\PhpPresentation\Reader\PowerPoint2007.php(755): PhpOffice\PhpPresentation\Reader\PowerPoint2007->loadSlideShapes(Object(PhpOffice\PhpPresentation\Slide\Note), Object(DOMNodeList), Object(PhpOffice\Common\XMLReader))
#2 C:\AP-Web\engine-word\vendor\phpoffice\phppresentation\src\PhpPresentation\Reader\PowerPoint2007.php(369): PhpOffice\PhpPresentation\Reader\PowerPoint2007->loadSlideNote('notesSlide1.xml', Object(PhpOffice\PhpPresentation\Slide))
#3 C:\AP-Web\engine-word\vendor\phpoffice\phppresentation\src\PhpPresentation\Reader\PowerPoint2007.php(169): PhpOffice\PhpPresentation\Reader\PowerPoint2007->loadSlides('<?xml version="...')
#4 C:\AP-Web\engine-word\vendor\phpoffice\phppresentation\src\PhpPresentation\Reader\PowerPoint2007.php(136): PhpOffice\PhpPresentation\Reader\PowerPoint2007->loadFile('Sample_12.pptx')
#5 C:\AP-Web\engine-word\pptx_read.php(6): PhpOffice\PhpPresentation\Reader\PowerPoint2007->load('Sample_12.pptx')
#6 {main}
thrown in C:\AP-Web\engine-word\vendor\phpoffice\phppresentation\src\PhpPresentation\Reader\PowerPoint2007.php on line 888

@Offbeatmammal
Copy link
Author

looks like this might be a dupe of #710 - are there any plans to pull the suggested fix?

@Offbeatmammal
Copy link
Author

following these fixes did allow the PPTX to be opened, but unable to successfully read the notes in the opened file, and using it as a source for addExternalFile results in an output in need of repair :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant