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

解决方案 »

  1.   

    HSSFCellStyle.BORDER_NONE在哪里调用啊??
      

  2.   

    这样的话,要把sheet所有的cell都遍历一遍来设置,效率会影响吧,要是cell有好多什么办?应该有一个专门的函数直接设置这个sheet没有边框吧??
      

  3.   

    不止一行吧,要遍历的,获取sheet的总行数和总列数,然后一个个的设置cell,就要执行 row*col 次了。。
      

  4.   

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

  5.   

    其实跟HTML的表格一样的,可以参考页面上表格的设置