Class ExcelEncryptionException
Thrown when an encrypted workbook cannot be opened. Inspect Reason to decide what to do: only PasswordRequired and PasswordIncorrect are worth prompting a user about — the other two are terminal, and retrying with another password will never help.
public sealed class ExcelEncryptionException : IOException, ISerializable
- Inheritance
-
ExcelEncryptionException
- Implements
- Inherited Members
Constructors
ExcelEncryptionException()
Creates an exception with no message.
[ExcludeFromCodeCoverage]
public ExcelEncryptionException()
ExcelEncryptionException(ExcelEncryptionReason, string)
Initializes a new instance with the given reason and message.
public ExcelEncryptionException(ExcelEncryptionReason reason, string message)
Parameters
reasonExcelEncryptionReasonWhy the workbook could not be opened.
messagestringA human-readable description.
ExcelEncryptionException(ExcelEncryptionReason, string, Exception)
Initializes a new instance with the given reason, message and inner exception.
public ExcelEncryptionException(ExcelEncryptionReason reason, string message, Exception innerException)
Parameters
reasonExcelEncryptionReasonWhy the workbook could not be opened.
messagestringA human-readable description.
innerExceptionExceptionThe underlying failure.
ExcelEncryptionException(string)
Creates an exception with the given message.
[ExcludeFromCodeCoverage]
public ExcelEncryptionException(string message)
Parameters
messagestring
ExcelEncryptionException(string, Exception)
Creates an exception with the given message and inner exception.
[ExcludeFromCodeCoverage]
public ExcelEncryptionException(string message, Exception innerException)
Parameters
ExcelEncryptionException(string?, int)
Initializes a new instance with the given message and HRESULT. This is used when the underlying COM call fails, and the HRESULT is preserved for diagnostic purposes.
[ExcludeFromCodeCoverage]
public ExcelEncryptionException(string? message, int hresult)
Parameters
messagestringA human-readable description.
hresultintThe HRESULT returned by the underlying COM call.
Properties
Reason
Gets the reason the workbook could not be opened.
public ExcelEncryptionReason Reason { get; }