bluewalrus
07-12-2010, 03:35 AM
Is there anyway I can get the content from a word file to a webpage assuming I have word on the server and the doc file?
djr33
07-12-2010, 03:43 AM
You want to convert a .doc to a .htm file? (Or through a .php file).
Or do you want to get the text content of the .doc and insert it somewhere in another file?
Either way, I expect it will be tricky. .docx is an entirely different format from .doc, and both will have their own issues/ways to do this.
I'd suggest converting them manually.
Assuming that doesn't work, maybe something like google documents would help: use some sort of API to import then export and get back a .htm or .txt file to work with.
There may be some way out there, but doing this yourself would be a big project to say the least.
As far as I know, Microsoft goes out of its way to stop this sort of thing from happening. Apparently .docx (though less usable in other programs) is actually easier to work with (XML, right?), but I'm not sure what that will really help with. Perhaps strip_tags() would get you some sort of preview...
What reasons are there for not using another format? Could you use word to export something nicer like .htm, .txt, .rtf, etc? Or perhaps use open office.
Here are a few helpful links from google, though mostly they're just saying that you can't really do it.
http://www.daniweb.com/forums/thread56624.html
In that, I like the idea of running MS Office on the server as an automated process, but that would get messy of course.
http://davidwalsh.name/read-pdf-doc-file-php
Looks very helpful, if you can get the library working on your server.
http://forums.devarticles.com/php-development-48/using-php-to-read-word-documents-doc-txt-files-7319.html
Lots of tangents, but some interesting (and complex) posts in the middle.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.