Summary: | Named range reference becomes invalid on removeSheet | ||
---|---|---|---|
Product: | POI | Reporter: | Simon Niederberger <simon.niederberger> |
Component: | HSSF | Assignee: | POI Developers List <dev> |
Status: | RESOLVED LATER | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | 2.0-FINAL | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | All |
Description
Simon Niederberger
2004-03-12 08:24:07 UTC
Here's the source code (snippet) [works with a workbook containing sheets SHA ... SHG] // **** CREATE NAMED RANGE **** int idxRange = _book.getNameIndex("MYRANGE"); HSSFName name; if (idxRange == -1) { name = _book.createName(); name.setNameName("MYRANGE"); } else { name = _book.getNameAt(idxRange); } name.setReference("SHC!$A$2:$A$8"); // **** DELETE SOME SHEETS **** int idxSheet; idxSheet = _book.getSheetIndex("SHB"); if (idxSheet > 0) { _book.removeSheetAt(idxSheet); } idxSheet = _book.getSheetIndex("SHF"); if (idxSheet > 0) { _book.removeSheetAt(idxSheet); } ... and MYRANGE will point to SHD!$A$2:$A$8 (instead of SHC). Current workaround is to first delete the sheets, then create the range, so the bug fix isn't really urgent. Could you please try poi-3.1-beta1 and report if the problem still persists? Yegor Sorry, I've moved to a different project in the meantime and don't have the original source code available. Guessing this is now fixed. Please re-open the bug if it still occurs on re-testing with a recent version (eg 3.1), if you do happen to find the source to test against again |