DOCX Encryption in C# and VB.NET

DOCX encryption enables you to securely protect the content of your Word document (DOCX) from unwanted viewers.

Following example shows how to load encrypted DOCX file and how to save document as encrypted DOCX file.

Input and output password should be specified in the appropriate text box. If password is empty, file won't be decrypted / encrypted.

DOCX Encryption Screenshot
Upload your file (Drag file here)
using GemBox.Document;

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

        string inputPassword = "%InputPassword%";
        string outputPassword = "%OutputPassword%";

        var document = DocumentModel.Load("%InputFileName%", new DocxLoadOptions() { Password = inputPassword });

        document.Save("DOCX Encryption.docx", new DocxSaveOptions() { Password = outputPassword });
Imports GemBox.Document

Module Program

    Sub Main()

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

        Dim inputPassword As String = "%InputPassword%"
        Dim outputPassword As String = "%OutputPassword%"

        Dim document = DocumentModel.Load("%InputFileName%", New DocxLoadOptions With {.Password = inputPassword})
        document.Save("DOCX Encryption.docx", New DocxSaveOptions With {.Password = outputPassword})

    End Sub

End Module

Check next example or download examples from GitHub.