以下代码为我提供了 Apache POI 目前不支持的所有函数的列表:
Collection<String> unsupportedFuncs = WorkbookEvaluator.getNotSupportedFunctionNames();
for (String unsupportedFunc : unsupportedFuncs) {
System.out.println(unsupportedFunc);
}
我对特定 Excel 文件中不支持的函数/公式更感兴趣。有没有办法获取这些函数的列表?
我已经“手动”完成了此操作,方法是遍历所有工作表的所有单元格,检查它是否属于公式类型,将其添加到列表中,并通过删除重复项将此列表调整为上面的列表(请参阅我的 GitHub 上的项目“UnsupportedFormulas”: https://github.com/Joey73/poi )。
有没有更简单、更好的方法来做到这一点?
最佳答案
关于Apache POI examples正是你想要的
CheckFunctionsSupported 的 javadoc 将其描述为:
Attempts to re-evaluate all the formulas in the workbook, and reports what (if any) formula functions used are not (currently) supported by Apache POI.
This provides examples of how to evaluate formulas in excel files using Apache POI, along with how to handle errors whilst doing so.
您可以在 POI Examples jar 中找到该程序,或者您可以获取 the source from SVN 。针对您的文件运行该程序,输出将告诉您不支持使用的任何公式函数,以及遇到的公式计算错误
关于java - 文件中不支持的函数列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27689108/