共用方式為


DocumentBase.PasswordEncryptionFileProperties 屬性

取得值,指出 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 PasswordEncryptionFileProperties As Boolean
    Get
public bool PasswordEncryptionFileProperties { get; }

屬性值

型別:System.Boolean
如果 Microsoft Office Word 會加密受密碼保護文件的檔案屬性,則為 true,否則為 false。

備註

使用 SetPasswordEncryptionOptions 方法,指定 Word 是否會加密受密碼保護文件的檔案屬性。

範例

下列範例中,如果未加密受密碼保護文件的檔案屬性,程式碼就會設定密碼加密選項。 若要使用這個範例,請在文件層級專案中的 ThisDocument 類別執行。

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 
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);
    }
}

.NET Framework 安全性

請參閱

參考

DocumentBase 類別

Microsoft.Office.Tools.Word 命名空間