2016-07-15 99 views
-2

我需要一種相當可靠的方式將一個word文檔轉換爲PHP中的字符串。在PHP中讀取word文檔

我剛剛安裝了Antiword。它適用於許多文件,包括doc和docx,但它對某些文件有問題,並給出錯誤:「[文件名]不是Word文檔」,即使它們是。

我關於閱讀到這個問題:

This is the new-style XML-in-a-zip-container format, which is completely different to the binary Microsoft Word formats which antiword handles most of.

There's no realistic likelihood of antiword supporting this - the last antiword upstream release was 2005-10-21 (which predates this XML format).

是否有閱讀在PHP這些新格式的Word文檔某種方式?

+0

也許https://github.com/PHPOffice/PHPWord? – chris85

+0

我確實認爲,但我很懷疑它的功能後閱讀:http://stackoverflow.com/questions/20555057/how-to-read-doc-file-via-phpword – dlofrodloh

回答

0

我將使用PHPWord,這是PHPOffice的一部分...我沒有使用過它,但我已經使用PHPExcel,並且它在新格式(xml zip)上無可匹敵地工作。 試試吧!

+0

好的謝謝,它已被建議兩次我會放棄並報告 – dlofrodloh