Index: src/java/org/apache/poi/hssf/model/Sheet.java =================================================================== RCS file: /home/cvspublic/jakarta-poi/src/java/org/apache/poi/hssf/model/Sheet.java,v retrieving revision 1.50 diff -u -r1.50 Sheet.java --- src/java/org/apache/poi/hssf/model/Sheet.java 2 Jan 2005 01:00:52 -0000 1.50 +++ src/java/org/apache/poi/hssf/model/Sheet.java 24 Feb 2005 18:24:18 -0000 @@ -47,6 +47,7 @@ * @author Shawn Laubach (slaubach at apache dot org) Gridlines, Headers, Footers, and PrintSetup * @author Jason Height (jheight at chariot dot net dot au) Clone support. DBCell & Index Record writing support * @author Brian Sanders (kestrel at burdell dot org) Active Cell support + * @author Jean-Pierre Paris (jean-pierre.paris at m4x dot org) (Just a little) * * @see org.apache.poi.hssf.model.Workbook * @see org.apache.poi.hssf.usermodel.HSSFSheet @@ -1814,6 +1815,50 @@ setColumn( column, new Short(width), null, null, null); } + /** + * Get the hidden property for a given column. + * @param column index + * @see org.apache.poi.hssf.record.DefaultColWidthRecord + * @see org.apache.poi.hssf.record.ColumnInfoRecord + * @see #setColumnHidden(short,boolean) + * @return whether the column is hidden or not. + */ + + public boolean isColumnHidden(short column) + { + boolean retval = false; + ColumnInfoRecord ci = null; + + if (columns != null) + { + for ( Iterator iterator = columns.getIterator(); iterator.hasNext(); ) + { + ci = ( ColumnInfoRecord ) iterator.next(); + if ((ci.getFirstColumn() <= column) + && (column <= ci.getLastColumn())) + { + break; + } + ci = null; + } + } + if (ci != null) + { + retval = ci.getHidden(); + } + return retval; + } + + /** + * Get the hidden property for a given column. + * @param column - the column number + * @param hidden - whether the column is hidden or not + */ + public void setColumnHidden(short column, boolean hidden) + { + setColumn( column, null, null, new Boolean(hidden), null); + } + public void setColumn(short column, Short width, Integer level, Boolean hidden, Boolean collapsed) { if (columns == null) Index: src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java =================================================================== RCS file: /home/cvspublic/jakarta-poi/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java,v retrieving revision 1.30 diff -u -r1.30 HSSFSheet.java --- src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java 2 Jan 2005 01:00:52 -0000 1.30 +++ src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java 24 Feb 2005 18:24:21 -0000 @@ -41,6 +41,7 @@ * @author Glen Stampoultzis (glens at apache.org) * @author Libin Roman (romal at vistaportal.com) * @author Shawn Laubach (slaubach at apache dot org) (Just a little) + * @author Jean-Pierre Paris (jean-pierre.paris at m4x dot org) (Just a little, too) */ public class HSSFSheet @@ -340,6 +341,28 @@ } /** + * Get the visibility state for a given column. + * @param column - the column to get (0-based) + * @param width - the visiblity state of the column + */ + + public void setColumnHidden(short column, boolean hidden) + { + sheet.setColumnHidden(column, hidden); + } + + /** + * Get the hidden state for a given column. + * @param column - the column to set (0-based) + * @return hidden - the visiblity state of the column + */ + + public boolean isColumnHidden(short column) + { + return sheet.isColumnHidden(column); + } + + /** * set the width (in units of 1/256th of a character width) * @param column - the column to set (0-based) * @param width - the width in units of 1/256th of a character width