Apache POI 4.1 - new XSSFWorkbook causes POIXMLException: Strict OOXML isn't currently supported

Solution 1:

I use a slightly modified version of @PJFanning's ooxml converter https://github.com/pjfanning/ooxml-strict-converter to check for and convert strict Excel workbooks (as streams) and then read them with POI. In limited testing it seems to work, although the files I have are pretty straight-forward.

To detect, I wrap the InputStream with a BufferedInputStream and then peek into the XML inside the Zip file (xlsx files are actually a collection of XML files in a zip file) looking for the namespace markers that indicate that it is in strict format.