aspose file tools*
The moose likes Java in General and the fly likes password protecting a MS word Document Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "password protecting a MS word Document" Watch "password protecting a MS word Document" New topic
Author

password protecting a MS word Document

Shyam Sunder V R
Greenhorn

Joined: Jul 29, 2008
Posts: 20
Guys,
I want to set a password to a MS Word Document ...The way to do it manually is to go to

File - Save As - General options - Set password


I google-d a lot and Couldn't find a way to do it with Java.Can any of you guys help me with the java code for it ?Thanks

JUST WANT TO WARN YOU : I DON'T WANT TO ENCRYPT THE WORD DOCUMENT...JUST WANT TO SET A PASSWORD
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
The standard way to do this in Java would be to use the Apache POI, but unfortunately it seems to support passwords only for spreadsheets, not word documents.

It may be possible by using the OpenOffice API in OO's server mode (big learning curve ahead of you if you've never used it).
Shyam Sunder V R
Greenhorn

Joined: Jul 29, 2008
Posts: 20
If anyone who's worked with the API that you have mentioned above could give me a sample code or something or a guidance note It could greatly reduce my effort
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: password protecting a MS word Document