Browse Source

20201125v2.0

tiaosheng
zy_Java 5 years ago
parent
commit
27f5605084
  1. 13
      util/src/main/java/com/ccsens/util/PoiUtil.java

13
util/src/main/java/com/ccsens/util/PoiUtil.java

@ -178,9 +178,14 @@ public class PoiUtil {
CellStyle style = wb.createCellStyle(); CellStyle style = wb.createCellStyle();
//设置内容 //设置内容
if (!WebConstant.CELL_NULL.equals(cell.value)){ if (!WebConstant.CELL_NULL.equals(cell.value)){
if(cell.num == 1){ // if(cell.num == 1){
newCell.setCellValue(Integer.parseInt(cell.value)); // newCell.setCellValue(Integer.parseInt(cell.value));
}else { // }else {
// newCell.setCellValue(cell.value);
// }
if (cell.value.length() <= 14 && cell.value.matches("\\d+")) {
newCell.setCellValue(Long.parseLong(cell.value));
} else {
newCell.setCellValue(cell.value); newCell.setCellValue(cell.value);
} }
} }
@ -625,11 +630,13 @@ public class PoiUtil {
poiUtilCell.setValue("111222333"); poiUtilCell.setValue("111222333");
poiUtilCell.setColspan(1); poiUtilCell.setColspan(1);
PoiUtilCell poiUtilCell1 = new PoiUtilCell(); PoiUtilCell poiUtilCell1 = new PoiUtilCell();
poiUtilCell1.setValue("123"); poiUtilCell1.setValue("123");
PoiUtilCell poiUtilCell2 = new PoiUtilCell(); PoiUtilCell poiUtilCell2 = new PoiUtilCell();
poiUtilCell2.setValue(""); poiUtilCell2.setValue("");
poiUtilCell2.setFunction("SUM(A1:B1)"); poiUtilCell2.setFunction("SUM(A1:B1)");
List<PoiUtilCell> cells = new ArrayList<>(); List<PoiUtilCell> cells = new ArrayList<>();
cells.add(poiUtilCell); cells.add(poiUtilCell);
cells.add(poiUtilCell1); cells.add(poiUtilCell1);

Loading…
Cancel
Save