public static void main(String[] args) {
String localFilePath = "D:\\renqun.xlsx";
Collection<Long> userIds = ExcelUtil.excelToListLong(localFilePath, 0, 0);
System.out.println(userIds);
}
public String getHSSTextString(Row row, int colNum) {
Cell cell = row.getCell(colNum);
if (null != cell) {
switch (cell.getCellType()) {
case HSSFCell.CELL_TYPE_NUMERIC:
DecimalFormat df = new DecimalFormat("#");//转换成整型
return df.format(cell.getNumericCellValue());
//return String.valueOf(cell.getNumericCellValue());
case HSSFCell.CELL_TYPE_STRING:
return cell.getStringCellValue().trim();
case HSSFCell.CELL_TYPE_BLANK: // 空值
return "";
case HSSFCell.CELL_TYPE_ERROR: // 故障
return "";
default:
return "";
}
} else {
return "";
}
}