瀏覽代碼

1.修改颜色

main
wangqiang 1 天之前
父節點
當前提交
3e62c2e906
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. 4
    3
      zs-manager/src/main/java/com/ruoyi/zhushi/service/impl/DkRecordServiceImpl.java

+ 4
- 3
zs-manager/src/main/java/com/ruoyi/zhushi/service/impl/DkRecordServiceImpl.java 查看文件

cell = row.createCell(2); cell = row.createCell(2);
} }
Workbook workbook = sheet.getWorkbook(); Workbook workbook = sheet.getWorkbook();

CellStyle style = workbook.createCellStyle(); CellStyle style = workbook.createCellStyle();
style.cloneStyleFrom(cell.getCellStyle()); // 保留原有样式
style.setFillForegroundColor(IndexedColors.RED.getIndex());
style.cloneStyleFrom(cell.getCellStyle()); // 保留原有样式lightcyan
style.setFillForegroundColor(IndexedColors.LIGHT_TURQUOISE.getIndex());
style.setFillPattern(FillPatternType.SOLID_FOREGROUND); style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
cell.setCellStyle(style); cell.setCellStyle(style);
} }
Workbook workbook = sheet.getWorkbook(); Workbook workbook = sheet.getWorkbook();
CellStyle style = workbook.createCellStyle(); CellStyle style = workbook.createCellStyle();
style.cloneStyleFrom(cell.getCellStyle()); // 保留原有样式 style.cloneStyleFrom(cell.getCellStyle()); // 保留原有样式
style.setFillForegroundColor(IndexedColors.RED.getIndex());
style.setFillForegroundColor(IndexedColors.LIGHT_TURQUOISE.getIndex());
style.setFillPattern(FillPatternType.SOLID_FOREGROUND); style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
cell.setCellStyle(style); cell.setCellStyle(style);
} }

Loading…
取消
儲存