You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Open-Xml-SDK will throw an OpenXmlPackageException with the message "The specified package is invalid. The main part is missing." when an excel file references fonts in worksheets that are not present on the system and the tag x14ac:knownFonts is found.
Information
.NET Target: .Net Framework 4.7.1
DocumentFormat.OpenXml Version: 2.8.1 and 2.9.0
Repro
We use Open-XML SDK to produce a file (with lots of data) that we give to 3rd parties scattered around the world. They edit that file and send them back for us to import (using Open-Xml SDK again).
Sometimes we have this error from the exception while loading the document using Open-Xml SDK: The specified package is invalid. The main part is missing.
If I save the file with my own Excel application (Excel 2016) prior to import it, I can import the file fine. So I've decompressed the xlsx files and compared both against each other (the one working and the one not working)
The only thing that was different is the presence of the tag x14ac:knownFonts https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.fonts.knownfonts?view=openxml-2.8.1 Value of the tag is 1. If I remove the worksheet that uses the fonts found in the styles.xml, I can load the document or if I remove the "knownfonts" tag and let the worksheets that reference those fonts: Open-Xml-SDK can open the file successfully again.
Observed
The excel app that was used to save the excel is the same version than me (2016), but installed in Korean language. Two of the fonts referenced have their name in asian characters so my wild guest is that I don't have those fonts on my system, and with the presence of the knownfonts, it causes Open-Xml to die painfully when trying to load that document.
Expected
I would expect that Open-Xml don't die when loading an excel document with if that tag is found (and fonts that I don't have on my system are referenced in that excel document). Excel do not die from actually: it allow me to open the document resave it (effectively removing that infamous "knownfonts" tag.
The text was updated successfully, but these errors were encountered:
Awesome. It'll probably be used for a unit test (although we can definitely remove all PII and make it super generic) if that matters for legal purposes.
Description
Open-Xml-SDK will throw an OpenXmlPackageException with the message "The specified package is invalid. The main part is missing." when an excel file references fonts in worksheets that are not present on the system and the tag x14ac:knownFonts is found.
Information
Repro
We use Open-XML SDK to produce a file (with lots of data) that we give to 3rd parties scattered around the world. They edit that file and send them back for us to import (using Open-Xml SDK again).
Sometimes we have this error from the exception while loading the document using Open-Xml SDK: The specified package is invalid. The main part is missing.
If I save the file with my own Excel application (Excel 2016) prior to import it, I can import the file fine. So I've decompressed the xlsx files and compared both against each other (the one working and the one not working)
The only thing that was different is the presence of the tag x14ac:knownFonts
https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.fonts.knownfonts?view=openxml-2.8.1 Value of the tag is 1. If I remove the worksheet that uses the fonts found in the styles.xml, I can load the document or if I remove the "knownfonts" tag and let the worksheets that reference those fonts: Open-Xml-SDK can open the file successfully again.
Observed
The excel app that was used to save the excel is the same version than me (2016), but installed in Korean language. Two of the fonts referenced have their name in asian characters so my wild guest is that I don't have those fonts on my system, and with the presence of the knownfonts, it causes Open-Xml to die painfully when trying to load that document.
Expected
I would expect that Open-Xml don't die when loading an excel document with if that tag is found (and fonts that I don't have on my system are referenced in that excel document). Excel do not die from actually: it allow me to open the document resave it (effectively removing that infamous "knownfonts" tag.
The text was updated successfully, but these errors were encountered: