We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Can I save a docx etc. with a password

Hi,

I know I can save a .doc with a password.

But are there more document types I can save with a password?
Like .docx for instance?

Maybe I missed it but I could not find info for this…

Thanks

Hi Marcel,


Thanks for your inquiry. Please try using the following code:

Document doc = new Document(getMyDir() + “test.docx”);
OoxmlSaveOptions options = new OoxmlSaveOptions(SaveFormat.DOCX);
options.setPassword(“123”);
doc.save(getMyDir() + “awjava-16.3.0.docx”, options);

Hope, this helps.

Best regards,

Thanks Awais,

Got it working now!