共用方式為


DocumentBase.PasswordEncryptionFileProperties Property

Definition

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

public:
 property bool PasswordEncryptionFileProperties { bool get(); };
public bool PasswordEncryptionFileProperties { get; }
member this.PasswordEncryptionFileProperties : bool
Public ReadOnly Property PasswordEncryptionFileProperties As Boolean

Property Value

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

Examples

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);
    }
}
Private Sub DocumentPasswordEncryptionFileProperties()
    If Me.PasswordEncryptionFileProperties = False Then
        Dim PasswordEncryptionProvider As String = _
            "Microsoft RSA SChannel Cryptographic Provider"
        Dim PasswordEncryptionAlgorithm As String = "RC4"
        Dim PasswordEncryptionKeyLength As Integer = 56
        Dim PasswordEncryptionFileProperties As Object = True

        Me.SetPasswordEncryptionOptions(PasswordEncryptionProvider, PasswordEncryptionAlgorithm, PasswordEncryptionKeyLength, PasswordEncryptionFileProperties)
    End If
End Sub 

Remarks

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

Applies to