3

I have simple code that:

  1. Load template pptx (*)
  2. Duplicate few slides
  3. Hydrate those slides with values (just replacing place-holder texts)
  4. Save result to new file

Unfortunately PHPOffice's PHPPresentation is unable to retain slide styling present in template.

Slides saved in step 4. are all white (default styling).

Is there a way to explicitly copy that styling? Is it PHPPresentation limitation 'cause it's unable to read styling or something?

(*) Described issue persist for ppt/odp too. No styling is retained.

przemo_li
  • 3,932
  • 4
  • 35
  • 60
  • I have the exact same problem! I've tried manually copying the Layout, but it didn't do anything. Did you ever solve the problem? – CJ Scholten Nov 16 '15 at 21:34
  • Nope. Maybe one could try to copy relevant xml parts (PPTX is after all *just* zipped xml ;) ) But for me styling-less pptx filled needs. – przemo_li Nov 17 '15 at 08:24
  • @przemo_li have you resolved this issue or still pending? – kunal Feb 26 '19 at 17:04

1 Answers1

2

The bug is that PHPPresentation (oldly PHPPowerPoint) can't load Slide Layout and Slide Master.

This bug has an opened issue : https://github.com/PHPOffice/PHPPresentation/issues/161.

Progi1984
  • 498
  • 3
  • 12
  • At least to some degree. Visit the link for instruction on how to transfer that styling. – przemo_li Feb 27 '19 at 08:30
  • @przemo_li i have tried but not working at my end.. can you help me what i am doing wrong? – kunal Feb 27 '19 at 09:31
  • $templatepath = public_path('images/samples/sample.pptx'); $pptReader = IOFactory::createReader('PowerPoint2007'); $oPHPPresentation = $pptReader->load("$templatepath"); $xmlWriter = IOFactory::createWriter($oPHPPresentation, 'PowerPoint2007'); $newsamplepath = storage_path('app/public/ppts/sample'.str_random(5).'.pptx'); $xmlWriter->save($newsamplepath); – kunal Feb 27 '19 at 09:34
  • https://stackoverflow.com/questions/54902336/phppresentation-lose-styling-when-we-copy-from-particular-path-and-saving-new-pp feel free to answer i have uploaded the question also – kunal Feb 27 '19 at 09:43