SpreadsheetControl.EncryptedFileIntegrityCheckFailed Event

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

Namespace: DevExpress.XtraSpreadsheet

Assembly: DevExpress.XtraSpreadsheet.v21.2.dll


public event EncryptedFileIntegrityCheckFailedEventHandler EncryptedFileIntegrityCheckFailed

Event Data

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

Property Description
Cancel Gets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs.


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.



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.


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

View Example

private void SpreadsheetControl1_EncryptedFileIntegrityCheckFailed(object sender, EncryptedFileIntegrityCheckFailedEventArgs e) {
    e.Cancel = true;
    e.Handled = true;
    MessageBox.Show("File is corrupted. Cannot load.","Warning");
See Also