

Try Again? (y/n)")ĭim answer As String = Console.ReadLine()?.ToLower()
Unibox spreadsheet password password#
'If the password is invalid, ask user whether to continue the operation:Ĭase SpreadsheetDecryptionError.WrongPasswordĬonsole.WriteLine("The password is incorrect. 'If the password is empty, raise the request againĬase SpreadsheetDecryptionError.PasswordRequiredĬonsole.WriteLine("You did not enter the password!") Private Shared Sub Workbook_EncryptedFilePasswordCheckFailed(ByVal sender As Object, ByVal e As EncryptedFilePasswordCheckFailedEventArgs) Private Shared Sub Workbook_EncryptedFilePasswordRequest(ByVal sender As Object, ByVal e As EncryptedFilePasswordRequestEventArgs) Workbook.LoadDocument("Documents\encrypted.xlsx") Private Shared Property IsValid As BooleanĪddHandler workbook.EncryptedFilePasswordRequest, AddressOf Workbook_EncryptedFilePasswordRequestĪddHandler workbook.EncryptedFilePasswordCheckFailed, AddressOf Workbook_EncryptedFilePasswordCheckFailedĪddHandler workbook.InvalidFormatException, AddressOf Workbook_InvalidFormatException Private static void Workbook_InvalidFormatException(object sender, SpreadsheetInvalidFormatExceptionEventArgs e)Ĭonsole.WriteLine(e.() + " Press any key to close.") If user cancels the operation, show an exception message: String answer = Console.ReadLine()?.ToLower() If the password is invalid, ask user whether to continue the operation:Ĭase SpreadsheetDecryptionError.WrongPassword:Ĭonsole.WriteLine("The password is incorrect. If the password is empty, raise the request againĬase SpreadsheetDecryptionError.PasswordRequired:Ĭonsole.WriteLine("You did not enter the password!")

Private static void Workbook_EncryptedFilePasswordCheckFailed(object sender, EncryptedFilePasswordCheckFailedEventArgs e) Private static void Workbook_EncryptedFilePasswordRequest(object sender, EncryptedFilePasswordRequestEventArgs e)

Workbook.LoadDocument("Documents\\encrypted.xlsx") Workbook.InvalidFormatException += Workbook_InvalidFormatException Workbook.EncryptedFilePasswordCheckFailed += Workbook_EncryptedFilePasswordCheckFailed Workbook.EncryptedFilePasswordRequest += Workbook_EncryptedFilePasswordRequest If the user cancels the operation, the Spreadsheet Document API shows an exception message and cancels loading the file.
Unibox spreadsheet password how to#
The code sample below shows how to handle the Workbook.EncryptedFilePasswordRequest and Workbook.EncryptedFilePasswordCheckFailed events to prompt users to enter a password. Occurs when the EncryptedFilePasswordCheckFailedEventArgs.TryAgain property is set to false. Handle this event to obtain the error that led to this event ( EncryptedFilePasswordCheckFailedEventArgs.Error) and determine whether to prompt a user for a password ( EncryptedFilePasswordCheckFailedEventArgs.TryAgain). Raised if the EncryptedFilePasswordRequestEventArgs.Password is set to an empty or invalid password. Workbook.EncryptedFilePasswordCheckFailed Use the EncryptedFilePasswordRequestEventArgs.Password property to specify a new password.

Raised if the Password property is not specified or returns an invalid password. The table below lists a chain of events raised if the Password property is not specified or returns an invalid password. Specify the WorkbookImportOptions.Password property to decrypt a loaded file. The Spreadsheet Document API can open and save password encrypted files in binary (.xls. How to: Open and Save Password-Encrypted Files
