-
Notifications
You must be signed in to change notification settings - Fork 533
Closed
Milestone
Description
I tried the example code which is on the documentation page, but I can not open the saved pptx file, what I mean is that I double clicked the saved file in finder, nothing displayed and no exception jumped out.
So I tried another way, first I saved an empty pptx file use the microsoft powerpoint app, second I read the file in my code, and then I added some text, and save. Then in the finder, I can open the saved file and see the content which I added in the code. Why?
Below is my code:
$reader = IOFactory::createReader("PowerPoint2007");
$objppt = $reader->load("empty.pptx");
$shape = $objppt->getActiveSlide()->createRichTextShape()
->setHeight(300)
->setWidth(600)
->setOffsetX(170)
->setOffsetY(180);
$shape->getActiveParagraph()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_CENTER );
$textRun = $shape->createTextRun('Thank you for using PHPPresentation!');
$textRun->getFont()->setBold(true)
->setSize(60)
->setColor( new Color( 'FFE06B20' ) );
$w = IOFactory::createWriter($objppt, 'PowerPoint2007');
$w->save(__DIR__ . "/from-empty.pptx");
Metadata
Metadata
Assignees
Labels
No labels