Reading and Replacing Text Using PhpPresentation

623 views Asked by At

I want to access a Word from A pptx file in laravel using php presentations I tried this but its not working.Kindly provide any input.

$slides = $oPHPPresentation2->getSlide(7);
$shape=$slides->getShapeCollection();
$paragraphs = $shape->getParagraphs();
foreach ($paragraphs as $paragraph_k => $paragraph_v) 
{
    $text_elements = $paragraph_v->getRichTextElements();
    foreach ($text_elements as $text_element_k => $text_element_v) 
    {
        $text = $text_element_v->getText();
        $new_text = str_replace('[[recommendations]]','Pranjal', $text);
        $text_element_v->setText($new_text);
    }
}
0

There are 0 answers