我正在从我的数据库生成Powerpoint。它在ubuntu上工作正常,但不会在windows上显示。只显示空白ppt。在windows中,空白ppt生成。我的代码是
//创建幻灯片
$currentSlide = $objPHPPowerPoint->getActiveSlide();
//创建一个形状(绘图)
$shape = $currentSlide->createDrawingShape();
$shape->setName('PHPPresentation logo')
->setDescription('PHPPresentation logo')
->setPath(base_path().'/public/images/pp_bg.jpg')
->setHeight(36)
->setOffsetX(10)
->setOffsetY(10);
$shape->getShadow()->setVisible(true)
->setDirection(45)
->setDistance(10);
//创建形状(文本)
$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' ) );
// generate PPT file.
$oWriterPPTX = IOFactory::createWriter($objPHPPowerPoint, 'PowerPoint2007');
$oWriterPPTX->save("Proposal $id.ppt");
$file_url = "Proposal $id.ppt";
header('Content-Description: File Transfer');
header('Content-Type: application/vnd.openxmlformats-officedocument.presentationml.presentation');
header('Content-Disposition: attachment; filename='.basename($file_url));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' .filesize($file_url));
readfile($file_url);
答案 0 :(得分:1)
我不确定但是这可能是您使用的字体不存在/安装到您的WinOS系统中的问题。尝试使用支持字体(您的ubuntu + WinO)。您可以阅读有关PHPPresentation的更多here 包装功能。
有用的链接:Slides show up blank (white) when opening presentation in Powerpoint for Mac 2011
希望这会对你有帮助!