This project has moved and is read-only. For the latest updates, please go here.

Error in open file with name

Jan 29, 2011 at 12:05 PM


If an EXCEL file contains name, when open with EPPlus encountered with error.

In an excel file, insert a name and set "Refers to: " to a number (for example Refers to = 1). Now if open this file with epplus the "Object reference not set to an instance of an object." error is generated.

                var fi = new FileInfo(iFileName);
                ExcelApp = new ExcelPackage(fi);
                ObjBook = ExcelApp.Workbook;    ----> exception raised in this line

Thanks a lot.

Jan 30, 2011 at 6:51 PM


Yes, I realized the library has some problemes with certain types of defined names...

  • If you have a name that has a #REF! (on worksheet level)
  • If you have a name that reference a value or a formula
  • If you have a name that reference an external worksheet.

If you have one of these type of defined names the library will throw an exception when loading the file.

Since this will cause the library to crash, I will try to add a fix for it as soon as possible.