共用方式為


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 命名空間