Back to Devexpress

SpreadsheetControl.EncryptedFileIntegrityCheckFailed Event

windowsforms-devexpress-dot-xtraspreadsheet-dot-spreadsheetcontrol-f48fac3c.md

latest5.0 KB
Original Source

SpreadsheetControl.EncryptedFileIntegrityCheckFailed Event

Occurs when the encrypted file does not pass data integrity verification.

Namespace : DevExpress.XtraSpreadsheet

Assembly : DevExpress.XtraSpreadsheet.v25.2.dll

NuGet Package : DevExpress.Win.Spreadsheet

Declaration

csharp
public event EncryptedFileIntegrityCheckFailedEventHandler EncryptedFileIntegrityCheckFailed
vb
Public Event EncryptedFileIntegrityCheckFailed As EncryptedFileIntegrityCheckFailedEventHandler

Event Data

The EncryptedFileIntegrityCheckFailed event's data class is EncryptedFileIntegrityCheckFailedEventArgs. The following properties provide information specific to this event:

PropertyDescription
CancelGets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs.

Remarks

SpreadsheetControl uses the Hash-based message authentication code (HMAC) to verify the document data integrity. If the document did not pass the code verification, the EncryptedFileIntegrityCheckFailed event is raised and the following message window is shown.

Note

The HMAC is calculated only for certain encryption types. When you save a password encrypted workbook, set the EncryptionOptions.Type to the EncryptionType.Strong to calculate HMAC.

Example

This code snippet handles the SpreadsheetControl.EncryptedFileIntegrityCheckFailed event to perform certain actions when loading a corrupted password encrypted file.

View Example

csharp
private void SpreadsheetControl1_EncryptedFileIntegrityCheckFailed(object sender, EncryptedFileIntegrityCheckFailedEventArgs e) {
    e.Cancel = true;
    e.Handled = true;
    MessageBox.Show("File is corrupted. Cannot load.","Warning");
}
vb
Private Sub SpreadsheetControl1_EncryptedFileIntegrityCheckFailed(ByVal sender As Object, ByVal e As EncryptedFileIntegrityCheckFailedEventArgs)
    e.Cancel = True
    e.Handled = True
    MessageBox.Show("File is corrupted. Cannot load.","Warning")
End Sub

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the EncryptedFileIntegrityCheckFailed event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-spreadsheet-load-and-save-a-password-encrypted-files/CS/EncryptionExample/Form1.cs#L21

csharp
// The EncryptedFileIntegrityCheckFailed event allows you to perform custom actions when trying to load a corrupted file.
spreadsheetControl1.EncryptedFileIntegrityCheckFailed += SpreadsheetControl1_EncryptedFileIntegrityCheckFailed;
// If

winforms-spreadsheet-load-and-save-a-password-encrypted-files/VB/EncryptionExample/Form1.vb#L19

vb
' The EncryptedFileIntegrityCheckFailed event allows you to perform custom actions when trying to load a corrupted file.
AddHandler spreadsheetControl1.EncryptedFileIntegrityCheckFailed, AddressOf SpreadsheetControl1_EncryptedFileIntegrityCheckFailed
' If

See Also

SpreadsheetControl Class

SpreadsheetControl Members

DevExpress.XtraSpreadsheet Namespace