[alibaba/easyexcel]TableStyle样式无法设置边框,同时文档右边框缺失

2024-06-20 931 views
2

TableStyle样式无法设置边框,同时文档右边框缺失

回答

7

确实有这个问题

9

public class StyleUtil { public StyleUtil() { }

public static CellStyle buildDefaultCellStyle(Workbook workbook) {
    CellStyle newCellStyle = workbook.createCellStyle();
    Font font = workbook.createFont();
    font.setFontName("宋体");
    font.setFontHeightInPoints((short)14);
    font.setBold(true);
    newCellStyle.setFont(font);
    newCellStyle.setWrapText(true);
    newCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
    newCellStyle.setAlignment(HorizontalAlignment.CENTER);
    newCellStyle.setLocked(true);
    newCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    newCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
    newCellStyle.setBorderBottom(BorderStyle.THIN);
    newCellStyle.setBorderLeft(BorderStyle.THIN);
    return newCellStyle;
}

}

源码里默认样式 写死的,默认就设置了底部和左边的边框,很难受