Table of Contents

Class ExcelEncryptionException

Namespace
ExcelReader.Core.Reader
Assembly
ExcelReader.Core.dll

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

reason ExcelEncryptionReason

Why the workbook could not be opened.

message string

A 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

reason ExcelEncryptionReason

Why the workbook could not be opened.

message string

A human-readable description.

innerException Exception

The underlying failure.

ExcelEncryptionException(string)

Creates an exception with the given message.

[ExcludeFromCodeCoverage]
public ExcelEncryptionException(string message)

Parameters

message string

ExcelEncryptionException(string, Exception)

Creates an exception with the given message and inner exception.

[ExcludeFromCodeCoverage]
public ExcelEncryptionException(string message, Exception innerException)

Parameters

message string
innerException Exception

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

message string

A human-readable description.

hresult int

The HRESULT returned by the underlying COM call.

Properties

Reason

Gets the reason the workbook could not be opened.

public ExcelEncryptionReason Reason { get; }

Property Value

ExcelEncryptionReason