67,541
社区成员
发帖
与我相关
我的任务
分享
sheet.getCellComment(0, i) ;
Row row = (Row) sheet.getRow(i);
StudentDto student = new StudentDto();
//获取用户信息
String name = row.getCell(0).getRichStringCellValue().toString();//姓名
String code = row.getCell(1).getRichStringCellValue().toString();//学号
String idCard = row.getCell(2).getRichStringCellValue().toString();//身份证
String instidute = row.getCell(3).getRichStringCellValue().toString();//城市
String major = row.getCell(4).getRichStringCellValue().toString();//卡号
String state = row.getCell(5).getRichStringCellValue().toString();//人品值
Sheet sheet1 = wb.getSheetAt(0);
for (Row row : sheet1) {
for (Cell cell : row) {
CellReference cellRef = new CellReference(row.getRowNum(), cell.getColumnIndex());
System.out.print(cellRef.formatAsString());
System.out.print(" - ");
switch (cell.getCellType()) {
case Cell.CELL_TYPE_STRING:
System.out.println(cell.getRichStringCellValue().getString());
break;
case Cell.CELL_TYPE_NUMERIC:
if (DateUtil.isCellDateFormatted(cell)) {
System.out.println(cell.getDateCellValue());
} else {
System.out.println(cell.getNumericCellValue());
}
break;
case Cell.CELL_TYPE_BOOLEAN:
System.out.println(cell.getBooleanCellValue());
break;
case Cell.CELL_TYPE_FORMULA:
System.out.println(cell.getCellFormula());
break;
default:
System.out.println();
}
}
}
HSSFCell c = row.getCell(8);
if (c.getCellType() == HSSFCell.CELL_TYPE_STRING) {
String s = row.getCell(8).getRichStringCellValue().getString();
if (NumberUtils.isNumber(s)) {
return new Double(s);
} else {
return 0.0;
}
} else {
return row.getCell(8).getNumericCellValue();
}