How can I open a password-protected Microsoft word(.doc, .docx) file in Java, assuming that the password is known?
How can I open a password-protected Microsoft word(.doc, .docx) file in Java, assuming that
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can try it with com4j.
http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.documents.open2000.aspx
Since there is a parameter called “PasswordDocument” in the “open”-method, I think it is possible to open a password protected file.
Hope this is what you were searching for 😉
Edit: I recorded this Macro in Word.
So the open method in com4j should look somethin like this (password is “Hallo”):