wood burning stoves 2.0*
The moose likes Servlets and the fly likes Edit a word document from server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Edit a word document from server" Watch "Edit a word document from server" New topic
Author

Edit a word document from server

Jordi Penedes
Greenhorn

Joined: Nov 30, 2007
Posts: 3
Hello.

I'm working in an application than will let the user open a word document from the server, edit and save it to the server without making an upload.

I have been searching for few days and found several solutions but all of them require some changes on client machines. I'm using webdav for this.

The direct solution (set a direct link to the file) opens the document inside the browser (if i open it in IE) and users want to open it outside the browser, using Word. To solve this, the only solution i have found is to change in every client machine the configuration for doc files in the windows explorer. Is that true?

The other problem with the direct link (coming from firefox or IE) is that when it opens, it's read-only file. The solution, again, is in the client side, adding some code at the windows registry to allow office to open web-documents to open as read-write (solution from microsoft)

Another solution is activeX. Setting this in my jsp

will open the file outside the browser and read-write but requires the user to use IE and the security (in the client side) must be set to allow scripting ActiveX components that are not marked as safe for scripting.

Finally, from java, something that seems not to be a solution. If i set this as the response:

where buf is a byte[] with the file comming from the DB. The result is that word is open with the read-write document, but it points to the local temporal IE folder to a file witn the name http___localhost_8080_myApp_documents_myDoc.doc

Do you know any way to edit this doc file without any change in client machine?

Thanks and sorry for my english.
>
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


The direct solution (set a direct link to the file) opens the document inside the browser (if i open it in IE) and users want to open it outside the browser, using Word. To solve this, the only solution i have found is to change in every client machine the configuration for doc files in the windows explorer. Is that true?

Yes. You could change the content type to be something other then Word to force the user to have to save the doc first (as you have spotted), but that's not really a very elegant solution. IE and Mime type handling behaviour is configured in the registry. ActiveX is your best bet if you want to edit docs directly.

What I might do is enforce a lock document, download, edit, upload and unlock flow. This is how MS's own SharePoint works. If your application is anything other than a small(ish) intranet you'll need to include mechanism to break locks if required.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Jordi Penedes
Greenhorn

Joined: Nov 30, 2007
Posts: 3
Paul Sturrock wrote:Yes. You could change the content type to be something other then Word to force the user to have to save the doc first (as you have spotted), but that's not really a very elegant solution. IE and Mime type handling behaviour is configured in the registry. ActiveX is your best bet if you want to edit docs directly.

What I might do is enforce a lock document, download, edit, upload and unlock flow. This is how MS's own SharePoint works. If your application is anything other than a small(ish) intranet you'll need to include mechanism to break locks if required.


Thanks Paul. As ever, when i was near to give up searching and decide to ask here, i made my last search on the net and found this . A dirty trick, but it seems to work for me. Something related to SharePoint as you stated as well.
Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Edit a word document from server
 
Similar Threads
Opening a MS Word Document from JSP using Relative URL
Editing pdf/word content (text replacement)
Is it possible to read a word document using FileReader or FileInputStream?
repost with more detail on problem of download servlet in Internet Explore
Opening DOC files