欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

poi excel设置合并单元格边框格式

发布时间:2024/9/5 编程问答 142 豆豆
生活随笔 收集整理的这篇文章主要介绍了 poi excel设置合并单元格边框格式 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

版本3.17

//设置合并单元格的边框
 public static void setBorderForMergeCell(BorderStyle style,int color, CellRangeAddress cra,Sheet sheet){
  RegionUtil.setBorderTop(style,cra,sheet);
  RegionUtil.setBorderBottom(style,cra,sheet);
  RegionUtil.setBorderLeft(style,cra,sheet);
  RegionUtil.setBorderRight(style,cra,sheet);
  RegionUtil.setTopBorderColor(color,cra,sheet);
  RegionUtil.setBottomBorderColor(color,cra,sheet);
  RegionUtil.setLeftBorderColor(color,cra,sheet);
  RegionUtil.setRightBorderColor(color,cra,sheet);
 }

调用

mergeCell(rowId, rowId + rowSkip,
        colIndex, colIndex + cellSkip,sheet); // 起始行, 终止行, 起始列, 终止列 // 终止行,
setBorderForMergeCell(BorderStyle.MEDIUM,(short)22,new CellRangeAddress(rowId, rowId + rowSkip,
        colIndex, colIndex + cellSkip),sheet);

转载于:https://www.cnblogs.com/pu20065226/p/10120370.html

总结

以上是生活随笔为你收集整理的poi excel设置合并单元格边框格式的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。