|Summary:||Autofilter : wrong definition created _FilterDatabase built-in name in HSSFSheet.setAutoFilter()|
|Component:||HSSF||Assignee:||POI Developers List <dev>|
Description jrsirieix 2014-04-09 12:34:24 UTC
When setting autofilters on several tabs in a workbook, the _FilterDatabase built-in name sometimes has a wrong definition, e.g. it points to another sheet or no sheet at all. In that case, the filter dropdown buttons are present but they do nothing. I think the issue comes from the setAutoFilter() method in HSSFSheet, which calls new Area3DPtg() with a sheetIndex whereas it seems to expect an esternSheetIndex (line 2066 in v3.9): Area3DPtg ptg = new Area3DPtg(range.getFirstRow(), range.getLastRow(), range.getFirstColumn(), range.getLastColumn(), false, false, false, false, sheetIndex); I seem to have resolved the problem by replacing this line with the following: short externSheetIndex = _workbook.getWorkbook().checkExternSheet(sheetIndex); Area3DPtg ptg = new Area3DPtg(range.getFirstRow(), range.getLastRow(), range.getFirstColumn(), range.getLastColumn(), false, false, false, false, externSheetIndex); I have no simple code to reproduce the issue. Obviously it must happen when the sheetIndex is different from the externSheetIndex.
Comment 1 jrsirieix 2014-04-09 12:40:39 UTC
In addition, in order for a POI-created autofilter to be like that of a standard Excel file, the _FilterDatabase name should have be hidden (option flag NameRecord.Option.OPT_HIDDEN_NAME = 0x0001 in addition to NameRecord.Option.OPT_BUILTIN)
Comment 2 Dominik Stadler 2015-03-14 13:49:31 UTC
I tried to reproduce the problem, but couldn't reproduce it in a quick unit test. Can you provide a self-sufficient code-snippet or unit-test which shows the problem? Please also try with the latest version 3.12-beta1 so we know it wasn't fixed by some unrelated change at some point.
Comment 3 Dominik Stadler 2016-06-19 19:38:20 UTC
No response for some time -> closing this as WORKSFORME for now, please reopen and attach a reproducer if this is still a problem for you.