Powerpoint图表需要修复

问题描述 投票:0回答:1

我目前正在开展一个项目,我需要在线创建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

提前致谢

php laravel-5.1 phppresentation
1个回答
0
投票

要使图表起作用,您必须处理以下事项:

转到库下的src文件夹并打开文件“pptcharts”。并从'val'和'pos'中取出所有“%”符号。通常搜索所有“%”符号并将其替换为“”空字符串。在“ppttheme”中也这样做。并在ppt图表行号102末尾删除%符号。如果有效,请告诉我。

© www.soinside.com 2019 - 2024. All rights reserved.