EasyExcel设置单元格边框

/**
    * 单元格边框
    * @return {@link HorizontalCellStyleStrategy}
    * @date 2021/10/26 13:22
    * @author <a href="">fxsen</a> <br/>
    * @version 1.0.0 <br/>
    **/
    public static HorizontalCellStyleStrategy cellBorder(){
        WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
        contentWriteCellStyle.setBorderLeft(BorderStyle.THIN);
        contentWriteCellStyle.setBorderTop(BorderStyle.THIN);
        contentWriteCellStyle.setBorderRight(BorderStyle.THIN);
        contentWriteCellStyle.setBorderBottom(BorderStyle.THIN);
        return new HorizontalCellStyleStrategy(contentWriteCellStyle, contentWriteCellStyle);
    }

调用示例

EasyExcel.write(response.getOutputStream())
        .head(ExcelHeaderUtil.getColumnName(columnName))
        .registerWriteHandler(ExcelHeaderUtil.cellBorder())
        .registerWriteHandler(new EasyExcelCustomCellWriteHandler())
        .sheet("栏目数据").doWrite(list);
上一篇:Elasticsearch 如何实现相似推荐功能?


下一篇:意外断电造成RAID 5阵列卡数据故障的恢复方法