且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

目前尚不支持org.apache.poi.POIXMLException严格的OOXML,请参见错误#57699

更新时间:2022-05-21 23:49:04

除了不要以严格的OOXML"格式保存电子表格"之外,目前似乎没有其他简单的解决方案.

There doesn't currently appear to be any simple solution other than "Don't save your spreadsheet in "strict OOXML" format."

例如,在Excel中使用

For example, in Excel use

Save As --> "Excel Workbook (.xlsx)" 

代替

Save As --> "Strict Open XML Spreadsheet (.xlsx)" 


您知道为什么Excel工作表和这种格式的文件扩展名相同吗?

Do you know why Excel Worksheet and this format have the same file extension?

那是只有微软才能回答的问题.但是我想工程师(或他们的管理人员)没有预期,应用软件必须对此加以区分.

That would be something that only Microsoft can answer. But I guess that the engineers (or their management) did not anticipate that it would be necessary for application software to make the distinction.

我接受文件作为输入,然后根据扩展名处理它们.没有try-catch我怎么知道?

I am accepting Files as input and then processing them based on the extension. How can I know without try-catch?

没有什么可以让您使用当前POI处理文档的.

There is nothing that will let you process the document with current generation POI.

我想您可以编写一些代码来读取文件,并在将文件传递给POI之前查找严格的OOXML"格式的签名 1 ,但这没有什么意义.您将只写一堆额外的代码,以便可以用其他逻辑替换try-catch.

I guess you could code something to read the file and look for the signature for "strict OOXML" format1 before passing the file to POI, but there's not much point. You would be writing a stack of extra code just so that you can replace the try-catch with other logic.

1-请参见 https://www .loc.gov/preservation/digital/formats/fdd/fdd000395.shtml#sign