title: Error Message after creating XLSX file using java
body: <p>I am using apache poi to create a simple xlsx file using java as follows</p>
  
  <pre><code>    String date = "2014/12/29";
      XSSFWorkbook  w = ADPFidessa.createExcelWorkbook(date);
      response.reset();
      response.setContentType("application/xlsx");
      response.setHeader("Content-Disposition", "attachment;filename=ADP_Fidessa.xlsx");
      w.write(response.getOutputStream());
  </code></pre>
  
  <p>and here is the createExcelWorkbook method</p>
  
  <pre><code>public static XSSFWorkbook createExcelWorkbook(String sBsnsDt) throws Exception
     {
      // create a new file
      FileOutputStream out = new FileOutputStream("workbook.xlsx");
  
      // create a new workbook
      XSSFWorkbook wb = new XSSFWorkbook();
      // create a new sheet
      XSSFSheet s = wb.createSheet("Sheet1");
  
      // declare a row object reference
      XSSFRow r;
      // declare a cell object reference
      XSSFCell c;
  
      ArrayList&lt;ADPFidessa&gt; aDADPFidessalist=null;
      ADPFidessaDAO adpfiddao = new ADPFidessaDAO();
      aDADPFidessalist=adpfiddao.showADPFid(sBsnsDt);      
  
      int rownum;
      // header row and columns
      r = s.createRow(0);
  
      c = r.createCell(0);
      c.setCellValue("Business Date");
  
      c = r.createCell(1);
      c.setCellValue("ID");
  
      c = r.createCell(2);
      c.setCellValue("Ant");
  
      c = r.createCell(3);
      c.setCellValue("Sol");
  
      c = r.createCell(4);
      c.setCellValue("itions");
  
      c = r.createCell(5);
      c.setCellValue(sition");
  
      c = r.createCell(6);
      c.setCellValue("ffere");
  
      c = r.createCell(7);
      c.setCellValue("Age");
  
      rownum = 1;
      for (ADPFidessa di : aDADPFidessalist)
      {
  
       r = s.createRow(rownum);
       c = r.createCell(0);
       c.setCellValue(di.getBusinessDate());
  
       c = r.createCell(1);
       c.setCellValue(di.getkId());
  
       c = r.createCell(2);
       c.setCellValue(di.getAnt());
  
       c = r.createCell(3);
       c.setCellValue(di.getSol());
  
       c = r.createCell(4);
       c.setCellValue(di.getition());
  
  
       c = r.createCell(5);
       c.setCellValue(di.getsition());
  
       c = r.createCell(6);
       c.setCellValue(di.getffere());
       c = r.createCell(7);
       c.setCellValue(di.getAge());
  
  
       rownum++;
      } 
  
      try {
          wb.write(out);
          out.close();
      } catch (Exception e) {
          System.out.println("Error");
          System.out.println(e);
      }
      return wb;
     }
  </code></pre>
  
  <p>the method showADPFid(sBsnsDt); returns the correct values and the output file is correctly saved. Here is the problem. When i try to open the file in MS Excel, it shows an error message</p>
  
  <p><img src="https://i.stack.imgur.com/DdXd2.png" alt="enter image description here"></p>
  
  <p>now, after clicking 'Yes', the excel file opens and all the data is there as expected. However, another dialogue box appears</p>
  
  <p><img src="https://i.stack.imgur.com/exi0o.png" alt="enter image description here"></p>
  
  <p>the log file shows</p>
  
  <p><img src="https://i.stack.imgur.com/DWRXJ.png" alt="enter image description here"></p>
  
  <p>can anyone please give any idea about this error ? How to resolve this ?</p>
  
  <p>thanks</p>
  
  <p>EDIT: also, here are my imports</p>
  
  <pre><code>import org.apache.poi.xssf.usermodel.XSSFCell;
  import org.apache.poi.xssf.usermodel.XSSFRow;
  import org.apache.poi.xssf.usermodel.XSSFSheet;
  import org.apache.poi.xssf.usermodel.XSSFWorkbook;
  import org.apache.poi.xssf.util.*;
  </code></pre>