Summary: | XSSFWorkBook.setSheetHidden(0, true) does not hide the first sheet | ||
---|---|---|---|
Product: | POI | Reporter: | Eli Vingot <elivingt> |
Component: | XSSF | Assignee: | POI Developers List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | major | ||
Priority: | P2 | ||
Version: | 3.9-FINAL | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | All | ||
Attachments: |
first sheet hidden saved by Excel (works fine)
second sheet hidden, saved by poi 3.10 (works fine) first sheet hidden, saved by poi 3.10 (Does not work, sheet is visible) |
Description
Eli Vingot
2014-02-12 14:22:18 UTC
Looking at the ctSheet after the call I see that it is set as "hidden". First up, any chance you could re-test with the new POI 3.10 final? Secondly, are you able to produce 3 files: * POI produced, sheet 0 hidden * POI produced, sheet 1 hidden * Excel produced, sheet 0 hidden ? Thirdly, could either you, or someone else, unzip the three .xlsx files (which are zips of xml), and then compare where and what gets set around hidden sheets, to see if we can identify what POI's doing wrong? Created attachment 31302 [details]
first sheet hidden saved by Excel (works fine)
Created attachment 31303 [details]
second sheet hidden, saved by poi 3.10 (works fine)
Created attachment 31304 [details]
first sheet hidden, saved by poi 3.10 (Does not work, sheet is visible)
Looked at inside the zipped xlsx and mystery solved. Problem is that the active sheet cannot be hidden. When changing the code to: wb.setActiveSheet(1); wb.setSheetHidden(0, true); The first sheet is hidden correctly. I still thinks this is a bug but not as critical as before Any chance you could propose a tweak to the setSheetHidden javadocs to add the note about active sheets? That should hopefully help someone in your situation in future! I have now updated the javadoc for the relevant methods in Workbook, XSSFWorkbook and SXSSFWorkbook via r1702805. For now we will not perform more checks here as the spec seems to allow these settings and Excel just interprets them this way currently. |