PHPOffice / PHPPresentation

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

Table styles are lost when you copy from an existing slide #823

Open dhardy1988 opened 1 month ago

dhardy1988 commented 1 month ago
$slideMap = [];
$slides = $this->objPHPPresentation->getAllSlides();
foreach ($slides as $slide) {
for ($i = 0; $i < 2; $i++) {
    $clonedSlide = $slide->copy();
    $slideMap[] = $clonedSlide;
  }
}

 for ($i = count($slides) - 1; $i >= 0; $i--) {
    $this->objPHPPresentation->removeSlideByIndex($i);
 }

 foreach($slideMap as $slide) {
    $this->objPHPPresentation->addSlide($slide);
 }

I am just cloning a slide, adding it to the slideMap so I can add re-add them after, removing all the slides from phppresentation object to start fresh then looping through and adding them all, the table styles go from a fill colour to all black?

pp-test-report-valid.pptx

Just to update, even this does not work

$slide = $this->objPHPPresentation->getSlide();
        $clonedSlide = $slide->copy();
        $this->objPHPPresentation->addSlide($clonedSlide);

Table ends up black