How to check a column is hidden or not in excel file using apache poi

久未见 提交于 2019-12-05 17:55:32

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!