fix: 修复到处Excel数据格式化问题

This commit is contained in:
taojinlong
2025-01-10 12:40:08 +08:00
committed by taojinlong
parent f55db37ec3
commit 891850aa01

View File

@@ -408,9 +408,8 @@ public class ChartDataServer implements ChartDataApi {
//设置列的宽度
detailsSheet.setColumnWidth(j, 255 * 20);
} else if (cellValObj != null) {
System.out.println(cellValObj.toString());
try {
if (xAxis != null && xAxis.get(j).getDeType().equals(DeTypeConstants.DE_INT) || xAxis.get(j).getDeType().equals(DeTypeConstants.DE_FLOAT)) {
if (xAxis != null && (xAxis.get(j).getDeType().equals(DeTypeConstants.DE_INT) || xAxis.get(j).getDeType().equals(DeTypeConstants.DE_FLOAT))) {
try {
FormatterCfgDTO formatterCfgDTO = xAxis.get(j).getFormatterCfg() == null ? new FormatterCfgDTO() : xAxis.get(j).getFormatterCfg();
if (formatterCfgDTO.getType().equalsIgnoreCase("auto")) {
@@ -425,7 +424,11 @@ public class ChartDataServer implements ChartDataApi {
cell.setCellValue(cellValObj.toString());
}
} else {
cell.setCellValue(cellValObj.toString());
if ((excelTypes[j].equals(DeTypeConstants.DE_INT) || excelTypes[j].equals(DeTypeConstants.DE_FLOAT)) && StringUtils.isNotEmpty(cellValObj.toString())) {
cell.setCellValue(Double.valueOf(cellValObj.toString()));
} else if (cellValObj != null) {
cell.setCellValue(cellValObj.toString());
}
}
} catch (Exception e) {