其他分享
首页 > 其他分享> > POI修改sheetName报Second part of cell reference expected after sheet name at index 19错误

POI修改sheetName报Second part of cell reference expected after sheet name at index 19错误

作者:互联网

执行workbook.setSheetName(workbook.getSheetIndex(outputSheet), "68");出异常,找了很久都不知道怎么解决,后来才发现是模板的Excel出了问题,模板Excel里存在许多错误的公式,吐血~~~~~

2021-02-07 17:02:59,762 [http-nio-8080-exec-9] ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [/mps] threw exception [Request processing failed; nested exception is java.lang.Exception: org.apache.poi.ss.formula.FormulaParseException: Second part of cell reference expected after sheet name at index 19.] with root cause
org.apache.poi.ss.formula.FormulaParseException: Second part of cell reference expected after sheet name at index 19.
    at org.apache.poi.ss.formula.FormulaParser.parseRangeable(FormulaParser.java:579)
    at org.apache.poi.ss.formula.FormulaParser.parseRangeExpression(FormulaParser.java:322)
    at org.apache.poi.ss.formula.FormulaParser.parseSimpleFactor(FormulaParser.java:1548)
    at org.apache.poi.ss.formula.FormulaParser.percentFactor(FormulaParser.java:1506)
    at org.apache.poi.ss.formula.FormulaParser.powerFactor(FormulaParser.java:1493)
    at org.apache.poi.ss.formula.FormulaParser.Term(FormulaParser.java:1867)
    at org.apache.poi.ss.formula.FormulaParser.additiveExpression(FormulaParser.java:1994)
    at org.apache.poi.ss.formula.FormulaParser.concatExpression(FormulaParser.java:1978)
    at org.apache.poi.ss.formula.FormulaParser.comparisonExpression(FormulaParser.java:1935)
    at org.apache.poi.ss.formula.FormulaParser.intersectionExpression(FormulaParser.java:1908)
    at org.apache.poi.ss.formula.FormulaParser.unionExpression(FormulaParser.java:1889)
    at org.apache.poi.ss.formula.FormulaParser.parse(FormulaParser.java:2036)
    at org.apache.poi.ss.formula.FormulaParser.parse(FormulaParser.java:170)
    at org.apache.poi.xssf.usermodel.helpers.XSSFFormulaUtils.updateName(XSSFFormulaUtils.java:141)
    at org.apache.poi.xssf.usermodel.helpers.XSSFFormulaUtils.updateSheetName(XSSFFormulaUtils.java:78)
    at org.apache.poi.xssf.usermodel.XSSFWorkbook.setSheetName(XSSFWorkbook.java:1631)

解决方法:清除Excel里奇奇怪怪无效的,不是你写的公式,可全选清了

 

 

标签:index,FormulaParser,sheet,name,java,formula,poi,apache,org
来源: https://blog.csdn.net/qq_34357018/article/details/113744082