Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Namespace error OfficeOpenXML EPPlus

I'm having difficulty setting up EPPlus in Visual Studio 2012.

using OfficeOpenXML;
The type or namespace name 'OfficeOpenXML' could not be found(are you missing a using directive or an assembly reference?)

Now I tried 2 different ways to set EPPlus up.

I manually added a Project->Add Reference to the Epplus.dll file in my documents.

I also tried to use NuGet package manager console: PM> Install-Package EPPlus

I clearly see EPPlus is added to the References in my project, but the namespace for OfficeOpenXML is not added. How do I add this namespace with the EPPlus reference?

like image 679
user99999991 Avatar asked Jul 09 '13 14:07

user99999991


3 Answers

I believe this is just a problem of casing. This:

using OfficeOpenXML;

should be:

using OfficeOpenXml;

Note the lower case "M" and "L" at the end.

I say that based only on the sample code...

like image 175
Jon Skeet Avatar answered Oct 13 '22 00:10

Jon Skeet


I had only installed DocumentFormat.OpenXml and the reference would not work despite following other sources on the net.

I had to install, through NuGet, both DocumentFormat.OpenXml AND EPPlus to get the reference to work.

That fixed this for me.

like image 31
Spencer Sullivan Avatar answered Oct 13 '22 01:10

Spencer Sullivan


I had the same issue, check that your project's Target Framework (Right click on your project -> Properties, check "Target framework") is not set to any .NET framework X "Client Profile" frameworks. Client profile is a minified version of whatever framework you are using.

With regards to EPPlus, your project must be using the full framework and not any "Client Profile" frameworks

like image 40
Jason Loki Smith Avatar answered Oct 12 '22 23:10

Jason Loki Smith