如何使用PHP在文本区域中显示Word文档? [英] How can I display Word documents in a textarea using PHP?

查看:108
本文介绍了如何使用PHP在文本区域中显示Word文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用com类测试代码以显示Word文件,但似乎无法获得答案并仍在搜索.我遇到错误,有时程序根本不显示任何内容.请给我一些想法.我正在使用PHP 4.

I was trying to test code using com class to display Word files but I cannot seem to get the answer and still searching. I get errors and sometimes, programs do not display anything at all. Please give me some ideas. I'm working with PHP 4.

推荐答案

如果该站点托管在装有Word的Windows计算机上,则可以使用COM扩展PHP,从而使您可以访问Word文档.使用Word的自动化模型公开的自动化方法,您可能会执行一些操作,例如将Word文档导出为HTML,然后将该HTML呈现到页面上的某些帧/格.我没有看过代码也没有尝试过,但是有人在这里创建了word/php类:
http://www.phpclasses.org/browse/package/3553.html

If the site is hosted on a Windows machine with Word you may be able to use a COM extension to PHP that will give you access to Word documents. Using the automation methods exposed by Word's Automation model, you could probably do something like export a word document to HTML and then render that HTML to some frame/div on your page. I haven't looked at the code or tried it, but someone has created a word/php class here:
http://www.phpclasses.org/browse/package/3553.html

可能还有很多其他人.

There are probably many others.

尽管过去我看到的代码实际上可以在不使用自动化的情况下直接读取Word文档,但我不建议这样做,因为它很容易被新版本或文件格式的奇怪字符破坏.

Although I have seen code in the past that will actually read a Word document directly without the use of Automation, I wouldn't recommend it as it could be easily broken by new versions or oddities in file format.

这篇关于如何使用PHP在文本区域中显示Word文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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