共用方式為


DocumentBase.PasswordEncryptionProvider 屬性

取得 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 PasswordEncryptionProvider As String
    Get
public string PasswordEncryptionProvider { get; }

屬性值

型別:System.String
Microsoft Office Word 以密碼加密文件時使用的演算法加密提供者名稱。

備註

使用 SetPasswordEncryptionOptions 方法,指定 Word 以密碼加密文件時使用的演算法加密提供者名稱。

範例

下列範例中,如果使用中的密碼加密演算法不是 "Microsoft RSA SChannel Cryptographic Provider",程式碼會設定密碼加密選項。若要使用這個範例,請在文件層級專案中的 ThisDocument 類別執行。

Private Sub DocumentPasswordEncryptionProvider()
    If Me.PasswordEncryptionProvider <> "Microsoft RSA SChannel Cryptographic Provider" 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 DocumentPasswordEncryptionProvider()
{
    if (this.PasswordEncryptionProvider != "Microsoft RSA SChannel Cryptographic Provider")
    {
        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 命名空間