求助各位大虾:
    我通过POI创建了一个Excel的表格,想把其中各表格的边框去掉,但中间某部分又希望有一块小表格带有边框。。
    请问各位有没有人弄过类似的东西,多谢了!!!!

解决方案 »

  1.   

    这个只能你自己定死了
    首先让所有的表格没有边框,然后对你特定的几个单元格在设置上边框
    ================================================================
    import   org.apache.poi.hssf.usermodel.*;   
        
      import   java.io.FileOutputStream;   
      import   java.io.IOException;   
        
      /**   
        *   Demonstrates   how   to   create   borders   around   cells.   
        *   
        *   @author   Glen   Stampoultzis   (glens   at   apache.org)   
        */   
      public   class   Borders   
      {   
              public   static   void   main(String[]   args)   
                      throws   IOException   
              {   
                      HSSFWorkbook   wb   =   new   HSSFWorkbook();   
                      HSSFSheet   sheet   =   wb.createSheet("new   sheet");   
        
                      //   Create   a   row   and   put   some   cells   in   it.   Rows   are   0   based.   
                      HSSFRow   row   =   sheet.createRow((short)   1);   
        
                      //   Create   a   cell   and   put   a   value   in   it.   
                      HSSFCell   cell   =   row.createCell((short)   1);   
                      cell.setCellValue(4);   
        
                      //   Style   the   cell   with   borders   all   around.   
                      HSSFCellStyle   style   =   wb.createCellStyle();   
                      style.setBorderBottom(HSSFCellStyle.BORDER_THIN);   
                      style.setBottomBorderColor(HSSFCellStyle.BLACK);   
                      style.setBorderLeft(HSSFCellStyle.BORDER_THIN);   
                      style.setLeftBorderColor(HSSFCellStyle.GREEN);   
                      style.setBorderRight(HSSFCellStyle.BORDER_THIN);   
                      style.setRightBorderColor(HSSFCellStyle.BLUE);   
                      style.setBorderTop(HSSFCellStyle.BORDER_MEDIUM_DASHED);   
                      style.setTopBorderColor(HSSFCellStyle.AUTOMATIC);   
                      cell.setCellStyle(style);   
        
                      //   Write   the   output   to   a   file   
                      FileOutputStream   fileOut   =   new   FileOutputStream("workbook.xls");   
                      wb.write(fileOut);   
                      fileOut.close();   
              }   
      }   
      这是设置边框的例子,你可以对需要设置的单元格进行这样的操作
      

  2.   

    sheet.setDisplayGridlines(false) ;是通过这句代码设置整个表格的边框吧/?
    但通过这句设置后,每个单元格的边框就不能再显示了(即使通过style重新设置)
      

  3.   

    到网上找找HSSFCellStyle 相关的设置把,可能这个小细节只有你自己去试试才行,