poi解析Excel时类型的判断与数字的转换
来源:互联网 发布:egd网络黄金跑路了 编辑:程序博客网 时间:2024/06/07 02:31
if(cell.getCellType() == HSSFCell.CELL_TYPE_NUMERIC){
double d = cell.getNumericCellValue();
if (d - (int) d < Double.MIN_VALUE) {
// 是否为int型
cellStr = Integer.toString((int) d);
} else{
DecimalFormat df = new DecimalFormat("0");
cellStr = df.format(cell.getNumericCellValue());
}
}else if (cell.getCellType() == HSSFCell.CELL_TYPE_STRING) {
cellStr = cell.getRichStringCellValue().getString();
}else if (cell.getCellType() == HSSFCell.CELL_TYPE_FORMULA) {
cellStr = cell.getCellFormula();
}else if (cell.getCellType() == HSSFCell.CELL_TYPE_BLANK) {
cellStr = " ";
}else if (cell.getCellType() == HSSFCell.CELL_TYPE_ERROR) {
cellStr = " ";
}
double d = cell.getNumericCellValue();
if (d - (int) d < Double.MIN_VALUE) {
// 是否为int型
cellStr = Integer.toString((int) d);
} else{
DecimalFormat df = new DecimalFormat("0");
cellStr = df.format(cell.getNumericCellValue());
}
}else if (cell.getCellType() == HSSFCell.CELL_TYPE_STRING) {
cellStr = cell.getRichStringCellValue().getString();
}else if (cell.getCellType() == HSSFCell.CELL_TYPE_FORMULA) {
cellStr = cell.getCellFormula();
}else if (cell.getCellType() == HSSFCell.CELL_TYPE_BLANK) {
cellStr = " ";
}else if (cell.getCellType() == HSSFCell.CELL_TYPE_ERROR) {
cellStr = " ";
}
0 0
- poi解析Excel时类型的判断与数字的转换
- POI读取Excel 各种特殊数字和类型的转换
- POI读取Excel 各种特殊数字和类型的转换
- POI读取Excel 各种特殊数字和类型的转换。
- POI读取Excel 各种特殊数字和类型的转换
- POI读取Excel 各种特殊数字和类型的转换。
- poi读取excel时数字类型的解决方法
- POI 解析excel时sheet的实际行数,数字问题
- POI读取Excel 各种特殊数字和类型的转换。取值带一个E
- poi解析excel读取日期为数字的问题
- poi导入excel判断单元格类型及转换
- 类型判断与类型转换的应用
- poi实现excel的解析
- poi读取Excel时日期为数字 的解决方法 转载 2017年12月14日 10:31:14 标签:poi /excel /java 19 在使用poi解析Excel文件时,会发现,表格中的日期解析出
- Excel显示与POI解析得到的数据不一致
- QString 与 数字类型的转换
- POI获取Excel中单元格内容时,如果为数字格式获取类型为double的问题
- java JXL POI EXCEL 列坐标 和 从0开始的数字下标 的相互转换
- javascript:history.go()和History.back()的区别及应用
- HBase Java API详解
- 你好,安静
- Linux进程间通信——使用信号量
- 创建第一个Android工程-Eclipse创建Android项目
- poi解析Excel时类型的判断与数字的转换
- Android开发:监听当前View的左右滑动事件,并返回给当前的activity或者fragment
- java中的Callable接口
- Linux下安装jdk
- toolStrip1 增加两个日期型控件并使之联动
- 用Android手机调试Android APP_教程
- 【好程序员特训营】Java中常用的排序方法
- 数据的批量插入
- Android中通知的使用-----Notification详解