{
XSSFSheet sheet = aatpExcel.getSheetAt(0);
XSSFRow row = sheet.getRow(1); //读取第二行的列数
//总行数
int trLength = sheet.getLastRowNum();
//总列数
int tdLength = row.getLastCellNum();
//循环读取
for(int i=0;i<tdLength;i++)
{
XSSFCell cell = row.getCell(i);
if (null != cell) {
switch (cell.getCellType()) {
case XSSFCell.CELL_TYPE_NUMERIC: // 数字
System.
out.
print(cell.
getNumericCellValue()
+ " ");
break;
case XSSFCell.CELL_TYPE_STRING: // 字符串
System.
out.
print(cell.
getStringCellValue()
+ " ");
break;
case XSSFCell.CELL_TYPE_BOOLEAN: // Boolean
System.
out.
println(cell.
getBooleanCellValue()
+ " ");
break;
case XSSFCell.CELL_TYPE_FORMULA: // 公式
System.
out.
print(cell.
getCellFormula() + " ");
break;
case XSSFCell.CELL_TYPE_BLANK: // 空值
break;
case XSSFCell.CELL_TYPE_ERROR: // 故障
break;
default:
break;
}
}
}
}
}