How to Unprotect Word Document using C#

This short tutorial explains how to unprotect Word document using C#. It contains a step-wise process to accomplish the task along with the runnable sample code. Using this article, you can also unprotect Word document with password using C# with the help of a couple of lines of codes only and save it as a new DOCX or DOC file if required.

Steps to Unprotect MS Word Document using C#

  1. Establish the environment to add Aspose.Words for .NET from the NuGet package manager
  2. Load the protected Word file into the Document class object
  3. Call the Unprotect() method to remove the protection from the document
  4. Save the unprotected resultant Word file on the disk

These steps summarize the process to unprotect Word file using C# where the Word file is first loaded into the Document class object and then Unprotect() method is called without any password. Note that you can also use a password in the Unprotect() method however it can remove the protection applied through a password.

Code to Unprotect Word Document without Password using C#

This code demonstrates the process to unprotect DOCX using C# where the Unprotect() method in the Document class is used without any password. It can unprotect Word files that are protected with or without a password. If your file is write-protected also, use the Document.WriteProtection.SetPassword("") command where the password is set to null for removing the write protection.

This article has taught us to remove the protection from a Word file. If you want to learn the process to protect a Word file, refer to the article on how to password protect a Word document in C#.

 English