Syncfusion Feedback

Trusted by the world’s leading companies

Syncfusion Trusted Companies

Overview

Protect your sensitive information and control document access with ease. The Syncfusion .NET Word library (DocIO) empowers you to programmatically encrypt and decrypt Word documents in C# and restrict editing privileges, all without relying on Microsoft Word or interop dependencies.

Encrypt a Word document with a password using C#

This example code shows how to easily encrypt a Word document with a password using the Syncfusion .NET Word Library with just a few lines of C# code.

  1. using Syncfusion.DocIO;
  2. using Syncfusion.DocIO.DLS;
  3. //Load an existing Word document
  4. using FileStream inputStream = new FileStream("Template.docx", FileMode.Open, FileAccess.Read);
  5. using WordDocument document = new WordDocument(inputStream, FormatType.Docx);
  6. //Encrypt the Word document with a password
  7. document.EncryptDocument("syncfusion");
  8. //Save the Word document
  9. using FileStream outputStream = new FileStream("Result.docx", FileMode.Create, FileAccess.Write);
  10. document.Save(outputStream, FormatType.Docx);

Key features of Protect Word documents

Allow only reading

Users can view the document content, but cannot make any edits.

Allow only comments

Users can add or modify comments in the document, but cannot change the content.

Allow only form fields

Users can access and fill out form fields while the main document content remains protected.

Allow only revisions

Users can suggest changes without editing existing text, supporting transparent review and feedback.

Syncfusion .NET Word Library Resources

Explore these resources for comprehensive guides, knowledge base articles, insightful blogs, and ebooks.

Frequently Asked Questions

Yes, you can programmatically set the document to allow only reading access using the .NET Word library (DocIO). This restricts users from making changes in Microsoft Word.

Yes, you can programmatically encrypt a Word document with your desired password using the .NET Word library.

No, the correct password is required to open and edit a password-protected Word document programmatically using the .NET Word library.

Yes, you can decrypt password-protected Word documents and remove editing restrictions using the .NET Word library (DocIO).

No, DocIO only utilizes your password to open the document, verifying it against the decrypted password from the Word document. It does not store your passwords, ensuring the security of your confidential information.

You can access it through the NuGet package. The documentation provides detailed code samples and tutorial videos to facilitate seamless integration.

Our Customers Love Us

Having an excellent set of tools and a great support team, Syncfusion® reduces customers’ development time.
Here are some of their experiences.

Rated by users across the globe

Want to create, View, and edit Word documents in C# or VB.NET?

Start a free 30-day evaluation today!
DOWNLOAD FREE TRIAL

No credit card required.

Mobile Free Evaluation Section

Awards

Greatness—it’s one thing to say you have it, but it means more when others recognize it. Syncfusion® is proud to hold the following industry awards.

Scroll up icon
Chat with us