简体   繁体   中英

How to use EPPlus read an Excel 2010 file that has workbook protection?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM