2016-07-15 68 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