|Summary:||setSheetOrder doesn't update names scope|
|Product:||POI||Reporter:||Aurelien JOLY <joly.aurelien>|
|Component:||SS Common||Assignee:||POI Developers List <dev>|
Java test case
Java test case
Description Aurelien JOLY 2016-10-03 15:06:50 UTC
Created attachment 34321 [details] Java test case When setSheetOrder is called, and a sheet is moved, the scope of the name in the document stays on the old sheet. Ex : I have document with 3 sheets. I have defined a name on sheet3, when I move sheet3 using setSheetOrder, the scope of the name is still the third sheet which is now sheet2 cf attachement for the reproduction case
Comment 1 Javen O'Neal 2016-10-08 23:56:28 UTC
Created attachment 34343 [details] Java test case Could you please attach D:\\testPOI.xlsx to this bug so that we can reproduce this problem? If this is not possible due to proprietary information, could you either manually create an Excel file that demonstrates the problem or write the unit test to create a new workbook, add the named ranges, change the sheet order, and verify that the named ranges refer to the correct sheets.
Comment 2 Javen O'Neal 2016-10-09 00:00:31 UTC
Disregard comment 1. testPOI.xlsx is the output file name. The test case creates an empty workbook, adds sheets and a named range, changes sheet order, and checks whether the named range refers to the correct sheet.
Comment 3 Javen O'Neal 2016-10-09 03:06:55 UTC
Thanks for finding this bug. I have fixed this bug, with unit tests, for HSSF, XSSF, and SXSSF in r1763939. While fixing this, I noticed another quirk in XSSF, as documented in the unit test. XSSFName objects become invalid after writing a workbook. If this is an issue for you, please open a new bug if you cannot find an already-open bug for this.