title: Cant to remove a single row of excel using poi
body: <p>I am trying to delete a single row from the excel file but the can't do that, 
  see the code here</p>
  
  <pre><code>try{
  
      String val = request.getParameter("rdel");
      int va = 5;
      System.out.println("int val"+va);
      FileInputStream file = new FileInputStream(new File(fileName));     
      HSSFWorkbook wb = new HSSFWorkbook(file); // here exception occurs
              HSSFSheet sheet = wb.getSheetAt(0);        
  
  
  
          int lastRowNum=sheet.getLastRowNum();
          if(va&gt;=0&amp;&amp;va&lt;lastRowNum){
              sheet.shiftRows(va+1,lastRowNum, -1);
          }
          if(va==lastRowNum){
              HSSFRow removingRow=sheet.getRow(va);
              if(removingRow!=null){
                  sheet.removeRow(removingRow);
              }
          }
  
      FileOutputStream out = new FileOutputStream ("D:/task.xls");
      wb.write(out);
  
  
  
          }catch(Exception e){ 
          e.printStackTrace(); 
  }
          return SUCCESS;
  }   
  </code></pre>
  
  <p>see the exception</p>
  
  <pre><code>org.apache.poi.hssf.record.RecordFormatException: Unable to construct record instance
  at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:186)
  at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:328)
  at org.apache.poi.hssf.usermodel.HSSFWorkbook.&lt;init&gt;(HSSFWorkbook.java:271)
  at org.apache.poi.hssf.usermodel.HSSFWorkbook.&lt;init&gt;(HSSFWorkbook.java:196)
  at org.apache.poi.hssf.usermodel.HSSFWorkbook.&lt;init&gt;(HSSFWorkbook.java:312)
  at org.apache.poi.hssf.usermodel.HSSFWorkbook.&lt;init&gt;(HSSFWorkbook.java:293)
  at com.struts.curd.Delete.execute(Delete.java:47)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  at java.lang.reflect.Method.invoke(Unknown Source)
  </code></pre>