Bug 55396 - Formula added before referenced sheet wipes out formula causes exceptions
Summary: Formula added before referenced sheet wipes out formula causes exceptions
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.9-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-09 15:59 UTC by ebyrob
Modified: 2013-08-09 16:04 UTC (History)
1 user (show)



Attachments
java main() putting formula before sheet create (1.27 KB, text/java)
2013-08-09 15:59 UTC, ebyrob
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ebyrob 2013-08-09 15:59:10 UTC
Created attachment 30718 [details]
java main() putting formula before sheet create

1) Create a workbook.
2) Add sheet "X"
3) Add cell formula at 0,0 "=2+Y!A1"
  --> getCellFormula() has lost "Y" sheet name
4) Evaluate cell's formula
  --> java.lang.IllegalArgumentException: Invalid sheetIndex: -1.

I'm not sure if this is by design, but it can make it difficult to write a library that outputs formulas and sheets in a convenient order.  (sometimes sheet may not exist, but it's a good time to add the formula anyways.  Excel itself shows #VALUE on screen but doesn't wipe out the cell's formula which may be restored by clicking.)