Workbook.SaveDocument(String, EncryptionSettings) Method
Saves the document to a file in the Excel or text format with the specified encryption settings. The file format is identified by the file extension.
You require a license to the DevExpress Office File API or DevExpress Universal Subscription to use this method in production code.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Docs.v19.1.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
fileName | String | Specifies the file path to save the document. |
encryptionSettings | EncryptionSettings | Specifies encryption options. |
Remarks
The DocumentFormat enumeration lists the supported document formats. To export a file to PDF or HTML, use the Workbook.ExportToPdf and Workbook.ExportToHtml methods.
This SaveDocument method overload allows you to encrypt a workbook with a password, as shown below:
// Add a reference to the DevExpress.Docs.dll assembly.
using DevExpress.Spreadsheet;
// ...
Workbook workbook = new Workbook();
// ...
// Specify encryption settings.
EncryptionSettings encryptionSettings = new EncryptionSettings();
encryptionSettings.Type = DevExpress.Spreadsheet.EncryptionType.Strong;
encryptionSettings.Password = "password";
// Save the document.
workbook.SaveDocument("Document.xlsx", encryptionSettings);
Implements
See Also