这些天我开始学习PHP Presentation。我加载了一个演示文稿,并试图从单元格中删除该值。但是没有清除细胞的功能。
我刚刚找到了addText()
和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-");
}
}
}
}
这对我很有用:$shape->getRow(1)->getCell(0)->setParagraphs(array(new Paragraph()));
如果您有更好的解决方案,请随时添加评论。