我目前正在做一个需要在线创建PowerPoint的项目。我为此使用https://github.com/PHPOffice/PHPPresentation 。除了生成图表外,几乎所有东西都能完美运行。当我打开PowerPoint时,它说它需要修复。修复后所有内容都丢失了。
我想知道是否有其他人有同样的问题,可以帮助我解决这个问题。
我试过的代码:
$oPHPPresentation = new PhpPresentation();
$currentSlide = $oPHPPresentation->createSlide();
$currentSlide->setName('Title of the slide');
$lineChart = new Line();
$seriesData = array('Monday' => 18, 'Tuesday' => 23, 'Wednesday' => 14, 'Thursday' => 12, 'Friday' => 20, 'Saturday' => 8, 'Sunday' => 10);
$series = new Series('example', $seriesData);
$series->setShowValue(false);
$series->setShowPercentage(true); // This does nothing
$series->setDlblNumFormat('0.00%'); // This does nothing
$lineChart->addSeries($series);
$shape = $currentSlide->createChartShape();
$shape->getPlotArea()->setType($lineChart);
$oWriterPPTX = IOFactory::createWriter($oPHPPresentation, 'PowerPoint2007');
$oWriterPPTX->save(__DIR__ . "/sample.pptx");
包:https
://github.com/PHPOffice/PHPPresentation 框架:Laravel 5.1
php版本:7.0
提前致谢