【问题标题】:PHPOffice PHPPresentation lose original styling on saving pptxPHPOffice PHPPresentation 在保存 pptx 时失去原始样式
【发布时间】:2015-11-02 07:23:35
【问题描述】:

我有简单的代码:

  1. 加载模板 pptx (*)
  2. 复制几张幻灯片
  3. 用值填充这些幻灯片(只是替换占位符文本)
  4. 将结果保存到新文件

不幸的是,PHPOffice 的 PHPPresentation 无法保留模板中的幻灯片样式。

第 4 步中保存的幻灯片全为白色(默认样式)。

有没有办法明确复制该样式?是 PHPPresentation 限制,因为它无法读取样式或什么?

(*) 所描述的问题对于 ppt/odp 也存在。不保留任何样式。

【问题讨论】:

  • 我也有同样的问题!我试过手动复制布局,但它没有做任何事情。你有没有解决过这个问题?
  • 不。也许有人可以尝试复制相关的 xml 部分(PPTX 毕竟 只是 压缩了 xml ;))但对我来说,没有样式的 pptx 填充需求。
  • @przemo_li 您解决了这个问题还是未解决?

标签: php phpoffice phppresentation


【解决方案1】:

错误是 PHPPresentation(旧 PHPPowerPoint)无法加载幻灯片布局和幻灯片母版。

此错误有一个未解决的问题:https://github.com/PHPOffice/PHPPresentation/issues/161

【讨论】:

  • 至少在某种程度上。访问链接以获取有关如何转移该样式的说明。
  • @przemo_li 我已经尝试过,但最终没有工作。你能帮我解决我做错了什么吗?
  • $templatepath = public_path('images/samples/sample.pptx'); $pptReader = IOFactory::createReader('PowerPoint2007'); $oPHPPresentation = $pptReader->load("$templatepath"); $xmlWriter = IOFactory::createWriter($oPHPPresentation, 'PowerPoint2007'); $newsamplepath = storage_path('app/public/ppts/sample'.str_random(5).'.pptx'); $xmlWriter->save($newsamplepath);
  • stackoverflow.com/questions/54902336/…随时回答我也上传了问题
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-11-08
  • 2015-01-04
  • 2011-12-22
  • 2014-08-05
  • 1970-01-01
相关资源
最近更新 更多