Apache POI, creating new cells overrides the row style

Even you create a row with style, it will not effect to created cell of its. The create cell have their own cell style. The row style will not override to cell style automatically. If you would like use row style in cell, you have to set again.

Even if you set row style at end, it will not effect to cell.

Example

CreationHelper createHelper = wb.getCreationHelper();
Sheet sheet = wb.createSheet("new sheet");
Row r = sheet.createRow(0);
r.setRowStyle(rowStyle);

Cell c1 = r.createCell(0);
c1.setCellValue("Test 1");
c1.setCellStyle(rowStyle);

Set the style into newly created cell as well e.g. below:

    XSSFCell newCell = row.createCell(0);
    newCell.setCellStyle(myStyle);