I had the same problem happening apparently only on not very updated Office 2010 Standard installations.
The (very dirty) workaround I found (deducing it from this useful post) is removing those extensions completely, as I didn't need them.
After saving the workbook with ClosedXML I used the OOXML library directly doing this (in both workbook.xml and styles.xml):
I hope this can be useful.
The (very dirty) workaround I found (deducing it from this useful post) is removing those extensions completely, as I didn't need them.
After saving the workbook with ClosedXML I used the OOXML library directly doing this (in both workbook.xml and styles.xml):
using (SpreadsheetDocument excelDoc = SpreadsheetDocument.Open(ms, true))
{
if (excelDoc.WorkbookPart.Workbook.Descendants<WorkbookExtensionList>().Any())
{
excelDoc.WorkbookPart.Workbook.RemoveAllChildren<WorkbookExtensionList>();
excelDoc.WorkbookPart.Workbook.Save();
}
if (excelDoc.WorkbookPart.WorkbookStylesPart.Stylesheet.Descendants<StylesheetExtensionList>().Any())
{
excelDoc.WorkbookPart.WorkbookStylesPart.Stylesheet.RemoveAllChildren<StylesheetExtensionList>();
excelDoc.WorkbookPart.WorkbookStylesPart.Stylesheet.Save();
}
}
As a note, it appears that fully updated Office 2010 Professional installation do not corrupt the files after saving, in my experience only Office 2010 Standard did this.I hope this can be useful.