Search code examples
javaexcelapache-poicell

Apache POI gridline dissapear after setting new cellstyle


I am generating HSSF style workbook.

After creating new CellStyle my grid lines disappear. I don't want to put BorderStyle.DORDER_THIN because that is not like just grid line. I has bigger edges. I have tried in sheet currentSheet.setDisplayGridlines(false)

my code:

HssfCellStyle hssfCellStyle = hssfWorkbook.createCellStyle
Font hssfFont = this.getFontFor(rowCellStyle.cellFont)
hssfCellStyle.setFont(hssfFont)
               hssfCellStyle.setFillForegroundColor(rowCellStyle.backgroundColor.hssfColor.getIndex)             
hssfCellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);

so this makes disappear gdi lines


Solution

  • SOLUTION:

    I was little bit stupid. Default grid line is not border, so if you put some color then that default grid line is filled with that color. Default Cell color is AUTOMATIC -> what means TRANSPARENT and because of that default grid can been seen.

    default color = new HSSFColor.AUTOMATIC()