问题
When I use the code below to read an Excel 2010 file that has password protection enabled for the workbook:
using (FileStream file = new FileStream(fileName,
FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite))
{
ExcelPackage ep = new ExcelPackage();
try
{
ep = new ExcelPackage(file);
}
catch (Exception ex)
{
string strErr = ex.message;
}
}
...I get an exception. Any example code to read a Excel 2010 file that has password protection, using EPPlus?
回答1:
Faced with the same problem. In Excel 2010 encryption algorythm is differs from 2007. Fortunately EPPlus 4.0 Beta 2 was released. Works fine with 2010+, but can not yet decrypt 2007 excel.
来源:https://stackoverflow.com/questions/20671972/how-to-use-epplus-read-an-excel-2010-file-that-has-workbook-protection