Bug 45348 - sheet.shiftRows does not shifts the formula's effectively
Summary: sheet.shiftRows does not shifts the formula's effectively
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: unspecified
Hardware: PC Windows Server 2003
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-07 01:01 UTC by Vinu Kumar
Modified: 2008-07-08 18:58 UTC (History)
0 users



Attachments
XLS file for bug 45348 (316.00 KB, application/octet-stream)
2008-07-07 01:03 UTC, Vinu Kumar
Details

Note You need to log in before you can comment on or make changes to this bug.
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.