How can I display Word documents in a textarea using PHP?

前端 未结 3 356
北恋
北恋 2021-01-22 12:58

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 anyt

3条回答
  •  遥遥无期
    2021-01-22 13:27

    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.

    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.

提交回复
热议问题