如何使用apache poi检查excel文件中的列是否隐藏 [英] How to check a column is hidden or not in excel file using apache poi

查看:62
本文介绍了如何使用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.

示例:根据此处的帖子,它会检查该行是否隐藏.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆