Need to have a boolean isHidden() method on the HSSFSheet class. Or, have a method isSheetHidden(int sheetNum) on the HSSFWorkbook class. Or both?
I'm not sure if we have any code that would be able to know if a sheet is hidden or not (couldn't spot any on a quick check) Assuming not, could you do the following: * create a file with two sheets, both with an entry in col 1 row 1, but nothing else, and not hidden * open that file up, set one sheet to be hidden, then save it * attach those two files to bugzilla so we have a reference * use the tools under org.apache.poi.hssf.dev and org.apache.poi.poifs.dev to figure out what record / records were changed when the sheet was hidden We can then tweak the records to expose that hidden flag, then do usermodel code too
Created attachment 21227 [details] XLS file with one sheet hidden Not sure I'll get a chance to look at the last note to the comments above, but here is the attached file with one sheet hidden. Thanks.
Created attachment 21228 [details] XLS file with no sheets hidden Same file with no sheets hidden
Thanks for the files, I've added them to svn so they won't get lost. I've also stubbed out a unit test, which'll provide a framework for testing the code once written. Someone will still need to identify what record / records are involved in sheet hiding though, before we can support it.
Just took a very quick look - to save anyone else the hassle, POIFSViewEngine.inspectViewable() returned exactly the same lists on the two files.
Apologies ---- PLEASE IGNORE THE COMMENT ABOVE ---- The files are different. I was using corrupted files.
Created attachment 21356 [details] Patch for adding the required methods, with tests This patch adds the following methods to HSSFWorkbook: public boolean isSheetHidden(int sheet) public void setSheetHidden(int sheet, boolean hidden)
Thanks for this patch Ugo, I've applied it