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

Free Support Forum - aspose.com

Save Word Document DOC DOCX with Password Encryption using C# .NET Code | Set Password to Open Word Document

Please let me know if it is possible to do the following:

  • Save Word document as .doc or .docx with a password, so that it can only be opened/read with that password
  • Require that password is ALWAYS used to open the document
  • Prevent removal or changing of that password with that document

If this is possible, please direct me to relevant API documentation.


In order to save document with encryption please use the following code snippet:

Document doc = new Document("D:\\Temp\\in.docx");

OoxmlSaveOptions saveOptions = new OoxmlSaveOptions();
saveOptions.Password = "myPassword";

doc.Save("D:\\Temp\\out.docx", saveOptions);

Please also refer to the following article:
Protecting Documents