title: Is there a way to convert a .xlsx file to a .xls file and a .docx file to a .doc file upon clicking a button in java?
body: <p>I'm working on a java based web application. Which shows list of uploaded files by the logged in user along with hyperlink of the file and delete button. The delete button deletes the file from the database. Clicking on the hyperlink open the file content on the screen with suitable software. But users are not able to open files with following extensions: .xlsx and .docx. So I'm trying to convert the .xlsx file by copying the content to a new .xls file and copying the content of .docx file to a new .doc file and then show those files on screen.</p>
  
  <p>I'm using richfaces with ajax.</p>
  
  <pre><code>&lt;a4j:commandLink id="lnk_view"
                                          action ="#{FileUploadController.view}"
                                          style="display: none"
                                          onclick ="startLoad();"
                                          reRender="info"
                                          oncomplete = "stopLoad();"&gt;
                                          &lt;f:param name="selectedFile" value="#{file.serialNo}"/&gt;
  
  &lt;/a4j:commandLink&gt;
  </code></pre>
  
  <p>Expected Result: Clicking on the hyperlink/view button should show the content of the file selected on the screen.
  Actual result: "workbook cannot be opened or repaired by microsoft excel because it is corrupted". However, the file is not actually corrupted, because we can open the file from the location it is saved.</p>