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);
标签:EasyExcel,单元格,边框,contentWriteCellStyle,THIN,new,BorderStyle,HorizontalCellStyleS 来源: https://www.cnblogs.com/fxsenblog/p/15467424.html