Dela via


Workbook.SetPasswordEncryptionOptions Method

Sets the options for encrypting the workbook using a password.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)

Syntax

'Declaration
Sub SetPasswordEncryptionOptions ( _
    PasswordEncryptionProvider As Object, _
    PasswordEncryptionAlgorithm As Object, _
    PasswordEncryptionKeyLength As Object, _
    PasswordEncryptionFileProperties As Object _
)
void SetPasswordEncryptionOptions(
    Object PasswordEncryptionProvider,
    Object PasswordEncryptionAlgorithm,
    Object PasswordEncryptionKeyLength,
    Object PasswordEncryptionFileProperties
)

Parameters

  • PasswordEncryptionProvider
    Type: System.Object
    A case sensitive string of the encryption provider.
  • PasswordEncryptionAlgorithm
    Type: System.Object
    A case sensitive string of the algorithmic short name (i.e. "RC4").
  • PasswordEncryptionKeyLength
    Type: System.Object
    The encryption key length, which is a multiple of 8 (40 or greater).
  • PasswordEncryptionFileProperties
    Type: System.Object
    true (default) to encrypt file properties.

Remarks

The PasswordEncryptionProvider, PasswordEncryptionAlgorithm, and PasswordEncryptionKeyLength parameters are not independent of each other. A selected encryption provider limits the set of algorithms and key length that can be chosen.

For the PasswordEncryptionKeyLength parameter there is no inherent limit on the range of the key length. The range is determined by the Cryptographic Service Provider which also determines the cryptographic algorithm.

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

.NET Framework Security

See Also

Reference

Workbook Interface

Microsoft.Office.Tools.Excel Namespace