提交 e39ecde4 编写于 作者: xuhui961310148's avatar xuhui961310148

poi版本引入3.13版本,解决报表导出时单元格合并问题

上级 4c0a5305
......@@ -136,29 +136,29 @@ public class ExcelTool<T> {
//内部统一调用的样式初始化
private void init(int styleFlag){
this.styleHead = this.workbook.createCellStyle();
this.styleHead.setAlignment(HorizontalAlignment.CENTER);// 左右居中
this.styleHead.setVerticalAlignment(VerticalAlignment.CENTER);// 上下居中
this.styleHead.setAlignment(HSSFCellStyle.ALIGN_CENTER);// 左右居中
this.styleHead.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);// 上下居中
this.styleHead.setRightBorderColor(HSSFColor.BLACK.index);
this.styleHead.setBottomBorderColor(HSSFColor.BLACK.index);
this.styleHead.setWrapText(true);// 表头自动换行
switch(styleFlag){
case 1:
this.styleBody = this.workbook.createCellStyle();
this.styleBody.setAlignment(HorizontalAlignment.CENTER);// 左右居中ALIGN_CENTER
this.styleBody.setVerticalAlignment(VerticalAlignment.CENTER);// 上下居中
this.styleBody.setAlignment(HSSFCellStyle.ALIGN_LEFT);// 左右居中ALIGN_CENTER
this.styleBody.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);// 上下居中
this.styleBody.setRightBorderColor(HSSFColor.BLACK.index);
this.styleBody.setBottomBorderColor(HSSFColor.BLACK.index);
this.styleBody.setBorderRight(BorderStyle.THIN);// 边框的大小
this.styleBody.setBorderBottom(BorderStyle.THIN);// 边框的大小
this.styleBody.setBorderRight((short) 1);// 边框的大小
this.styleBody.setBorderBottom((short) 1);// 边框的大小
break;
default:
this.styleBody = this.workbook.createCellStyle();
this.styleBody.setAlignment(HorizontalAlignment.CENTER);// 左右居中ALIGN_CENTER
this.styleBody.setVerticalAlignment(VerticalAlignment.CENTER);// 上下居中
this.styleBody.setAlignment(HSSFCellStyle.ALIGN_CENTER);// 左右居中ALIGN_CENTER
this.styleBody.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);// 上下居中
this.styleBody.setRightBorderColor(HSSFColor.BLACK.index);
this.styleBody.setBottomBorderColor(HSSFColor.BLACK.index);
this.styleBody.setBorderRight(BorderStyle.THIN);// 边框的大小
this.styleBody.setBorderBottom(BorderStyle.THIN);// 边框的大小
this.styleBody.setBorderRight((short) 1);// 边框的大小
this.styleBody.setBorderBottom((short) 1);// 边框的大小
break;
}
}
......@@ -476,9 +476,9 @@ public class ExcelTool<T> {
sheetCo.addMergedRegion(cra);
// 使用RegionUtil类为合并后的单元格添加边框
RegionUtil.setBorderBottom(BorderStyle.THIN, cra,sheetCo); // 下边框
RegionUtil.setBorderLeft(BorderStyle.THIN, cra,sheetCo); // 左边框
RegionUtil.setBorderRight(BorderStyle.THIN, cra,sheetCo); // 有边框
RegionUtil.setBorderBottom(1, cra,sheetCo,this.workbook); // 下边框
RegionUtil.setBorderLeft(1, cra, sheetCo,this.workbook); // 左边框
RegionUtil.setBorderRight(1, cra, sheetCo,this.workbook); // 有边框
if(tpamscolumn.isHasChilren()){
rowIndex=r+1;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册