【问题标题】:PhpPowerpoint class XMLwriter not found找不到 PhpPowerpoint 类 XMLwriter
【发布时间】:2015-07-21 14:13:42
【问题描述】:

我正在尝试使用 PHPPowerpoint 和他的示例

但我收到以下错误:

*Sample 01 Complex
14:56:03 Create new PHPPresentation object
14:56:03 Set properties
14:56:03 Remove first slide
14:56:03 Create templated slide
14:56:03 Create a shape (rich text)
14:56:03 Create templated slide
14:56:03 Create a shape (rich text)
14:56:03 Create a shape (rich text)
14:56:03 Create templated slide
14:56:03 Create a shape (rich text)
14:56:03 Create a shape (rich text)
14:56:03 Create templated slide
14:56:03 Create a shape (rich text)
14:56:03 Create a shape (rich text)

**Fatal error: Class 'Common\XMLWriter' not found in .....\test phppowerpoint\PHPPowerPoint-develop\src\PhpPresentation\Writer\PowerPoint2007\AbstractPart.php on line 76***

谁能帮我解决这个错误? 谢谢

【问题讨论】:

  • 我有同样的问题,我无法理解目录结构以及common-develop文件夹的放置位置?

标签: php xmlwriter phppowerpoint


【解决方案1】:

您正面临此问题,因为缺少 common office php 文件。下载:

https://github.com/PHPOffice/Common

并将其包含在您的源代码中(更新路径后):

require_once 'Common-develop/src/Common/Autoloader.php';
\PhpOffice\Common\Autoloader::register();

【讨论】:

  • 你能解释一下我必须将这些公共文件放在目录中的什么位置吗?因为,没有像 PhpOffice 这样的文件夹
  • 你能告诉我这些公共库文件需要存储在哪里吗?
【解决方案2】:

正如 Raj 所说,您需要从他指定的链接下载常用的 PHPOffice 类。 你可以把它们放在你更方便的地方。在我的例子中,我将 Common 文件夹放在 src 文件夹中(所以在 src 中你会有 PHPPresentation普通)。 之后,您需要将它们包含在源代码中,如 Raj 所说

require_once 'PHPPresentation/src/Common/Autoloader.php;
\PhpOffice\Common\Autoloader::register();

您必须将 require_once 中的路径更新为您的实际路径。

P.S.:不要忘记目标文件夹的写入权限,否则库将无法写出演示文件!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-04-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多