I'm looking for a PHP class that is able to open common document f开发者_JAVA技巧ormats such as .txt, .docx, .doc, .wps. The main documents that need to be opened are MS text documents and Open Office.
Do any free or paid classes exist?
you could load them into google docs and export them in a suitable format, via the api.
phpexcel can read excel docs.
if you are running on a windows server and you have office installed you can use com classes to access word docs etc.
this looks interesting, but i haven't used personally
http://www.phplivedocx.org/2009/08/13/convert-docx-doc-rtf-to-html-in-php/
You can read in text files with $contents = file_get_contents('file.txt')
.
I use http://wvware.sourceforge.net/ to extract the text from doc files for indexing purposes. I can't vouch for the usability of the output for other uses, but it's good enough for text search. It's a shell tool, so you'll eed to call it with exec()
or similar. This might not work if you're on a relatively restricted shared hosting system.
For reading Excel files I use http://sourceforge.net/projects/phpexcelreader/ which I'm pretty happy with. Note that there are multiple excel formats and you might have to account for that.
Can't help with wps I'm afraid.
精彩评论