Forum Moderators: coopster
I wonder if anyone could tell me whether or not it's possible to open, edit and change a Word document that's accessed online.
I want to open it, make changes then save the changes to the file online, rather than saving as a new file on my pc and re-uploading it.
Any help would be appreciated.
google php file handling and read the manual of fopen etc functions.
However, the textarea displays the source code of the Word doc, rather than the formatted version, even though I've tried this with both .doc and .htm extensions. [What I mean is I can open the file using fopen() and it's displayed just as I'd like, but when displayed within textarea it includes all the code with no formatting]
Any hints as to what I should do?
It requires a *server* equiped with Ms Word if you are going to do it with PHP.
You can then use the COM object to get and manipulate the content of a Word Document using Ms Word itself.
Search for it in Google:
[google.com ]
The downside is that first you need Ms Word on the server, and that Ms Word is pretty heavy, memory-wise, so if you have to do a large volume, you better have a dedicated server. You could also try to use OOo filters, but I really know nothing about that.
Another possibility is to extract the content through COM on the client side using javascript and activeX.
<snip>
From there, if you need anything from the server, use Ajax.
The downside is that Ms Word must be installed on the client computer and that ActiveX must be enabled(both factors are outside your control). On the plus side, it saves your server's memory & CPU.
Otherwise, attempting to manipulate directly a typical Word document is ... way out of my league.
[edited by: dreamcatcher at 7:22 pm (utc) on Sep. 15, 2007]
[edit reason] no urls as per T.O.S [webmasterworld.com].Thanks [/edit]
Silver, interesting to read about editing MS world with PHP
But I foresee a security problem
it is almost impossible to regex a word doc
since MS formating contains most of the HTML characters that we would like disallowing
any idea?
The best way to protect your application depends on what you are doing and what are the dangers you are trying to protect against, but since it's just text (once extracted that is) the usual methods should work.
[edited by: Sylver at 3:55 pm (utc) on Sep. 16, 2007]