GemBox.Document is a .NET component that enables you to read, write, edit, convert, and print document files from your .NET applications using one simple API.

Restrict Editing

This kind of protection in DOC and DOCX formats is used to prevent unintentional changes to all or part of a document.

Since this protection does not encrypt the document, malicious applications may circumvent its use (it is not intended as a security feature and may be ignored).

Following example shows how to start enforcing editing restriction protection and how to stop enforcing it.

Screenshot
Restrict Editing Screenshot

See the full code below, use Run Example to execute.

Upload your file(Drag files here)

Download a sample file

using System;
using GemBox.Document;
using GemBox.Document.Drawing;
using System.IO;
using System.Linq;

class Sample
{
    [STAThread]
    static void Main(string[] args)
    {
        // If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        var document = DocumentModel.Load("Reading.docx");

        // Disallow all editing in the document (document is read-only).
        // Since password is not specified, all users can stop enforcing protection in MS Word.
        document.Protection.StartEnforcingProtection(EditingRestrictionType.NoChanges, null);

        document.Save("Restrict Editing.docx");
    }
}
Imports System
Imports GemBox.Document
Imports GemBox.Document.Drawing
Imports System.IO
Imports System.Linq

Module Samples

    Sub Main()

        ' If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY")

        Dim document = DocumentModel.Load("Reading.docx")

        ' Disallow all editing in the document (document is read-only).
        ' Since password is not specified, all users can stop enforcing protection in MS Word.
        document.Protection.StartEnforcingProtection(EditingRestrictionType.NoChanges, Nothing)

        document.Save("Restrict Editing.docx")

    End Sub

End Module

Check next sample.