title: Using Java to open excel then to read xml and then save as xls
body: <p>My response from server is in xml format, I am able to open this file using excel and excel will auto generate the table for me. After that I can save this file as xls, and my java program is capable of retreiving those information through loops. My question is how do I use java code to replace the step " open xml using excel, wait for auto generated table, then save this file as xls". I tried several ways, it is not going to work, if I open the xml file using java code, it will give me invalid header error. Any help would be greatly appreciated. My code is as follow:</p>
  
  <pre><code>FileInputStream input = new FileInputStream("Y:\\xx\\xx .xml");  
   POIFSFileSystem fs = new POIFSFileSystem( input );  
    HSSFWorkbook wb = new HSSFWorkbook(fs);
    FileOutputStream fos = new FileOutputStream("Y:\\xx\\xx.xls") ;
    wb.write(fos);
    fose.close();
  </code></pre>
  
  <p>This will give me invalid header error, please help.</p>