diff --git a/src/main/java/geoinfo/util/ExcelUtil.java b/src/main/java/geoinfo/util/ExcelUtil.java index d360938c..7a6ec95c 100644 --- a/src/main/java/geoinfo/util/ExcelUtil.java +++ b/src/main/java/geoinfo/util/ExcelUtil.java @@ -213,6 +213,7 @@ public class ExcelUtil { if(!isOk) { break; } Box obox = new Box(); + /* for(short j=0; j < hbox.size() && j < cells.length; j++) { if(cells[j] == null || cells[j].getContents().trim().equals("")) { continue; } if(cells[j].getType().toString().equals("Date")) { @@ -222,6 +223,26 @@ public class ExcelUtil { obox.put("col"+j, cells[j].getContents().trim()); } } + */ + for(short j=0; j < hbox.size() && j < cells.length; j++) { + if(cells[j] == null || cells[j].getContents().trim().equals("")) { continue; } + + // 1. 숫자 타입(Number) 또는 수식 결과가 숫자인 경우(Number Formula) 체크 + if (cells[j].getType() == jxl.CellType.NUMBER || cells[j].getType() == jxl.CellType.NUMBER_FORMULA) { + jxl.NumberCell nc = (jxl.NumberCell) cells[j]; + // 실제 double 값을 가져와서 문자열로 변환 (지수 표기법 e.g., 2.49E-6 이 될 수 있음) + obox.put("col"+j, String.valueOf(nc.getValue())); + + // 만약 지수 표기법(E) 없이 "0.00000249" 형태를 원한다면 위 줄 대신 아래 주석 코드를 사용하세요. + obox.put("col"+j, new java.math.BigDecimal(nc.getValue()).toPlainString()); + + } else if(cells[j].getType().toString().equals("Date")) { + String val = getDateVal(cells[j]); + obox.put("col"+j, val); + } else { + obox.put("col"+j, cells[j].getContents().trim()); + } + } rsWp.appendRs(obox); } return rsWp;