title: Apache POI, creating new cells overrides the row style
body: <p>I'm using Apache POI to export data to a .xlsx file and I want to style some of the rows and cells contained in the file.</p>
  
  <p>I'm using XSSF since the file is going to be read in Excel 2007+.</p>
  
  <p>Basically, my problem is that I'm trying to set a row style like in the following example, which sets a black foreground color for the entire row at index 0. It works fine, but whenever I create a new cell, the newly created cell has no style, as if it's overriding the row style I specified.</p>
  
  <p>Here's a code snippet to demonstrate what I'm doing:</p>
  
  <pre><code>XSSFWorkbook wb = new XSSFWorkbook();
  XSSFSheet sheet = wb.createSheet("mySheet");
  XSSFRow row = sheet.createRow(0);
  
  XSSFCellStyle myStyle = wb.createCellStyle();           
  
  myStyle.setFillForegroundColor(new XSSFColor(new Color(255, 255, 255)));
  myStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
  
  row.setRowStyle(myStyle); //This works, the whole row is now black
  
  row.createCell(0); // This cell doesn't have a style, the rest of the line stays stylized
  row.getCell(0).setCellValue("Test");
  </code></pre>
  
  <p>I also tried *row.createCell(0, Cell.CELL_TYPE_STRING);*, but it didn't change anything.</p>
  
  <p>What is the correct way of accomplishing what I want to do? I wanted to do it this way so I didn't have to set each cell's style after creating it since all cells on the same row have the same style.</p>