feat: 투수계수 값이 작을 때 0으로 처리되는 버그 수정 건

main
thkim 2025-11-24 15:01:49 +09:00
parent a310e657b2
commit 61eb060bfa
1 changed files with 21 additions and 0 deletions

View File

@ -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;