Method Open
- Namespace
- DocWright.Spreadsheet.Security
- Assembly
- DocWright.Spreadsheet.Security.dll
Open(Stream, string?, XlsxReadSettings?)
Opens a workbook that may be encrypted: an encrypted one with its password, a plain one as Open(Stream, XlsxReadSettings?) opens it (the password is then not used).
public static XlsxDocument Open(Stream input, string? password, XlsxReadSettings? settings = null)
Parameters
inputStreamThe workbook, read from the stream's current position to its end; it is left open and not used after this returns.
passwordstringThe password the workbook was encrypted with, or null.
settingsXlsxReadSettingsThe options the workbook is opened with; its limits bound the decryption too.
Returns
- XlsxDocument
The workbook.
Exceptions
- ArgumentNullException
inputis null.- DocumentEncryptedException
The workbook is encrypted and no password was given, or its encryption is a kind not read.
- InvalidPasswordException
The password does not open it.
- DocumentIntegrityException
The encrypted payload fails its integrity check.
- ResourceLimitExceededException
The encryption asks for more spins than the limit, or the input passes a limit.
- InvalidDocumentException
The input, or what it decrypts to, is not a readable workbook.