Excel Decryption for XLS
The following example shows how you can use GemBox.Spreadsheet to load an encrypted XLS file and save it as a decrypted XLS file in C# and VB.NET.
using GemBox.Spreadsheet;
class Program
{
static void Main()
{
// If using the Professional version, put your serial key below.
SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY");
var inputPassword = "%InputPassword%";
var workbook = ExcelFile.Load("%InputFileName%",
new XlsLoadOptions() { Password = inputPassword });
workbook.Save("Decrypted File.xls");
}
}
Imports GemBox.Spreadsheet
Module Program
Sub Main()
' If using the Professional version, put your serial key below.
SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY")
Dim inputPassword = "%InputPassword%"
Dim workbook = ExcelFile.Load("%InputFileName%",
New XlsLoadOptions With {.Password = inputPassword})
workbook.Save("Decrypted File.xls")
End Sub
End Module
Note that GemBox.Spreadsheet currently doesn't support encrypting XLS files (saving password protected XLS files), but it does support encrypting XLSX files.