DocumentBase.PasswordEncryptionFileProperties Property

 

Gets a value that indicates whether Microsoft Office Word encrypts file properties for password-protected documents.

Namespace:   Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

public bool PasswordEncryptionFileProperties { get; }

Property Value

Type: System.Boolean

true if Microsoft Office Word encrypts file properties for password-protected documents; otherwise, false.

Use the SetPasswordEncryptionOptions method to specify whether Word encrypts file properties for password-protected documents.

The following code example sets the password encryption options if the file properties are not encrypted for password-protected documents. To use this example, run it from the ThisDocument class in a document-level project.

private void DocumentPasswordEncryptionFileProperties()
{
    if (this.PasswordEncryptionFileProperties == false)
    {
        string PasswordEncryptionProvider = "Microsoft RSA SChannel Cryptographic Provider";
        string PasswordEncryptionAlgorithm = "RC4";
        int PasswordEncryptionKeyLength = 56;
        object PasswordEncryptionFileProperties = true;

        this.SetPasswordEncryptionOptions(PasswordEncryptionProvider,
            PasswordEncryptionAlgorithm, PasswordEncryptionKeyLength,
            ref PasswordEncryptionFileProperties);
    }
}
Return to top
Show: