当前位置: 代码迷 >> J2EE >> poi生成excel,怎样设置表格无边框?解决方案
  详细解决方案

poi生成excel,怎样设置表格无边框?解决方案

热度:379   发布时间:2016-04-19 22:54:43.0
poi生成excel,怎样设置表格无边框???
就是每个cell都没有边框。。。。
------解决方案--------------------
   public static void setBorders(HSSFCellStyle style, short lc, short bc, short rc, short tc, short bl, short bb, short br, short bt) {
      style.setBottomBorderColor(lc);
      style.setLeftBorderColor(bc);
      style.setRightBorderColor(rc);
      style.setTopBorderColor(tc);
      style.setBorderLeft(bl);
      style.setBorderBottom(bb);
      style.setBorderRight(br);
      style.setBorderTop(bt);
   }

   cell.cell.setCellStyle(style);

------解决方案--------------------
HSSFCellStyle.BORDER_NONE
------解决方案--------------------
引用:
引用:

Java code
public static void setBorders(HSSFCellStyle style, short lc, short bc, short rc, short tc, short bl, short bb, short br, short bt) {
style.setBottomBorderColor(lc)……


没有影响的。。  执行一行代码而已, 边框的设置要分左右上下。。

------解决方案--------------------
每个cell都有自己的样式。

      HSSFCellStyle noBorder = book.createStyle();
      style.setBorderLeft(HSSFCellStyle.BORDER_NONE);
      style.setBorderBottom(HSSFCellStyle.BORDER_NONE);
      style.setBorderRight(HSSFCellStyle.BORDER_NONE);
      style.setBorderTop(HSSFCellStyle.BORDER_NONE);
      cell.setCellStyle(noBorder);
  相关解决方案