Create a un-protected file from a password protected MS word file

Hello Support Team,
Can you share me code snippet to create a un-protected file from a password protected MS word file ?

Kind Regards,
Vikram Sharma

@v11krams

Thanks for your inquiry. Please use the Document.Unprotect method as shown below to unprotect the document. This method removes protection from the document regardless of the password.

If your input document requires password when open it in MS Word, you need to use LoadOptions.Password property.

Aspose.Words.LoadOptions loadOptions = new Aspose.Words.LoadOptions();
loadOptions.Password = "password";
Document doc = new Document(MyDir + "in.docx", loadOptions);
doc.Unprotect();
doc.Save(MyDir + "18.11.docx");

Hello Tahir,
I tried equivalent code in java and it did not work.
Below is my snippet:

loadOptionObj = new com.aspose.words.LoadOptions();
loadOptionObj.setPassword(passwordKey);
doc = new com.aspose.words.Document(contentFileWithPath, loadOptionObj) ;
doc.Unprotect();
doc.Save(MyDir + “18.11.docx”);

Can you confirm with java support ? We have bought paid support.

Kind Regards,
Vikram

@v11krams

Thanks for your inquiry. Please ZIP and attach your input Word document here for testing. We will investigate the issue on our side and provide you more information.