https://issues.apache.org/bugzilla/show_bug.cgi?id=51533
Bug #: 51533
Summary: XSSFWorksheet setSheetName throws
FormulaParseException on shared formula.
Product: POI
Version: 3.8-dev
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: minor
Priority: P2
Component: XSSF
AssignedTo: [email protected]
ReportedBy: [email protected]
Classification: Unclassified
Changing sheet name on an Excel 2010 worksheet using XSSFWorksheet generates
the following error during the XSSFormulaUtils.updateSheetName() method.
Note: 'C' in first line was an unprintable character.
Parse error near char 0 'C' in specified formula ''. Expected cell ref or
constant literal
at org.apache.poi.ss.formula.FormulaParser.expected(FormulaParser.java:217)
at
org.apache.poi.ss.formula.FormulaParser.parseSimpleFactor(FormulaParser.java:1122)
at
org.apache.poi.ss.formula.FormulaParser.percentFactor(FormulaParser.java:1077)
at
org.apache.poi.ss.formula.FormulaParser.powerFactor(FormulaParser.java:1064)
at org.apache.poi.ss.formula.FormulaParser.Term(FormulaParser.java:1424)
at
org.apache.poi.ss.formula.FormulaParser.additiveExpression(FormulaParser.java:1524)
at
org.apache.poi.ss.formula.FormulaParser.concatExpression(FormulaParser.java:1508)
at
org.apache.poi.ss.formula.FormulaParser.comparisonExpression(FormulaParser.java:1465)
at
org.apache.poi.ss.formula.FormulaParser.unionExpression(FormulaParser.java:1445)
at org.apache.poi.ss.formula.FormulaParser.parse(FormulaParser.java:1566)
at org.apache.poi.ss.formula.FormulaParser.parse(FormulaParser.java:174)
at
org.apache.poi.xssf.usermodel.helpers.XSSFFormulaUtils.updateFormula(XSSFFormulaUtils.java:125)
at
org.apache.poi.xssf.usermodel.helpers.XSSFFormulaUtils.updateSheetName(XSSFFormulaUtils.java:106)
at
org.apache.poi.xssf.usermodel.XSSFWorkbook.setSheetName(XSSFWorkbook.java:1130)
The XSSFFormulaUtils.updateFormula() method retrieves the string value of the
cell's F-node (function), which returns a valid but empty string (''). The
NULL-check prior to attempting to parse the formula doesn't handle the empty
string. These empty F-node strings are generated on a shared formula cell.
An example of this cell is:
<c r="E6" s="22">
<f t="shared" si="0" />
<v>8</v>
</c>
Other formula read and resolution methods correctly handle shared formula
definitions.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]