title: Exception when writing to the xlsx document several times using apache poi 3.7
body: <p>I am getting the following exception while trying to write an <code>.xlsx</code> file using Apache POI: <code>org.apache.xmlbeans.impl.values.XmlValueDisconnectedException</code></p>
  
  <p>It seems the problem is using the method write () second time.
  When working with a HSSFWorkbook of this problem does not arise.</p>
  
  <p>Here's the Code:</p>
  
  <pre><code>public class SomeClass{
  
  XSSFWorkbook workbook;
  
  public SomeClass() throws IOException{
      File excelFile = new File("workbook.xlsx");
  
      InputStream inp = new FileInputStream(excelFile);
      workbook = new XSSFWorkbook(inp);
      inp.close();
  }
  
  void method(int i) throws InvalidFormatException, IOException {
  
      XSSFSheet sheet = workbook.getSheetAt(0);
      XSSFRow row = sheet.getRow(i);
      if (row == null) {
          row = sheet.createRow(i);
      }
      XSSFCell cell = row.getCell(i);
      if (cell == null)
          cell = row.createCell(i);
      cell.setCellType(Cell.CELL_TYPE_STRING);
      cell.setCellValue("a test");
  
      // Write the output to a file
      FileOutputStream fileOut = new FileOutputStream("workbook.xlsx");
      workbook.write(fileOut);
      fileOut.close();
  
  }
  
  public static void main(String[] args) throws Exception {
      SomeClass sc = new SomeClass();
  
      sc.method(1);
      sc.method(2);
  }
  }
  </code></pre>