如何检查一列使用Apache POI被隐藏在Excel文件 [英] How to check a column is hidden or not in excel file using apache poi
本文介绍了如何检查一列使用Apache POI被隐藏在Excel文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用Apache POI解析一个xls文件。是否有可能来检查列是否为隐藏。我怎样才能得到一个特定列的宽度。
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.
例如:根据岗位<一个href=\"http://stackoverflow.com/questions/10529909/detecting-hidden-cells-in-excel-using-apache-poi\">here它会检查是否该行被隐藏。
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)
推荐答案
可以为隐藏的设置列/取消隐藏使用
sheet.setColumnHidden(int columnIndex, boolean hidden);
例如。
sheet.setColumnHidden(2, true); // this will hide the column index 2
sheet.setColumnHidden(2, false); // this will unhide the column index 2
和列被隐藏可以通过检查
sheet.isColumnHidden(int columnIndex);
例如
sheet.isColumnHidden(2); //this will check the 2nd column index whether it is hidden or not
这篇关于如何检查一列使用Apache POI被隐藏在Excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文