Closed nazububu closed 11 months ago
Hey hey.
Just tried to use package. Installed with composer, copied example, modified. Aaand got exception.
<?php require_once('vendor/autoload.php'); use PhpOffice\PhpPresentation\PhpPresentation; use PhpOffice\PhpPresentation\IOFactory; use PhpOffice\PhpPresentation\Style\Color; use PhpOffice\PhpPresentation\Style\Alignment; $objPHPPowerPoint = new PhpPresentation(); // Create slide $currentSlide = $objPHPPowerPoint->getActiveSlide(); // Create a shape (drawing) $shape = $currentSlide->createDrawingShape(); $shape->setName('PHPPresentation logo') ->setDescription('PHPPresentation logo') // ->setPath('./resources/phppowerpoint_logo.gif') ->setHeight(36) ->setOffsetX(10) ->setOffsetY(10); $shape->getShadow()->setVisible(true) ->setDirection(45) ->setDistance(10); // Create a shape (text) $shape = $currentSlide->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')); $oWriterPPTX = IOFactory::createWriter($objPHPPowerPoint, 'PowerPoint2007'); $oWriterPPTX->save(__DIR__ . "/sample.pptx"); $oWriterODP = IOFactory::createWriter($objPHPPowerPoint, 'ODPresentation'); $oWriterODP->save(__DIR__ . "/sample.odp");
PHP Fatal error: Uncaught PhpOffice\PhpPresentation\Exception\FileNotFoundException: The file "" doesn't exist in /srv/dev/vendor/phpoffice/phppresentation/src/PhpPresentation/Shape/Drawing/File.php:77 Stack trace: #0 /srv/dev/vendor/phpoffice/phppresentation/src/PhpPresentation/Writer/PowerPoint2007/ContentTypes.php(133): PhpOffice\PhpPresentation\Shape\Drawing\File->getMimeType() #1 /srv/dev/vendor/phpoffice/phppresentation/src/PhpPresentation/Writer/PowerPoint2007.php(117): PhpOffice\PhpPresentation\Writer\PowerPoint2007\ContentTypes->render() #2 /srv/dev/index.php(40): PhpOffice\PhpPresentation\Writer\PowerPoint2007->save() #3 {main} thrown in /srv/dev/vendor/phpoffice/phppresentation/src/PhpPresentation/Shape/Drawing/File.php on line 77
Can you please help with it?
Thanks
Sorry, I am dumb AF. Path for image missed.
Hey hey.
Just tried to use package. Installed with composer, copied example, modified. Aaand got exception.
Can you please help with it?
Thanks