DocumentBase.PasswordEncryptionAlgorithm 属性

获取 Microsoft Office Word 在用密码对文档加密时使用的算法。

命名空间:  Microsoft.Office.Tools.Word
程序集:  Microsoft.Office.Tools.Word.v4.0.Utilities(在 Microsoft.Office.Tools.Word.v4.0.Utilities.dll 中)

语法

声明
Public ReadOnly Property PasswordEncryptionAlgorithm As String
public string PasswordEncryptionAlgorithm { get; }

属性值

类型:System.String
Microsoft Office Word 在用密码对文档加密时使用的算法。

备注

使用 SetPasswordEncryptionOptions 方法指定 Word 在用密码对文档加密时使用的算法。

示例

下面的代码示例在使用的密码加密算法为“OfficeXor”时将密码加密设置为更强的加密。 若要使用此示例,请从文档级项目内的 ThisDocument 类中运行此示例。

Private Sub DocumentPasswordEncryptionAlgorithm()
    If Me.PasswordEncryptionAlgorithm = "OfficeXor" 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 
private void DocumentPasswordEncryptionAlgorithm()
{
    if (this.PasswordEncryptionAlgorithm == "OfficeXor")
    {
        string PasswordEncryptionProvider = "Microsoft RSA SChannel Cryptographic Provider";
        string PasswordEncryptionAlgorithm ="RC4";
        int PasswordEncryptionKeyLength = 56;
        object PasswordEncryptionFileProperties = true;

        this.SetPasswordEncryptionOptions(PasswordEncryptionProvider,
            PasswordEncryptionAlgorithm, PasswordEncryptionKeyLength,
            ref PasswordEncryptionFileProperties);
    }
}

.NET Framework 安全性

请参见

参考

DocumentBase 类

Microsoft.Office.Tools.Word 命名空间