PHPPresentation
PHPPresentation copied to clipboard
Cannot load Tables with Reader
Hello,
I'm not sure if it's a real bug or I'm doing it wrong, but there is my issue.
I load a .pptx file using
$pptReader = IOFactory::createReader('PowerPoint2007');
$oPHPPresentation = $pptReader->load('resources/template_test.pptx');
Then save it using
$oWriterODP = IOFactory::createWriter($oPHPPresentation , 'PowerPoint2007');
$filename = strtotime("now").".pptx";
$oWriterODP->save($filename);
I don't touch it in between and still tables disappears in the generated file.
I'm on Mac, exporting to odp then doing the exact same thing does not cause problems with tables but shrinks of all the content.
Regards.
EDIT :
Found this table of features http://phppresentation.readthedocs.io/en/latest/intro.html#readers It's seems to say that table reading is not supported by either format, is it up to date ?
@Vlaoff Can you give us a sample pptx file with table, please ?
was there any progress on this? I'm not having much luck reading an existing pptx, and trying to find charts/tables, and then realized that when it's saved the chart has disappeared.
using this code to read/save the pptx (and try and find the data so I can edit it s1.pptx
$pptReader = IOFactory::createReader('PowerPoint2007');
$oPHPPresentation = $pptReader->load('s1.pptx');
foreach ($oPHPPresentation->getAllSlides() as $oSlide) {
foreach ($oSlide->getShapeCollection() as $oShape) {
if ($oShape instanceof Table) {
// getRows result at this point implies that the data is already missing
}
}
}
$oWriterPPTX = IOFactory::createWriter($oPHPPresentation, 'PowerPoint2007');
$oWriterPPTX->save("s1o.pptx");