日期:2014-05-18  浏览次数:21106 次

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);