title: Password protected xls/xlsx file in java
body: <p>I have created password protected zip file which has xls file with the help of this <a href="http://java.sys-con.com/node/1258827" rel="nofollow">http://java.sys-con.com/node/1258827</a>.</p>
  
  <p>My question is ,Is there any java api which will create password protected xls file instead of zip file. 
  I want to directly apply password on xls file.Encryption/Decryption is the option but want to prompt when when double clicked on file.</p>
  
  <p>edit:
  I got this<br>
  <code>HSSFSheet.protectSheet("xyz");</code>but it only makes sheet read only. </p>
  
  <p>Even I have tried this <code>hssfworkbook.writeProtectWorkbook("abc", "abc");</code>but its not prompting for password. </p>
  
  <p>Edit1:There is the method in <code>org.apache.poi.hssf.record.crypto.Biff8EncryptionKey</code> package to open password protected excel file  <code>org.apache.poi.hssf.record.crypto.Biff8EncryptionKey.setCurrentUserPassword(password);</code>
   Is there any method to set password on unprotected excel file? </p>
  
  <p>Edit2:
  I tried JExcel API</p>
  
  <p><code>Workbook w=Workbook.getWorkbook(new File("c:\\employees22533.xls"));<br>
  Sheet ws=null;<br>
  ws=w.getSheet("Employee List");<br>
  SheetSettings sh=ws.getSettings();<br>
  sh.setPassword("abc");</code> </p>
  
  <p>But its not setting any password</p>