Browse Source

[Feature][Plugin-Email] Numeric data type support in email attachment #5424 (#5426)

pull/3/MERGE
ruanwenjun 4 years ago committed by GitHub
parent
commit
5556e47a85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/ExcelUtils.java

4
dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/ExcelUtils.java

@ -110,9 +110,13 @@ public class ExcelUtils {
for (int j = 0; j < values.length; j++) { for (int j = 0; j < values.length; j++) {
Cell cell1 = row.createCell(j); Cell cell1 = row.createCell(j);
cell1.setCellStyle(cellStyle); cell1.setCellStyle(cellStyle);
if (values[j] instanceof Number) {
cell1.setCellValue(Double.parseDouble(String.valueOf(values[j])));
} else {
cell1.setCellValue(String.valueOf(values[j])); cell1.setCellValue(String.valueOf(values[j]));
} }
} }
}
for (int i = 0; i < headerList.size(); i++) { for (int i = 0; i < headerList.size(); i++) {
sheet.setColumnWidth(i, headerList.get(i).length() * 800); sheet.setColumnWidth(i, headerList.get(i).length() * 800);

Loading…
Cancel
Save