Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install Open XML 2.0

I'm trying to use spreadsheetlight to write to excel file, but apparently spreadsheetlight uses XML 2.0 and I have 2.5 installed. I've unistalled the 2.5 version and have added the 2.0 reference to my project, but I still get an error message telling me that I'm using the 2.5 version. And my question is simply: how do I get the compiler (?) to use the 2.0 version rather than the 2.5 version?

Sincerely Axel

like image 578
user2950764 Avatar asked Feb 13 '23 07:02

user2950764


1 Answers

So the issue appears to be the Spreadsheetlight nuget package is missing a required dependency specification in the Nuspec.

Install-Package DocumentFormat.OpenXml -Version 1.0.0


If you have already installed DocumentFormat.OpenXml and are getting an exception similar to Could not load type ‘DocumentFormat.OpenXml.Spreadsheet.SmartTags’ from assembly ‘DocumentFormat.OpenXml, Version=2.5.5631.0

UNinstall-Package DocumentFormat.OpenXml

Check your config files, if you have an assembly binding redirect

  <dependentAssembly>
    <assemblyIdentity name="DocumentFormat.OpenXml" publicKeyToken="31bf3856ad364e35"... />
    <bindingRedirect oldVersion="0.0.0.0-2.5.5631.0" newVersion="2.5.5631.0" />
  </dependentAssembly>

Delete this.

Now install the specific version:

Install-Package DocumentFormat.OpenXml -Version 1.0.0

Source: EricTummers.com Get Spreadsheetlight working

like image 185
Chris Marisic Avatar answered Feb 16 '23 04:02

Chris Marisic