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.
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.
- using Syncfusion.DocIO;
- using Syncfusion.DocIO.DLS;
- //Load an existing Word document
- using FileStream inputStream = new FileStream("Template.docx", FileMode.Open, FileAccess.Read);
- using WordDocument document = new WordDocument(inputStream, FormatType.Docx);
- //Encrypt the Word document with a password
- document.EncryptDocument("syncfusion");
- //Save the Word document
- using FileStream outputStream = new FileStream("Result.docx", FileMode.Create, FileAccess.Write);
- document.Save(outputStream, FormatType.Docx);
Users can view the document content, but cannot make any edits.
Users can add or modify comments in the document, but cannot change the content.
Users can access and fill out form fields while the main document content remains protected.
Users can suggest changes without editing existing text, supporting transparent review and feedback.
Explore these resources for comprehensive guides, knowledge base articles, insightful blogs, and ebooks.
Product Updates
Technical Support
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.
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.