用JAVA在读取EXCEL文件时如何判断列隐藏

org.apache.poi.hssf.usermodel.HSSFSheet 

public static void main(String[] args) throws IOException {

String path1 = "C:/Users/Owen/Desktop/temp_/temp.xls";
InputStream is = new FileInputStream(path1);
HSSFWorkbook workbook = new HSSFWorkbook(is);
HSSFSheet sheet0 = workbook.getSheetAt(0);
System.out.println(sheet0.isColumnHidden(0));
System.out.println(sheet0.isColumnHidden(1));
System.out.println(sheet0.isColumnHidden(2));
System.out.println(sheet0.isColumnHidden(3));

        int lastRowNum = sheet0.getLastRowNum();

System.out.println((lastRowNum+1)+"行");
for (int r = 0; r <= lastRowNum; r++){
HSSFRow row = sheet0.getRow(r);
if (row == null){
continue;
}
System.out.println("getZeroHeight:"+row.getZeroHeight());//隐藏行的判断
System.out.println("getHeight:"+row.getHeight());
}

仅供参考 

posted @ 2012-01-03 01:13  吴永富  阅读(2636)  评论(0编辑  收藏  举报