本文共 384 字,大约阅读时间需要 1 分钟。
场景
SpringBoot中使用POI实现自定义Excel布局式导出实现
创建一个新的XSSFWorkbook对象
XSSFWorkbook book = new XSSFWorkbook();
新建sheet页并赋予名称
Sheet tempSheet = null; tempSheet = book.createSheet(); book.setSheetName(0, "霸道流氓");
创建单元格样式对象并设置居中对齐
XSSFCellStyle alignStyle = book.createCellStyle(); alignStyle.setAlignment(XSSFCellStyle.ALIGN_CENTER);
设置单元格水平左对齐
alignStyle.setAlignment(XSSFCellStyle.ALIGN_LEFT);
转载地址:http://ukxfk.baihongyu.com/