title: apache poi cellIterator skips blank cells but not in first row
body: <p>I am creating a java program to read an excel sheet and create a comma separated file. When I run my sample excel file, with blank columns, The first row works perfectly, but the rest of the rows skip the blank cells.
       I have read about the code changes required to insert blank cells into the rows, but my question is why does the first row work  ????</p>
  
  <hr>
  
  <pre><code>public ArrayList OpenAndReadExcel(){
      FileInputStream file = null;
      HSSFWorkbook workBook = null;
      ArrayList &lt;String&gt; rows = new ArrayList();
  
      //open the file
  
      try {
           file = new FileInputStream(new File("Fruity.xls"));
      } catch (FileNotFoundException e) {
          // TODO Auto-generated catch block
          System.out.println("Could not open Input File");
          e.printStackTrace();
      }
  
      //  open the input stream as a workbook
  
          try {
               workBook = new HSSFWorkbook(file);
          } catch (IOException e) {
              // TODO Auto-generated catch block
              System.out.println("Can't Open HSSF workbook");
              e.printStackTrace();
          }
  
          // get the sheet
          HSSFSheet sheet = workBook.getSheetAt(0);
  
          // add an iterator for every row and column
          Iterator&lt;Row&gt; rowIter = sheet.rowIterator();
  
          while (rowIter.hasNext())
          {
  
              String rowHolder = "";
              HSSFRow row = (HSSFRow) rowIter.next();
              Iterator&lt;Cell&gt; cellIter = row.cellIterator();
              Boolean first =true;
              while ( cellIter.hasNext())
              {
                  if (!first)
                      rowHolder = rowHolder + ",";
  
                  HSSFCell cell = (HSSFCell) cellIter.next();
  
                  rowHolder = rowHolder + cell.toString() ;
                  first = false;
              }
  
              rows.add(rowHolder);
  
          }
  
      return rows;
  
  }
  public void WriteOutput(ArrayList&lt;String&gt; rows) {
  
      // TODO Auto-generated method stub
      PrintStream outFile ;
      try {
  
  
          outFile = new PrintStream("fruity.txt");
          for(String row : rows)
          {   
              outFile.println(row);
          }
          outFile.close();
  
      } catch (FileNotFoundException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>}<br/>
  -----<br/>
  my Input  in .xls file   (Sorry don't know how to insert an excel table here )<br/>
  <br/>
  Name >>>>>>>>>> Country of Origin >>>>>>>>> State of origin >>>>>>> Grade>>>>>> No of months <br/>
  Apple >>>>>>>> USA >>>>>>>>>>>>>>>>>>>>>> Washington >>>>>>>>>>>>>> A >>>>>>>>>  6<br/>
  orange  >>>>>> USA >>>>>>>>>>>>>>>>>>>>>> Florida >>>>>>>>>>>>>>>>> A >>>>>>>>>  9<br/>
  pineapple>>>>> USA >>>>>>>>>>>>>>>>>>>>>> Hawaii >>>>>>>>>>>>>>>>>> B >>>>>>>>> 10<br/>
  strawberry>>>> USA >>>>>>>>>>>>>>>>>>>>>> New Jersey>>>>>>>>>>>>>>  C >>>>>>>>>> 3<br/>
  <br/>
  <strong>my output text file</strong>
  <br/>
  Name ,Country of Origin,State of origin,,,Grade,No of months<br/>
  Apple,USA,Washington,A,6.0<br/>
  orange,USA,Florida,A,9.0<br/>
  pineapple,USA,Hawaii,B,10.0<br/>
  strawberry,USA,New Jersey,C,3.0<br/></p>
  
  <hr>
  
  <pre><code>Notice the two extra commas before the Grade column... This is because I have two blank columns there.&lt;br/&gt;
  </code></pre>
  
  <p>These extra commas are missing in the rest of the output.<br/></p>
  
  <p>I am using Apache Poi-3.9-20121203.jar</p>