yumeng před 1 rokem
rodič
revize
3ae44e6a5b

+ 11 - 6
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/utils/ExportExcelUtils.java

@@ -168,7 +168,6 @@ public class ExportExcelUtils {
                     XSSFCell cell = row.createCell((short) cellIndex);
                     if (!Check.isNull(obj)) {
                         String s = String.valueOf(obj);
-
                         if (s.contains("&br;") || s.contains(":red") || s.contains(":green")) {
                             if (s.contains("&br;")) {
                                 JSONObject data = getData(s);
@@ -178,12 +177,18 @@ public class ExportExcelUtils {
                                     if (!Check.isNull(dataArr)) {
                                         for (int i = 0; i < dataArr.size(); i++) {
                                             JSONObject dataJson = dataArr.getJSONObject(i);
-                                            String color = dataJson.getString("color");
-                                            if (color.equals("red")) {
-                                                cell.getRichStringCellValue().applyFont(dataJson.getInteger("start"), dataJson.getInteger("end"), redFont);
-                                            } else if (color.equals("green")) {
-                                                cell.getRichStringCellValue().applyFont(dataJson.getInteger("start"), dataJson.getInteger("end"), greenFont);
+                                            if (!Check.isNull(dataJson)) {
+                                                String color = dataJson.getString("color");
+                                                if (!Check.isNull(color)) {
+                                                    if (color.equals("red")) {
+                                                        cell.getRichStringCellValue().applyFont(dataJson.getInteger("start"), dataJson.getInteger("end"), redFont);
+                                                    } else if (color.equals("green")) {
+                                                        cell.getRichStringCellValue().applyFont(dataJson.getInteger("start"), dataJson.getInteger("end"), greenFont);
+                                                    }
+                                                }
+
                                             }
+
                                         }
                                     }
                                 } else {