Bug 56502 - shift Rows with External Formulas throws FormulaParseException
Summary: shift Rows with External Formulas throws FormulaParseException
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.10-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-08 12:35 UTC by apachebugzilla
Modified: 2014-07-31 15:12 UTC (History)
0 users



Attachments
lncore-7698_source.xlsx (11.62 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2014-05-08 12:35 UTC, apachebugzilla
Details

Note You need to log in before you can comment on or make changes to this bug.
Description apachebugzilla 2014-05-08 12:35:57 UTC
Created attachment 31600 [details]
lncore-7698_source.xlsx

If you have a Cell with External Formula ( LUCANET("Ist")) and you want to shift Rows, the
Rows will not be shift:

POIFSFileSystem fileSystem = new POIFSFileSystem(new FileInputStream("lncore-7698_source.xlsx"));

HSSFWorkbook workbook = new HSSFWorkbook(fileSystem);

HSSFSheet sheet = workbook.getSheetAt(0);

sheet.shiftRows(1, sheet.getLastRowNum(), 1);



Bug:

org.apache.poi.ss.formula.FormulaParseException: Parse error near char 0 '[' in specified formula '[1]!LUCANET("Ist")'. Expected number, string, or defined name
	at org.apache.poi.ss.formula.FormulaParser.expected(FormulaParser.java:219)
	at org.apache.poi.ss.formula.FormulaParser.parseNonRange(FormulaParser.java:549)
	at org.apache.poi.ss.formula.FormulaParser.parseRangeable(FormulaParser.java:429)
	at org.apache.poi.ss.formula.FormulaParser.parseRangeExpression(FormulaParser.java:268)
	at org.apache.poi.ss.formula.FormulaParser.parseSimpleFactor(FormulaParser.java:1119)
	at org.apache.poi.ss.formula.FormulaParser.percentFactor(FormulaParser.java:1079)
	at org.apache.poi.ss.formula.FormulaParser.powerFactor(FormulaParser.java:1066)
	at org.apache.poi.ss.formula.FormulaParser.Term(FormulaParser.java:1426)
	at org.apache.poi.ss.formula.FormulaParser.additiveExpression(FormulaParser.java:1526)
	at org.apache.poi.ss.formula.FormulaParser.concatExpression(FormulaParser.java:1510)
	at org.apache.poi.ss.formula.FormulaParser.comparisonExpression(FormulaParser.java:1467)
	at org.apache.poi.ss.formula.FormulaParser.unionExpression(FormulaParser.java:1447)
	at org.apache.poi.ss.formula.FormulaParser.parse(FormulaParser.java:1568)
	at org.apache.poi.ss.formula.FormulaParser.parse(FormulaParser.java:176)
	at org.apache.poi.xssf.usermodel.helpers.XSSFRowShifter.shiftFormula(XSSFRowShifter.java:189)
	at org.apache.poi.xssf.usermodel.helpers.XSSFRowShifter.updateRowFormulas(XSSFRowShifter.java:153)
	at org.apache.poi.xssf.usermodel.helpers.XSSFRowShifter.updateSheetFormulas(XSSFRowShifter.java:140)
	at org.apache.poi.xssf.usermodel.helpers.XSSFRowShifter.updateFormulas(XSSFRowShifter.java:127)
	at org.apache.poi.xssf.usermodel.XSSFSheet.shiftRows(XSSFSheet.java:2465)
	at org.apache.poi.xssf.usermodel.XSSFSheet.shiftRows(XSSFSheet.java:2399)
	at ApacheBugShiftRows.testFillRowsAndKeepGroupingXLSX(ApacheBugShiftRows.java:45)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:202)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:65)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Comment 1 apachebugzilla 2014-05-08 12:40:23 UTC
correct Example:


POIFSFileSystem fileSystem = new POIFSFileSystem(new FileInputStream("lncore-7698_source.xlsx"));

XSSFWorkbook workbook = new XSSFWorkbook(fileSystem);

XSSFSheet sheet = workbook.getSheetAt(0);

sheet.shiftRows(1, sheet.getLastRowNum(), 1);
Comment 2 Nick Burch 2014-07-31 15:12:33 UTC
As of r1614916, the shift can now be performed

(We still can't handle the formula, which seems to be a reference to a UDF in another file, but instead of failing we now log the problem and move onto the next cell)