Crunchy
2024-05-13 35da9191297752452f7ab60ff9bc3eed515dfeec
performance-server/src/main/java/com/yuanchu/mom/utils/StyleMonthUtils.java
copy from performance-server/src/main/java/com/yuanchu/mom/utils/StyleUtils.java copy to performance-server/src/main/java/com/yuanchu/mom/utils/StyleMonthUtils.java
Îļþ´Ó performance-server/src/main/java/com/yuanchu/mom/utils/StyleUtils.java ¸´ÖÆ
@@ -4,7 +4,7 @@
import com.alibaba.excel.write.metadata.style.WriteFont;
import org.apache.poi.ss.usermodel.*;
public class StyleUtils {
public class StyleMonthUtils {
    /**
     * æ ‡é¢˜æ ·å¼
     * @return
@@ -13,26 +13,26 @@
        // å¤´çš„ç­–ç•¥
        WriteCellStyle headWriteCellStyle = new WriteCellStyle();
        // èƒŒæ™¯é¢œè‰²
        headWriteCellStyle.setFillForegroundColor(IndexedColors.LIME.getIndex());
        headWriteCellStyle.setFillForegroundColor(IndexedColors.WHITE1.getIndex());
        headWriteCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND);
        // å­—体
        WriteFont headWriteFont = new WriteFont();
        headWriteFont.setFontName("仿宋");//设置字体名字
        headWriteFont.setFontName("等线");//设置字体名字
        headWriteFont.setFontHeightInPoints((short)9);//设置字体大小
        headWriteFont.setBold(true);//字体加粗
        headWriteFont.setColor((short) 1);
        headWriteFont.setColor((short) 0);
        headWriteCellStyle.setWriteFont(headWriteFont); //在样式用应用设置的字体;
        // æ ·å¼
        headWriteCellStyle.setBorderBottom(BorderStyle.THIN);//设置底边框;
        headWriteCellStyle.setBottomBorderColor((short) 1);//设置底边框颜色;
        headWriteCellStyle.setBottomBorderColor((short) 0);//设置底边框颜色;
        headWriteCellStyle.setBorderLeft(BorderStyle.THIN);  //设置左边框;
        headWriteCellStyle.setLeftBorderColor((short) 1);//设置左边框颜色;
        headWriteCellStyle.setLeftBorderColor((short) 0);//设置左边框颜色;
        headWriteCellStyle.setBorderRight(BorderStyle.THIN);//设置右边框;
        headWriteCellStyle.setRightBorderColor((short) 1);//设置右边框颜色;
        headWriteCellStyle.setRightBorderColor((short) 0);//设置右边框颜色;
        headWriteCellStyle.setBorderTop(BorderStyle.THIN);//设置顶边框;
        headWriteCellStyle.setTopBorderColor((short) 1); //设置顶边框颜色;
        headWriteCellStyle.setTopBorderColor((short) 0); //设置顶边框颜色;
        headWriteCellStyle.setWrapped(false);  //设置自动换行;
@@ -53,24 +53,24 @@
        WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
        // è¿™é‡Œéœ€è¦æŒ‡å®š FillPatternType ä¸ºFillPatternType.SOLID_FOREGROUND ä¸ç„¶æ— æ³•显示背景颜色.头默认了 FillPatternType所以可以不指定
        contentWriteCellStyle.setFillForegroundColor(IndexedColors.LIGHT_GREEN.getIndex());
//        contentWriteCellStyle.setFillForegroundColor(IndexedColors.LIGHT_GREEN.getIndex());
        contentWriteCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND);
        // è®¾ç½®å­—体
        WriteFont contentWriteFont = new WriteFont();
        contentWriteFont.setFontHeightInPoints((short) 9);//设置字体大小
        contentWriteFont.setFontName("仿宋"); //设置字体名字
        contentWriteFont.setFontHeightInPoints((short) 10);//设置字体大小
        contentWriteFont.setFontName("等线"); //设置字体名字
        contentWriteCellStyle.setWriteFont(contentWriteFont);//在样式用应用设置的字体;
        //设置样式;
//        contentWriteCellStyle.setBorderBottom(BorderStyle.THIN);//设置底边框;
//        contentWriteCellStyle.setBottomBorderColor((short) 1);//设置底边框颜色;
        contentWriteCellStyle.setBorderBottom(BorderStyle.THIN);//设置底边框;
        contentWriteCellStyle.setBottomBorderColor((short) 0);//设置底边框颜色;
        contentWriteCellStyle.setBorderLeft(BorderStyle.THIN);  //设置左边框;
        contentWriteCellStyle.setLeftBorderColor((short) 1);//设置左边框颜色;
        contentWriteCellStyle.setLeftBorderColor((short) 0);//设置左边框颜色;
        contentWriteCellStyle.setBorderRight(BorderStyle.THIN);//设置右边框;
        contentWriteCellStyle.setRightBorderColor((short) 1);//设置右边框颜色;
        contentWriteCellStyle.setRightBorderColor((short) 0);//设置右边框颜色;
        contentWriteCellStyle.setBorderTop(BorderStyle.THIN);//设置顶边框;
        contentWriteCellStyle.setTopBorderColor((short) 1); ///设置顶边框颜色;
        contentWriteCellStyle.setTopBorderColor((short) 0); ///设置顶边框颜色;
        contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);// æ°´å¹³å±…中
        contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// åž‚直居中