Bounce
Bounce

Reputation: 2095

Read data from doc, xls files with PHP

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.

Upvotes: 3

Views: 5905

Answers (3)

Treffynnon
Treffynnon

Reputation: 21553

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.

Upvotes: 0

Sondre
Sondre

Reputation: 1898

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

Upvotes: 4

Bojangles
Bojangles

Reputation: 101483

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

Upvotes: 0

Related Questions