0

these days I started with PHP-Presentation. I load a presentation and try to remove the value form a cell. But there is no function to clear a cell.

I've just found addText() and createText().

    public function modTable($slide = null){
        $shapes = $slide->getShapeCollection();

       foreach($shapes as $shape){
           if(get_class($shape) == "PhpOffice\\PhpPresentation\\Shape\\Table") {
              if($shape->getName()){
                    $shape->getRow(1)->getCell(0)->createTextRun("-TEST1-");
                    $shape->getRow(1)->getCell(0)->getParagraph(0)->createText("-TEST2-");

              }
           }
       }
}
michael-mammut
  • 2,595
  • 5
  • 28
  • 46

1 Answers1

1

This works for me: $shape->getRow(1)->getCell(0)->setParagraphs(array(new Paragraph()));

If you have an better solution, feel free to add a comment.

michael-mammut
  • 2,595
  • 5
  • 28
  • 46