Back to Devexpress

SpreadsheetControl.InvalidFormatException Event

windowsforms-devexpress-dot-xtraspreadsheet-dot-spreadsheetcontrol-7926955a.md

latest2.5 KB
Original Source

SpreadsheetControl.InvalidFormatException Event

Fires when the supplied data could not be recognized as data in the assumed format for import.

Namespace : DevExpress.XtraSpreadsheet

Assembly : DevExpress.XtraSpreadsheet.v25.2.dll

NuGet Package : DevExpress.Win.Spreadsheet

Declaration

csharp
public event InvalidFormatExceptionEventHandler InvalidFormatException
vb
Public Event InvalidFormatException As InvalidFormatExceptionEventHandler

Event Data

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

PropertyDescription
ExceptionGets the exception which triggers the InvalidFormatException event.
SourceUriGets the source location for the document which triggers the InvalidFormatException event.

Remarks

If the data for import is in an incorrect format, the control silently cancels import if the InvalidFormatException is not handled. If you subscribe to the InvalidFormatException event, the event is fired when the control attempts to load incorrect data, so you can provide custom logic in this situation.

To throw an exception on loading an invalid document, set the WorkbookImportOptions.ThrowExceptionOnInvalidDocument property to true (import options are accessible via the SpreadsheetControl.Document.Options.Import notation).

See Also

How to: Save a Document to a File

SpreadsheetControl Class

SpreadsheetControl Members

DevExpress.XtraSpreadsheet Namespace