JAVA 读取EXCEL
2011-07-07 23:54
141 查看
private static String getCellFormatValue(HSSFCell cell) {
String cellvalue = "";
if (cell != null) {
switch (cell.getCellType()) {
case HSSFCell.CELL_TYPE_NUMERIC:
cellvalue = String.valueOf(cell.getNumericCellValue());
case HSSFCell.CELL_TYPE_FORMULA: {
if (HSSFDateUtil.isCellDateFormatted(cell)) {
Date date = cell.getDateCellValue();
cellvalue = cell.getDateCellValue().toLocaleString();
} else {
double num = new Double((double) cell.getNumericCellValue());
cellvalue = String.valueOf(num);
}
break;
}
case HSSFCell.CELL_TYPE_STRING:
cellvalue = cell.getStringCellValue();
break;
default:
cellvalue = "";
}
} else {
cellvalue = "";
}
return cellvalue.trim();
}
String cellvalue = "";
if (cell != null) {
switch (cell.getCellType()) {
case HSSFCell.CELL_TYPE_NUMERIC:
cellvalue = String.valueOf(cell.getNumericCellValue());
case HSSFCell.CELL_TYPE_FORMULA: {
if (HSSFDateUtil.isCellDateFormatted(cell)) {
Date date = cell.getDateCellValue();
cellvalue = cell.getDateCellValue().toLocaleString();
} else {
double num = new Double((double) cell.getNumericCellValue());
cellvalue = String.valueOf(num);
}
break;
}
case HSSFCell.CELL_TYPE_STRING:
cellvalue = cell.getStringCellValue();
break;
default:
cellvalue = "";
}
} else {
cellvalue = "";
}
return cellvalue.trim();
}
相关文章推荐
- [JAVA] java读取Excel文件内容,jxl(Excel 2003)
- java上传excel文件并读取表格信息
- java 读取Excel文档
- java读取excel(2003-2007)兼容
- Java操作Excel之理解JXL--读取Excel
- POI---JAVA导出Excel文件<三>SSH搭建&读取数据库&WEB环境导出Excel
- Java读取Excel方式
- Java读取Excel表格到对象之优化
- java的poi技术读取Excel数据到MySQL
- Java读取Excel文件内容
- java 操作 poi 解析、读取 Excel 文件
- PIO读取excel文档,java实现
- java 从后台下载xlsx格式excel 发现不可读取内容的解决方案
- 使用java进行excel读取和写入
- Java读取Excel文件,生成SQL语句
- java实现爬虫技术,读取txt,word,excel,ppt,pdf,html等格式的文件
- java读取excel文件显示Unable to recognize OLE stream
- JAVA读取WORD,EXCEL,PDF,TXT,RTF,HTML文件文本内容的方法示例
- java下载excel导入excel读取excel数据,将数据插入数据库
- java写入、读取excel文件1