fhx
2021-07-23 b77bfbcde9b3f0932cec6e259461ee5e08b8ebff
1.修改部分bug
1个文件已修改
22 ■■■■ 已修改文件
src/main/java/com/hx/util/ExcelUtil.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/hx/util/ExcelUtil.java
@@ -370,7 +370,11 @@
                            arrayString.add("");
                            //arrayString[i] = "";
                        } else { // 如果EXCEL表格中的数据类型为字符串型
                            arrayString.add(cell.getStringCellValue().trim());
                            if(cell.getCellType() != Cell.CELL_TYPE_BOOLEAN){
                                arrayString.add(cell.getStringCellValue().trim());
                            }else{
                                arrayString.add(cell.getBooleanCellValue() ? "TRUE" : "FALSE");
                            }
                            //arrayString[i] = cell.getStringCellValue().trim();
                        }
                    }
@@ -424,7 +428,7 @@
                            arrayString.add("");
                        } else if (cell.getCellType() == 0) {
                            // arrayString[i] = new Double(cell.getNumericCellValue()).toString();
                            if (HSSFCell.CELL_TYPE_NUMERIC == cell.getCellType()) {
                            if (XSSFCell.CELL_TYPE_NUMERIC == cell.getCellType()) {
                                short format = cell.getCellStyle().getDataFormat();
                                if(format == 14 || format == 31 || format == 57 || format == 58){
                                    //日期(中文时间格式的)
@@ -440,13 +444,13 @@
                                    arrayString.add(formater.format(d));
                                    //arrayString[i] = formater.format(d);
                                } else {
                                    if(HSSFCell.CELL_TYPE_STRING == cell.getCellType()){
                                    if(XSSFCell.CELL_TYPE_STRING == cell.getCellType()){
                                        arrayString.add(cell.getStringCellValue());
                                        //arrayString[i] =cell.getStringCellValue();
                                    }else if(HSSFCell.CELL_TYPE_FORMULA==cell.getCellType()){
                                    }else if(XSSFCell.CELL_TYPE_FORMULA==cell.getCellType()){
                                        arrayString.add(cell.getCellFormula());
                                        //arrayString[i] =cell.getCellFormula();
                                    }else if(HSSFCell.CELL_TYPE_NUMERIC== cell.getCellType()){
                                    }else if(XSSFCell.CELL_TYPE_NUMERIC== cell.getCellType()){
                                        HSSFDataFormatter dataFormatter = new HSSFDataFormatter();
                                        arrayString.add(dataFormatter.formatCellValue(cell));
                                        //arrayString[i] =dataFormatter.formatCellValue(cell);
@@ -457,7 +461,13 @@
                            arrayString.add("");
                            //arrayString[i] = "";
                        } else { // 如果EXCEL表格中的数据类型为字符串型
                            arrayString.add(cell.getStringCellValue().trim());
                            if(cell.getCellType() != Cell.CELL_TYPE_BOOLEAN){
                                arrayString.add(cell.getStringCellValue().trim());
                            }else{
                                arrayString.add(cell.getBooleanCellValue() ? "TRUE" : "FALSE");
                            }
                            //arrayString[i] = cell.getStringCellValue().trim();
                        }
                    }