I am trying to use ClosedXML to produce excel documents within an application however when ever I try to run it I receive a could not load file or assembly server error.
Could not load file or assembly 'DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
I have seen several solution to this that include changing the 'Copy Local' value for the .dll in its properties and adding the assembly directly to the web.config.
I'm using Visual Studios 2010 and the dll properties does not include a 'copy local' entry. Then when I enter the following assembly in the web config I still get the same server error message. I got the assembly from the error message provided.
<add assembly="ClosedXML, Version=0.76.0.0, Culture=neutral, PublicKeyToken=fd1eb21b62ae805b"/>
ClosedXML is a . NET library for reading, manipulating and writing Excel 2007+ (. xlsx, . xlsm) files.
What can you do with this? ClosedXML allows you to create Excel files without the Excel application.
ClosedXML is an open source library created based on OpenXmlSdk. It's more user friendly. ClosedXML is a . NET library for reading, manipulating and writing Excel 2007+ (.
After going crazy searching for answers and finally posting a question, I came across the simplest answer and once I referenced the additional .dll everything worked correctly.
To use ClosedXML you must reference the DocumentFormat.OpenXml.dll:
DocumentFormat.OpenXml.dll for NET 4.0+
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With