Restrict Editing

Restrict editing enables you to fully or partially protect a Word document from unintentional changes with an optional password. If the password is not specified, any user can stop enforcing the protection from the Word application.

Location of restrict editing option in Microsoft Word application

Note, with GemBox.Document you can modify a whole Word file even if it allows changes to just parts of a protected document.

The following example shows how you can start enforcing editing restriction protection using the DocumentProtection class.

Protected Word file of DOCX format with editing restriction in C# and VB.NET
Screenshot of restrict editing in Word document
Upload your file (Drag file here)
using GemBox.Document;

class Program
    static void Main()
        // If using Professional version, put your serial key below.

        var document = DocumentModel.Load("%InputFileName%");

        EditingRestrictionType restriction = %EditingRestrictionType%;
        string password = "%Password%";
        document.Protection.StartEnforcingProtection(restriction, password);

        document.Save("Restrict Editing.docx");
Imports GemBox.Document

Module Program

    Sub Main()

        ' If using Professional version, put your serial key below.

        Dim document = DocumentModel.Load("%InputFileName%")

        Dim restriction As EditingRestrictionType = %EditingRestrictionType%
        Dim password As String = "%Password%"
        document.Protection.StartEnforcingProtection(restriction, password)

        document.Save("Restrict Editing.docx")

    End Sub
End Module

Want more?

Next example GitHub

Check the next example or select an example from the menu. You can also download our examples from the GitHub.

Like it?

Download Buy

If you want to try the GemBox.Document yourself, you can download the free version. It delivers the same performance and set of features as the professional version, but with some operations limited. To remove the limitation, you need to purchase a license.