views:

328

answers:

4

I realise this may just be speculation, but I'd appreciate comments from anyone who has some insight into this. Something like MS Word COM add-in, or an OO bridge, or a custom implementation.

The reason I want to know is that I want to provide basic online document editing (really basic, basically just rich text at this point) for a php web app. I'm guess I will store the markup in html format then convert to rtf/doc etc for user convenience.

A: 

This class might help you. I've never used it but here are some links:

musicfreak
A: 

They have probably written their own, maybe starting from wvWare or something similar. I have noticed that Google Desktop on Linux seems to use wvWare to parse MS Word documents.

The documentation for the Word file formats is available, but reading through it makes you realize that it would not be an easy task.

Automating Word or OpenOffice would be the easiest, but there might be licensing issues with using Word like that, and possible concurrency issues with using either of them on a web server.

R Ubben
A: 

A popular way to do it is to generate RTF with the file extension .doc. It works fine with Word and other editors, and users remain happy that it is "a DOC file"

singpolyma
+1  A: 

The Apache POI project (written in Java) offers an interface to many file types from the MS Office suite.

You can run the Java code from within PHP using the PHP/Java bridge.

I used this once for an application where MS Word documents had to be indexed in a web application. I remember that setting everything up was quite a hassle, but then it worked very well and reasonably fast. (Unfortunately, the code was written in PHP4 and I don't own it, so I cannot help you out with any snippets here.)

P.S. I cannot post links since I'm a new user, so google for "Apache POI" and "PHP/Java bridge" to get to the respective project's homepage.

rodion