Bug 43937

Summary: Need methods on HSSFSheet to determine if the sheet is hidden
Product: POI Reporter: Noel Markham <mail>
Component: HSSFAssignee: POI Developers List <dev>
Severity: normal    
Priority: P2    
Version: 3.0-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Attachments: XLS file with one sheet hidden
XLS file with no sheets hidden
Patch for adding the required methods, with tests

Description Noel Markham 2007-11-22 06:32:29 UTC
Need to have a boolean isHidden() method on the HSSFSheet class.
Or, have a method isSheetHidden(int sheetNum) on the HSSFWorkbook class. Or both?
Comment 1 Nick Burch 2007-12-04 03:47:41 UTC
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
Comment 2 Noel Markham 2007-12-04 09:19:52 UTC
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.

Comment 3 Noel Markham 2007-12-04 09:21:13 UTC
Created attachment 21228 [details]
XLS file with no sheets hidden

Same file with no sheets hidden
Comment 4 Nick Burch 2007-12-05 02:55:41 UTC
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

Someone will still need to identify what record / records are involved in sheet
hiding though, before we can support it.
Comment 5 Noel Markham 2007-12-05 06:10:22 UTC
Just took a very quick look - to save anyone else the hassle,
POIFSViewEngine.inspectViewable() returned exactly the same lists on the two files.
Comment 6 Noel Markham 2007-12-05 06:16:19 UTC


The files are different. I was using corrupted files.
Comment 7 Ugo Cei 2008-01-08 03:51:27 UTC
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)
Comment 8 Nick Burch 2008-01-08 03:59:40 UTC
Thanks for this patch Ugo, I've applied it