PHPPresentation icon indicating copy to clipboard operation
PHPPresentation copied to clipboard

Unable to read slide note

Open jasonhuhx opened this issue 8 years ago • 3 comments

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

Sample_09_SlideNote.pptx


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

jasonhuhx avatar Feb 23 '17 17:02 jasonhuhx

@jasonhuhx Could you test the develop branch ? Normally, it's done for PowerPoint2007 & PowerPoint97.

Progi1984 avatar Mar 06 '17 19:03 Progi1984

@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.

Sample_09_SlideNote.ppt.zip

jasonhuhx avatar Mar 06 '17 21:03 jasonhuhx

PR #342

Progi1984 avatar Mar 06 '17 23:03 Progi1984