Bug 43937 - Need methods on HSSFSheet to determine if the sheet is hidden
Summary: Need methods on HSSFSheet to determine if the sheet is hidden
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.0-FINAL
Hardware: PC Windows XP
: P2 normal with 2 votes (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-22 06:32 UTC by Noel Markham
Modified: 2008-01-08 03:59 UTC (History)
0 users



Attachments
XLS file with one sheet hidden (13.50 KB, application/vnd.ms-excel)
2007-12-04 09:19 UTC, Noel Markham
Details
XLS file with no sheets hidden (13.50 KB, application/vnd.ms-excel)
2007-12-04 09:21 UTC, Noel Markham
Details
Patch for adding the required methods, with tests (7.93 KB, patch)
2008-01-08 03:51 UTC, Ugo Cei
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.

Thanks.
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
written.

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
Apologies

----
PLEASE IGNORE THE COMMENT ABOVE
----

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