OpenXML 2.5 not totally compatible to 2.0?

Dec 4, 2012 at 1:49 PM

Hi, i just discovered that MS released version 2.5 of the OpenXML SDK. I just tried to replace the DocumentFormat.OpenXML.dll with the new one.

My ClosedXML based program does not like it .... :(

System.TypeLoadException: Could not load type 'DocumentFormat.OpenXml.Spreadsheet.SmartTags' from assembly 'DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=
neutral, PublicKeyToken=31bf3856ad364e35'.
   at ClosedXML.Excel.XLWSContentManager..ctor(Worksheet opWorksheet)
   at ClosedXML.Excel.XLWorkbook.GenerateWorksheetPartContent(WorksheetPart worksheetPart, XLWorksheet xlWorksheet, SaveContext context)
   at ClosedXML.Excel.XLWorkbook.CreateParts(SpreadsheetDocument document)
   at ClosedXML.Excel.XLWorkbook.CreatePackage(String filePath)
   at ClosedXML.Excel.XLWorkbook.Save()

Best Regards,

Peter

Coordinator
Dec 4, 2012 at 4:43 PM

I'll skip the v2.5 because it doesn't really offer anything besides new Office 2013 tags and it's .NET 4.0 only.

Dec 9, 2012 at 9:00 AM
Understand.

Just found in the Documentation that Smarttags are deprecated with Excel 2010. Thats the reason why SDK2.5 does not support it any longer. At least it will become an issue in the future.

I havent found any information about Smarttags within the ClosedXML project. I assume that you don't support it anyway, right?
If thats the case, it could be removed, right now?
Oct 2, 2013 at 10:31 AM
Other than dropping back to OpenXML 2.0, is there a way around this issue?
Seems strange that a feature no longer supported in the base SDK is causing a break if ClosedXML doesn't support the feature in the first place.

Thanks.
Oct 3, 2013 at 12:59 AM
I've just tried compiling against OpenXML SDK 2.0 (1.0) and I still get the same error. Very confused.
I'm just going to have to pull down the ClosedXML source and remove the SmartTag reference.
Oct 3, 2013 at 1:28 AM
My bad. I feel I am always trying to catch up with latest 'features' of .NET...
Despite specifically installing OpenXML 2.0 (1.0) the same smart tag error would appear and reference v2.5 of the assembly.
Turns out I had a redirect in my web.config as follows:
<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="DocumentFormat.OpenXml" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-2.5.5631.0" newVersion="2.5.5631.0" />
        </dependentAssembly>
    </assemblyBinding>
</runtime>
as per the "Could not load file or assembly" error page:
LOG: Redirect found in application configuration file: 2.0.5022.0 redirected to 2.5.5631.0.
Beware!
Coordinator
Oct 3, 2013 at 3:57 AM
I just updated the Nuget package to pull the right DocumentFormat.OpenXml.dll

Sorry about that.
Marked as answer by SeanKilleen on 10/7/2013 at 12:55 PM
Feb 13 at 7:54 AM
About DocumentFormat.OpenXml and OpenXML SDK, and ClosedXML

Note: I have send message in nuget, for better support, I post here again.

DocumentFormat.OpenXml 2.5.0 uses Microsoft OpenXML SDK 2.5
http://www.nuget.org/packages/DocumentFormat.OpenXml/

Here Open XML SDK 2.0.0
http://www.nuget.org/packages/OpenXmlSdk/

ClosedXML has dependency DocumentFormat.OpenXml version 2.0.5022.0 (Open XML SDK 2.0.0 )
https://www.nuget.org/packages/ClosedXML


Questions:

1.) ClosedXML will be available for Microsoft OpenXML SDK 2.5 (DocumentFormat.OpenXml 2.5.0) ?

2.) http://www.nuget.org/packages/OpenXmlSdk/ will be available for OpenXML SDK 2.5?

Thx.
Sep 9 at 9:08 AM
The latest ClosedXML and OpenXML packages from Nuget are still not compatible. My application threw the exception

System.TypeLoadException: Could not load type 'DocumentFormat.OpenXml.Spreadsheet.SmartTags' from assembly 'DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=
neutral, PublicKeyToken=31bf3856ad364e35'.
at ClosedXML.Excel.XLWSContentManager..ctor(Worksheet opWorksheet)
at ClosedXML.Excel.XLWorkbook.GenerateWorksheetPartContent(WorksheetPart worksheetPart, XLWorksheet xlWorksheet, SaveContext context)
at ClosedXML.Excel.XLWorkbook.CreateParts(SpreadsheetDocument document)
at ClosedXML.Excel.XLWorkbook.CreatePackage(String filePath)
at ClosedXML.Excel.XLWorkbook.Save()

when I tried to use those 2 at the same time.
Coordinator
Sep 9 at 3:35 PM
You have to use OpenXML dll 2.0 with ClosedXML for .Net 3.5
OpenXML dll 2.5 works fine with ClosedXML for .Net 4+