Error: System.IO.FileNotFoundException: Could not load file or assembly 'DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.

Last Reply on Aug 28, 2016 10:46 PM By AjayP

Posted on Aug 22, 2016 04:15 AM

Ref : http://www.aspsnippets.com/Articles/Export-data-from-SQL-Server-to-Excel-in-ASPNet-using-C-and-VBNet.aspx

Hi,
The above solution working fine in local, but showing the below error on click of button to export the excel on Godaddy hosting.

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.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.IO.FileNotFoundException: 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.

You are viewing reply posted by: AjayP on Aug 28, 2016 10:46 PM.
Posted on Aug 28, 2016 10:46 PM

I've added the assemblies reference of dll in web.config file. Now it's working fine.