瀏覽代碼

+ 交通强国小程序变更

chen.cheng 9 月之前
父節點
當前提交
cadb90ac8d
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      ruoyi-system/src/main/java/com/ruoyi/system/excel/JSONHandle.java

+ 10 - 0
ruoyi-system/src/main/java/com/ruoyi/system/excel/JSONHandle.java

@@ -4,9 +4,11 @@ import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSONArray;
 import com.ruoyi.common.utils.poi.ExcelHandlerAdapter;
 import org.apache.commons.lang3.ObjectUtils;
+import org.apache.poi.ss.usermodel.BorderStyle;
 import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.CellStyle;
 import org.apache.poi.ss.usermodel.HorizontalAlignment;
+import org.apache.poi.ss.usermodel.IndexedColors;
 import org.apache.poi.ss.usermodel.VerticalAlignment;
 import org.apache.poi.ss.usermodel.Workbook;
 
@@ -19,6 +21,14 @@ public abstract class JSONHandle implements ExcelHandlerAdapter {
             CellStyle style = wb.createCellStyle();
             style.setAlignment(HorizontalAlignment.LEFT);
             style.setVerticalAlignment(VerticalAlignment.CENTER);
+            style.setBorderRight(BorderStyle.THIN);
+            style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
+            style.setBorderLeft(BorderStyle.THIN);
+            style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
+            style.setBorderTop(BorderStyle.THIN);
+            style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
+            style.setBorderBottom(BorderStyle.THIN);
+            style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
             // 设置换行属性
             style.setWrapText(true);
             JSONArray objects = JSON.parseArray(value.toString());