You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2009/02/12 07:06:06 UTC
DO NOT REPLY [Bug 46700] New: FormulaParseException thrown, when
XSSFRow.shift(...) is called.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46700
Summary: FormulaParseException thrown, when XSSFRow.shift(...) is
called.
Product: POI
Version: 3.5-dev
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P2
Component: XSSF
AssignedTo: dev@poi.apache.org
ReportedBy: matthew.knl@gmail.com
Created an attachment (id=23249)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=23249)
excel file for test
I use POI to open the attached "test.xlsx", call XSSFRow.shift(...) to shift 1
row. But if failed and throw FormulaParseException, it may be caused by the
named ranged specified in the formula.
Sample Code:
--
Workbook wb = new XSSFWorkbook("test.xlsx");
Sheet sheet = wb.getSheet("Test");
sheet.shiftRows(4, sheet.getLastRowNum(), 1, true, true);
wb.write(new FileOutputStream("output.xlsx"));
Exception Details:
--
org.apache.poi.ss.formula.FormulaParser$FormulaParseException: Specified named
range 'HSI' does not exist in the current workbook.
at
org.apache.poi.ss.formula.FormulaParser.parseNameOrCellRef(FormulaParser.java:440)
at
org.apache.poi.ss.formula.FormulaParser.parseRangeExpression(FormulaParser.java:336)
at
org.apache.poi.ss.formula.FormulaParser.parseFunctionReferenceOrName(FormulaParser.java:332)
at
org.apache.poi.ss.formula.FormulaParser.parseSimpleFactor(FormulaParser.java:733)
at
org.apache.poi.ss.formula.FormulaParser.percentFactor(FormulaParser.java:693)
at
org.apache.poi.ss.formula.FormulaParser.powerFactor(FormulaParser.java:680)
at org.apache.poi.ss.formula.FormulaParser.Term(FormulaParser.java:982)
at
org.apache.poi.ss.formula.FormulaParser.additiveExpression(FormulaParser.java:1083)
at
org.apache.poi.ss.formula.FormulaParser.concatExpression(FormulaParser.java:1067)
at
org.apache.poi.ss.formula.FormulaParser.comparisonExpression(FormulaParser.java:1024)
at
org.apache.poi.ss.formula.FormulaParser.Arguments(FormulaParser.java:665)
at
org.apache.poi.ss.formula.FormulaParser.function(FormulaParser.java:562)
at
org.apache.poi.ss.formula.FormulaParser.parseFunctionReferenceOrName(FormulaParser.java:324)
at
org.apache.poi.ss.formula.FormulaParser.parseSimpleFactor(FormulaParser.java:733)
at
org.apache.poi.ss.formula.FormulaParser.percentFactor(FormulaParser.java:693)
at
org.apache.poi.ss.formula.FormulaParser.powerFactor(FormulaParser.java:680)
at org.apache.poi.ss.formula.FormulaParser.Term(FormulaParser.java:982)
at
org.apache.poi.ss.formula.FormulaParser.additiveExpression(FormulaParser.java:1083)
at
org.apache.poi.ss.formula.FormulaParser.concatExpression(FormulaParser.java:1067)
at
org.apache.poi.ss.formula.FormulaParser.comparisonExpression(FormulaParser.java:1024)
at
org.apache.poi.ss.formula.FormulaParser.unionExpression(FormulaParser.java:1003)
at
org.apache.poi.ss.formula.FormulaParser.parse(FormulaParser.java:1125)
at
org.apache.poi.ss.formula.FormulaParser.parse(FormulaParser.java:192)
at org.apache.poi.xssf.usermodel.XSSFRow.shiftFormula(XSSFRow.java:454)
at org.apache.poi.xssf.usermodel.XSSFRow.shift(XSSFRow.java:426)
at
org.apache.poi.xssf.usermodel.XSSFSheet.shiftRows(XSSFSheet.java:1457)
at com.dttn.excel.connector.TestPOI.main(TestPOI.java:98)
--
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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 46700] FormulaParseException thrown, when
XSSFRow.shift(...) is called.
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46700
Yegor Kozlov <ye...@dinom.ru> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
--- Comment #1 from Yegor Kozlov <ye...@dinom.ru> 2009-02-26 00:21:11 PST ---
shiftRows fails because of an unknown name UOM. This undefined name is used in
formulas in the cells H2 and H3, and also in the data validation rule for J3.
The formula in H2 that can't be parsed looks as follows:
IF(ISERROR(VLOOKUP("",UOM,2,FALSE)),"",VLOOKUP("",UOM,2,FALSE))
Shifting a formula in XSSF includes the following operations:
- parse formula into an array of tokens (Ptgs)
- update column and row references of the parsed tokens according to the
shifting rule
- serialize the updated Ptgs into string
- update the formula value in the cell
To parse a formula all its parts must be defined. If FormulaParser fails to
resolve a token it throws FormulaParseException as in your case.
Please note, that FormulaParser has been recently updated to handle names with
backslashes. With this change the exception message is different from reported.
Current code in trunk throws
org.apache.poi.ss.formula.FormulaParser$FormulaParseException: Specified named
range 'UOM' does not exist in the current workbook.
Yegor
--
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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org