Back to Devexpress

DocumentSettings.Encryption Property

officefileapi-devexpress-dot-spreadsheet-dot-documentsettings-a7af32bc.md

latest2.7 KB
Original Source

DocumentSettings.Encryption Property

Provides access to the document encryption options used to save a password encrypted document.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
EncryptionOptions Encryption { get; }
vb
ReadOnly Property Encryption As EncryptionOptions

Property Value

TypeDescription
EncryptionOptions

A EncryptionOptions object that represents the document encryption settings.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to Encryption
IWorkbook

.DocumentSettings .Encryption

| | Workbook |

.DocumentSettings .Encryption

|

Example

This code snippet obtains the DocumentSettings.Encryption settings selected in the editors and prompts for saving a password encrypted file.

View Example

csharp
IWorkbook workbook = spreadsheetControl1.Document;
workbook.DocumentSettings.Encryption.Type = (EncryptionType)Enum.Parse(typeof(EncryptionType), barEncryptionTypeComboBox.EditValue.ToString());
workbook.DocumentSettings.Encryption.Password = barPasswordEdit.EditValue.ToString();
spreadsheetControl1.SaveDocumentAs();
vb
Dim workbook As IWorkbook = spreadsheetControl1.Document
workbook.DocumentSettings.Encryption.Type = DirectCast(System.Enum.Parse(GetType(EncryptionType), barEncryptionTypeComboBox.EditValue.ToString()), EncryptionType)
workbook.DocumentSettings.Encryption.Password = barPasswordEdit.EditValue.ToString()
spreadsheetControl1.SaveDocumentAs()

See Also

DocumentSettings Interface

DocumentSettings Members

DevExpress.Spreadsheet Namespace