我在加载PowerPoint 2007(.pptx)文件时遇到问题,然后再次保存。即使不对其进行任何更改,原始文件中的图像也会丢失。
require_once 'PHPPresentation-develop/src/PhpPresentation/Autoloader.php';
\PhpOffice\PhpPresentation\Autoloader::register();
require_once 'Common-0.2.6/src/Common/Autoloader.php';
\PhpOffice\Common\Autoloader::register();
use PhpOffice\PhpPresentation\Autoloader;
use PhpOffice\PhpPresentation\Settings;
use PhpOffice\PhpPresentation\IOFactory;
use PhpOffice\PhpPresentation\Slide;
use PhpOffice\PhpPresentation\Slide\SlideLayout ;
use PhpOffice\PhpPresentation\PhpPresentation;
use PhpOffice\PhpPresentation\AbstractShape;
use PhpOffice\PhpPresentation\DocumentLayout;
use PhpOffice\PhpPresentation\Shape\Drawing;
use PhpOffice\PhpPresentation\Shape\RichText;
use PhpOffice\PhpPresentation\Shape\RichText\BreakElement;
use PhpOffice\PhpPresentation\Shape\RichText\TextElement;
use PhpOffice\PhpPresentation\Shape\Media;
use PhpOffice\PhpPresentation\Style\Alignment;
use PhpOffice\PhpPresentation\Style\Bullet;
use PhpOffice\PhpPresentation\Style\Color;
error_reporting(E_ALL);
$oReader = IOFactory::createReader('PowerPoint2007');
$readPPTX = $oReader->load(__DIR__ . '/input.pptx');
$oWriterPPTX = IOFactory::createWriter($readPPTX, 'PowerPoint2007');
$oWriterPPTX->save(__DIR__ . "/output.pptx");
在我执行它之后的例子中,输出文件只有25321个字节,而原始文件长度为109363个字节 - 由于图像的原因。
不会产生任何错误。我已经尝试了开发和0.7.0分支。
有什么想法吗?