2015-07-21 69 views
0

我試圖用PHPPowerpoint和他的例子PhpPowerpoint類的XmlWriter沒有找到

,但我得到了以下錯誤:

*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*** 

誰能幫我解決這個問題? 謝謝

+0

我有同樣的問題,我無法理解目錄結構和common-develop文件夾的位置? –

回答

4

您正面臨此問題,因爲common office php文件丟失。下載:

https://github.com/PHPOffice/Common

,它包含在你的源代碼(在更新路徑):

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

你能解釋一下,我真的必須將這些常用文件放在目錄中嗎?因爲,沒有像PhpOffice這樣的文件夾 –

+0

你能告訴我,我需要在哪裏存儲這些公共庫文件? – void

1

正如拉吉說,你需要從他指定的鏈接下載常見PHPOffice類。 你可以把它們放在你更方便的地方。就我而言,我把SRC文件夾內的通用文件夾(所以在SRC你必須PHPPresentation常見)。 之後,你需要將它們包括在源代碼,拉吉說

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

你必須在require_once更新到您的實際路徑的路徑。

P.S .:不要忘記在目標文件夾上寫入權限,否則庫將無法寫出演示文件!