PHPPresentation
PHPPresentation copied to clipboard
Unable to read slide note
I am trying to read slide note from an external .pptx file, however unable to do so. The slideNote property inside PhpOffice\PhpPresentation\Slide\SlideLayout is always null.
Here is my code trying to retrieve note text from a slide
$pptReader = IOFactory::createReader('PowerPoint2007');
$oPHPPresentation = $pptReader->load('Sample_09_SlideNote.pptx');
$slide = $oPHPPresentation->getSlide(0);
var_dump($slide->getNote()->getShapeCollection()); // empty array
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
@jasonhuhx Could you test the develop branch ? Normally, it's done for PowerPoint2007 & PowerPoint97.
@Progi1984 Confirmed working for PowerPoint2007. Here is my code to retrieve plain text from slide notes:
$pptReader = IOFactory::createReader('PowerPoint2007');
$oPHPPresentation = $pptReader->load('Sample_09_SlideNote.pptx');
$slide = $oPHPPresentation->getSlide(0);
foreach ($slide->getNote()->getShapeCollection() as $shape) {
foreach ($shape->getParagraphs() as $paragraph) {
var_dump($paragraph->getPlainText());
}
}
However I'm untable to test PowerPoint97 because the following code is giving me error PowerPoint97 Reader : readRecordOfficeArtSpgrContainer.
$pptReader = IOFactory::createReader('PowerPoint97');
$oPHPPresentation = $pptReader->load('Sample_09_SlideNote.ppt');
The .ppt file I'm using is converted down from .pptx, on PowerPoint for Mac.
PR #342