使用PHP从doc、xls文件中读取数据
我想知道是否可以从 doc 和 xls 文件中读取数据并将 将内容读取到图像文件中(创建文档的页面样本)。例如 我有一些文件希望我的客户购买。所以我需要自动创建小图像,例如我的文档样本。
我们将不胜感激您的帮助。
I wonder is it possible to read data from doc and xls files and put the
readed content into image files(create page samples of the document). For example
I have documents that I want my customers to buy. So I need automatically to create little images like samples of mine documents.
Your help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对于读取 xls 文件,我真的可以推荐 PHPExcel 这是一个非常简单但功能强大的工具:)至于 doc不幸的是我没有给你什么好的建议。但我确信那里有一些好东西。
编辑:找到了一个使用终端命令用一行代码读取文档文件的快速小解决方案,可能无法满足您的所有需求,但认为值得一提。请注意,这仅适用于 doc,不适用于 docx。 从 PHP 读取文档
For reading from xls files I can really recommend PHPExcel whic is a really simple, but powerful tool:) As for doc I unfortunatly got no good recommandation for you. But I'm sure there's something good out there.
Edit: Found a quick little solution to reading doc-files with one line of code using terminal commands, might not cover all your needs, but thought it was worth a mention. Note that this is only for doc, not docx. Read doc from PHP
虽然这会非常酷而且非常方便,但不幸的是不是。可能有一种方法可以使用 Google Docs API 来做到这一点,但我对此表示怀疑:-(
James
Although this would be very cool and very handy, unfortunately not. There might be a way to do it with the Google Docs API, but I doubt it :-(
James
如果您使用的是 Linux,则可以使用 Antiword 来获取 Word 2000 文档的文本。要获取 Word 2007 文档的文本内容,您需要解压缩它并读取其中包含的 XML。像这样 http://www.webcheatsheet.com/PHP/reading_the_clean_text_from_docx_odt.php
要获取实际 Word 文档及其所有格式的屏幕截图,可能需要在服务器上运行 Word 版本并对其进行屏幕截图,如下所示Litmus 与浏览器一样。
Providing your are on Linux you can use Antiword to get just the text of a Word 2000 doc. To get the text content of a Word 2007 document you need to unzip it and read the XML contained with in. Like this http://www.webcheatsheet.com/PHP/reading_the_clean_text_from_docx_odt.php
To get a screenshot of the actual word doc with all its formatting however would probably require running a version of Word on the server and screenshotting it like Litmus does with browsers.