title: NPOI Insert/append value to .xls file
body: <p>I have problem with append data to existing excel file.</p>
  
  <p>Here is the code: </p>
  
  <pre><code>HSSFWorkbook hssfwb;
  FileStream file1 = new FileStream(pathDoXls, FileMode.Open, FileAccess.Read);
  hssfwb = new HSSFWorkbook(file1);
  
  ISheet sheet = hssfwb.GetSheet("Zawodnicy");
  int ostatniWiersz = sheet.LastRowNum;
  textBox14.Text = (ostatniWiersz+1).ToString();
  Console.WriteLine(ostatniWiersz);
  
  ICell cell = sheet.CreateRow(ostatniWiersz+1).CreateCell(0);
  cell.SetCellValue(textBox14.Text);
  
  ICell cell1 = sheet.CreateRow(ostatniWiersz + 1).CreateCell(1);
  cell1.SetCellValue(textBox2.Text);
  
  //sheet.CreateRow(ostatniWiersz + 1).CreateCell(1).SetCellValue(textBox2.Text);
  //sheet.CreateRow(ostatniWiersz + 1).CreateCell(2).SetCellValue(textBox3.Text);
  
  FileStream file = new FileStream(pathDoXls, FileMode.Create);
  hssfwb.Write(file);
  file.Close();
  </code></pre>
  
  <p>Theoretically this part of code : </p>
  
  <pre><code>ICell cell = sheet.CreateRow(ostatniWiersz+1).CreateCell(0);
  cell.SetCellValue(textBox14.Text);
  
  ICell cell1 = sheet.CreateRow(ostatniWiersz + 1).CreateCell(1);
  cell1.SetCellValue(textBox2.Text);
  </code></pre>
  
  <p>Should create cell in last row position, I mean:</p>
  
  <pre><code>ostatniWiersz=10
  </code></pre>
  
  <p>so in row 11 and cell 0 should be textBox14 content 
  in row 11 cell 1 should be textBox2 content.</p>
  
  <p>But when I compile this code I have value only in row 11 cell 1. Theoretically value should be insert at both fields(I mean cell 0 and 1) </p>
  
  <p>Thanks for help. </p>