LLL месяцев назад: 4
Родитель
Сommit
9a9fd772de

+ 25 - 3
jeecg-module-interlock/src/main/java/org/jeecg/modules/history/service/impl/InterlockDetailHistoryServiceImpl.java

@@ -105,13 +105,20 @@ public class InterlockDetailHistoryServiceImpl extends ServiceImpl<InterlockDeta
 
         Map<String,CellStyle> cellStyleMap = new HashMap<>();
 
+        // TODO-字体名称
         // 创建字体对象
         Font font = workbook.createFont();
+        font.setFontName("等线");
         font.setBold(true); // 设置字体加粗
+        font.setFontHeightInPoints((short) 11); // 设置字体大小为11号
 
-        // TODO 创建字体对象
         Font font1 = workbook.createFont();
-        font1.setFontName("SimSun"); // 设置字体为宋体-SimSun
+        font1.setFontName("等线"); // 设置字体为宋体-SimSun
+        font1.setFontHeightInPoints((short) 11); // 设置字体大小为11号
+
+        Font font9 = workbook.createFont();
+        font9.setFontName("等线"); // 设置字体名称为等线
+        font9.setFontHeightInPoints((short) 9); // 设置字体大小为9号
 
         // 创建第一行的样式
         CellStyle firstStyle = workbook.createCellStyle();
@@ -154,6 +161,8 @@ public class InterlockDetailHistoryServiceImpl extends ServiceImpl<InterlockDeta
         CellStyle centerAlignStyle2 = workbook.createCellStyle();
         centerAlignStyle2.setAlignment(HorizontalAlignment.CENTER);
         centerAlignStyle2.setVerticalAlignment(VerticalAlignment.CENTER);
+        // 设置字体
+        centerAlignStyle2.setFont(font1);
         cellStyleMap.put("centerAlignStyle2",centerAlignStyle2);
 
         // 创建居中对齐-加边框-字体不加粗的样式
@@ -170,9 +179,18 @@ public class InterlockDetailHistoryServiceImpl extends ServiceImpl<InterlockDeta
         centerAlignStyle3.setBottomBorderColor(IndexedColors.BLACK.getIndex());
         centerAlignStyle3.setLeftBorderColor(IndexedColors.BLACK.getIndex());
         centerAlignStyle3.setRightBorderColor(IndexedColors.BLACK.getIndex());
+        // 设置字体
         centerAlignStyle3.setFont(font1);
         cellStyleMap.put("centerAlignStyle3",centerAlignStyle3);
 
+        // 创建居右对齐-不加边框-不加粗-字体9号的样式
+        CellStyle centerAlignStyle9 = workbook.createCellStyle();
+        centerAlignStyle9.setAlignment(HorizontalAlignment.RIGHT);
+        centerAlignStyle9.setVerticalAlignment(VerticalAlignment.CENTER);
+        // 设置字体
+        centerAlignStyle9.setFont(font9);
+        cellStyleMap.put("centerAlignStyle9",centerAlignStyle9);
+
         return cellStyleMap;
     }
 
@@ -263,7 +281,11 @@ public class InterlockDetailHistoryServiceImpl extends ServiceImpl<InterlockDeta
         //第8行:历史数据
         Row eightTitleRow = sheet.createRow(rowNum++);
         //设置第8行数据
-        createCellWithValueStyle(eightTitleRow, 0, "历史数据:", cellStyleMap.get("centerAlignStyle1"));
+        String[] s8 = {"历史数据:", "","", "","", "回路健康级别:A-健康;B-故障;C-严重故障;D-失效","", ""};
+        CellStyle[] style8 = {cellStyleMap.get("centerAlignStyle1"),cellStyleMap.get("centerAlignStyle1"),cellStyleMap.get("centerAlignStyle1"),cellStyleMap.get("centerAlignStyle1"),cellStyleMap.get("centerAlignStyle1"),cellStyleMap.get("centerAlignStyle9"),cellStyleMap.get("centerAlignStyle9"),cellStyleMap.get("centerAlignStyle9")};
+        createCellOfRowWithValueStyleName(eightTitleRow,s8,style8);
+        // 分别合并第6、7、8列
+        sheet.addMergedRegion(new CellRangeAddress(rowNum-1, rowNum-1, 5, 7));
 
         //第9行:列名
         Row columnRow= sheet.createRow(rowNum++);