PHPOffice / PHPPresentation

A pure PHP library for reading and writing presentations documents
https://phpoffice.github.io/PHPPresentation
Other
1.31k stars 520 forks source link

Styles are lost after a simple Load & Save action (Reading and Writing) #291

Open jmagnone opened 7 years ago

jmagnone commented 7 years ago

I am trying to use the library for the first time to edit some text placeholders in a presentation (pptx or odp).

After loading the presentation with:

$pptReader = IOFactory::createReader('ODPresentation');
$oPHPPresentation = $pptReader->load('file.odp');

and then writing it to the output file as follows (where $writer is any of the available writers):

$pptWriter = IOFactory::createWriter($oPHPPresentation, $writer);
$pptWriter->save(__DIR__ . "/{$filename}.{$extension}");

the final presentation's shapes lost many of its styles and properties. Also, images embedded in the slide are lost.

A few comments:

Input example: image

Output example (pptx): image

Output example (odp): image

Example of code snippet: image

Screenshot showing some properties that were lost: image

Any ideas how to troubleshoot this?

Regards, Julian

giker commented 7 years ago

I have similar problem.

When doing this: $pptReader = IOFactory::createReader('PowerPoint2007'); $oPHPPresentation = $pptReader->load('my_file.pptx'); echo write($oPHPPresentation, basename(__FILE__, '.php'), $writers);

I'm getting almost the same file, just all styling and images are missing :(

Any workaround for that?

Thanks!

Progi1984 commented 2 months ago

@jmagnone Hi, have you got a sample file ?