|Summary:||removing sheets leaves no selection -> printing problems|
|Product:||POI||Reporter:||Meikel Bisping <M.Bisping>|
|Component:||HSSF||Assignee:||POI Developers List <dev>|
Description Meikel Bisping 2006-09-05 09:52:12 UTC
I had a number of sheets in my an excel template and removed all but one with poi. When trying to print I got the error message "Did not find anything to print". This disappeared when I added workbook.getSheetAt(0).setSelected(true). Maybe you could make sure that a sheet is selected when sheets are removed.
Comment 1 Josh Micich 2008-05-16 12:21:55 UTC
Fixed in svn r657167 as a follow-on to bug 44523. The suggested logic was applied within HSSFWorkbook.removeSheetAt(), to update both the active sheet index and selected sheet flags if the removed sheet was active or selected. It seems that setting of the 'selected' sheet flags is the only thing important for this bug. In Excel (2007) in the print dialog, the section 'Print what' has radio buttons with values 'Selection' and 'Active sheet(s)', suggesting that the 'active' sheet is used when that radio button is set. From what I could tell, regardless of the value of the radio button, only the 'selected' sheet flags were taken into account. I left the fix to include the update of 'active' sheet because it seemed wrong to let the workbook have no active sheet, and it does no harm for this bug or any other existing test case. Perhaps the observed behaviour related to printing is just a bug in Excel 2007.