DocumentBase.PasswordEncryptionFileProperties 属性

定义

获取一个值,用于指示 Microsoft Office Word 是否对受密码保护的文档的文件属性进行加密。

public bool PasswordEncryptionFileProperties { get; }

属性值

Boolean

如果 Microsoft Office Word 对受密码保护的文档的文件属性进行加密,则为 true;否则为 false

示例

如果未对受密码保护的文档的文件属性进行加密,下面的代码示例将设置密码加密选项。 若要使用此示例,请在 ThisDocument 文档级项目的类中运行它。

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 

注解

使用 SetPasswordEncryptionOptions 方法指定 Word 是否对受密码保护的文档的文件属性进行加密。

适用于