This project has moved. For the latest updates, please go here.

Unable to use Save / SaveAs TypeLoadException

Sep 4, 2013 at 11:36 AM

Many thanks for all your great work on this but I seem to have come up with an issue when saving a file. I get the following error:

Could not load type 'DocumentFormat.OpenXml.Spreadsheet.SmartTags' from assembly 'DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Code is as follows:
        var wb = new XLWorkbook(filename);
        var ws = wb.Worksheet("All DATA");
        ws.Cell("BH4").Value = "Result";
        ws.Cell("BI4").Value = "Validations";

Excel file was written in Excel2010

Im using:
.NET Framework 4.5
DocumentFormat.OpenXml 2.5.5631.0

Please could you assist me and point me in the best direction?

Many thanks

Sep 4, 2013 at 3:49 PM
Use DocumentFormat.OpenXml 2.0

Are you using Nuget? If so, it could be that my package is not configured correctly and it's picking up the latest DocumentFormat dll instead of the 2.0 one.

Sep 4, 2013 at 3:58 PM
Thanks for that. I've figured it out and it was due to pulling down a later version of OpenXml from Nuget and then pulling down ClosedXml which caused the confusion in the solution so you were spot on. Many thanks for getting back to me :)