Bug 45348

Summary: sheet.shiftRows does not shifts the formula's effectively
Product: POI Reporter: Vinu Kumar <vinu.kumar>
Component: HSSFAssignee: POI Developers List <dev>
Severity: normal    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows Server 2003   
Attachments: XLS file for bug 45348

Description Vinu Kumar 2008-07-07 01:01:24 UTC
sheet.shiftRows does not shifts the formula's effectively. The new cells have errors in the formula shifted.
Comment 1 Vinu Kumar 2008-07-07 01:03:18 UTC
Created attachment 22219 [details]
XLS file for bug 45348
Comment 2 Vinu Kumar 2008-07-07 01:09:13 UTC
In the provided xls file run sheet.shiftRows(25,128,1); This will shift all the rows down by 1, but the formula in column 4 contains error.
Comment 3 Josh Micich 2008-07-08 18:58:52 UTC
Fixed in svn r675079.

This turned out to be a formula token class transformation problem.
The example code: cell.setCellFormula("sum(A1*1)") will reproduce this bug.  The RVA stuff was not well supported before (3.1), but as it turns out, POI 3.0.2 handled this particular situation OK.

Junit tests were added to cover this example.

BTW It looks like there might be other bugs in HSSFSheet.updateFormulasAfterShift().  For example, movement of area references is currently not supported. The example provided only involves single cell refs, which seem to be handled OK.