PHP以MS WORD读写 [英] PHP Read and Write in MS WORD

查看:83
本文介绍了PHP以MS WORD读写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用PHP读/写word文档,

I want to read/write word documents using PHP,

我知道php中有一个函数可以与COM对象一起使用,我们可以使用该函数读取和写入Word文档,但是COM对象仅在Windows上可用,而在Linux上不可用.

I know there is a function in php to work with COM objects which we can use to read and write word documents, but COM objects are only available on Windows and not on Linux.

我的服务器正在运行linux,客户端正在将其docs/excel工作表上传到该服务器.

My server is running linux and clients are uploading their docs/excel sheets to this server.

还有其他使用php读取ms-excel/ms-word文件的方法吗?

Is there some other way to read ms-excel/ms-word files using php?

推荐答案

值得注意的是,Microsoft建议不要通过COM对象来自动化Office文档:

It's worth noting that Microsoft advises against the automation of Office documents via COM objects:

Microsoft当前不建议并且不支持从任何无人参与的非交互客户端应用程序或组件(包括ASP,ASP.NET,DCOM和NT Services)自动化Microsoft Office应用程序,因为Office可能表现出不稳定在这种环境中运行Office时的行为和/或死锁.

Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

尽管您可以创建不带COM对象的.docx文件,但是由于它们具有XML基础(您可以使用 PHPDOCX 为了这).这种方法的另一个优点是,您不需要安装Word的本地副本(用于.docx文件),也可以在Linux服务器上使用它(理论上,尽管我不确定PHPDOCX产品)支持这一点.

Although you can create .docx files without COM objects however because of their XML foundations (you can use PHPDOCX for this). An added advantage with this method is that you don't need to have a local copy of Word installed (for .docx files) and you can also use it on a Linux server (in theory, although I'm not sure the PHPDOCX product supports that).

这篇关于PHP以MS WORD读写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆