I am trying to parse a xls file using apache poi. Is it possible to check whether a column is hidden or not. How can I get the width of a particular column.
Example: According to the post here it checks if the row is hidden or not.
Similarly I want to check the width of a column ( or check if the column is hidden or not)
you can set a column as hidden/unhidden by using
sheet.setColumnHidden(int columnIndex, boolean hidden);
e.g.
sheet.setColumnHidden(2, true); // this will hide the column index 2
sheet.setColumnHidden(2, false); // this will unhide the column index 2
and the column is hidden or not can be checked using
sheet.isColumnHidden(int columnIndex);
e.g.
sheet.isColumnHidden(2); //this will check the 2nd column index whether it is hidden or not
The Sheet
class has the method boolean isColumnHidden(int columnIndex)
and also the method int getColumnWidth(int columnIndex)
, however the returned width is a unit of character width. Not sure if that helps you.