title: Apache POI setting cells to 0
body: <p>I'm using Apache POI to generate cells but I'm noticing that it seems to set all my cells to the same value. In this case 0. I don't really see why. When I am about to save my sheet to file I can see that the cells have values, but when looking at the generated file it is empty. Any help would be greatly appreciated.</p>
  
  <p>Here is a screen of the debugging when I can see that some cells have values(such as the "5" in the debug window):</p>
  
  <p><a href="https://i.stack.imgur.com/2CuUg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2CuUg.png" alt="enter image description here"></a></p>
  
  <p>Here is the code I am using to generate the sheet:</p>
  
  <pre><code>@Override
  public void generate(TableRepresentation tableRepresentation) {
      int rows = tableRepresentation.getRows();
      int columns = tableRepresentation.getColumns();
      final HSSFWorkbook workbook = new HSSFWorkbook();
      final HSSFSheet sheet = workbook.createSheet();
      for (int i = 0; i &lt; rows; i++) {
  
          final HSSFRow row = sheet.createRow(i);
          for (int j = 0; j &lt; columns; j++) {
              row.createCell(j).setCellValue(tableRepresentation.get(i, j));
          }
  
      }
  
      try {
          final FileOutputStream fos = new FileOutputStream("tjockis.xls");
  
          workbook.write(fos);
          fos.close();
      } catch (FileNotFoundException e) {
          e.printStackTrace();
      } catch (IOException e) {
          e.printStackTrace();
      }
      System.out.println("tjockis.xls" + " written successfully");
  
  }
  
  public interface TableRepresentation {
      int getRows();
  
      int getColumns();
  
      String get(int i, int j);
  }
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>Here is how the exported sheet looks:</p>
  
  <p><a href="https://i.stack.imgur.com/s0T3X.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/s0T3X.png" alt="enter image description here"></a></p>