PHPPresentation icon indicating copy to clipboard operation
PHPPresentation copied to clipboard

Cannot load Tables with Reader

Open Vlaoff opened this issue 8 years ago • 2 comments

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 ?

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/40517649-cannot-load-tables-with-reader?utm_campaign=plugin&utm_content=tracker%2F323104&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F323104&utm_medium=issues&utm_source=github).

Vlaoff avatar Dec 31 '16 09:12 Vlaoff

@Vlaoff Can you give us a sample pptx file with table, please ?

Progi1984 avatar Jan 02 '17 10:01 Progi1984

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");

Offbeatmammal avatar Jun 07 '21 05:06 Offbeatmammal