Hi Reto, Yes, i've done that, but the trouble is that i get this very ugly 'java.lang.reflect.InvocationTargetException'. The other problem is that my application should able to handle password protected excel files.......
Cheers Lorenzo -----Original Message----- From: Reto Badertscher [mailto:[EMAIL PROTECTED]] Sent: Mittwoch, 15. Mai 2002 14:31 To: POI Users List Subject: AW: Trouble with password protected Excel Files Hi, i had the same problem - but i think it's not a bug of POI. You first have to unprotect the excel file. Regards Reto -----Urspr�ngliche Nachricht----- Von: Lorenzo Resta [mailto:[EMAIL PROTECTED]] Gesendet: Mittwoch, 15. Mai 2002 10:30 An: 'Poi-User (E-mail) Betreff: Trouble with password protected Excel Files Hi all, I just encountered a nasty bug in POI 1.5. I tried to read a password protected excel file with POI 1.5 and all i got was this stacktrace: java.lang.reflect.InvocationTargetException: java.lang.IllegalArgumentException: Illegal length at org.apache.poi.util.StringUtil.getFromUnicode(StringUtil.java:107) at org.apache.poi.hssf.record.FontRecord.fillFields(FontRecord.java:172) at org.apache.poi.hssf.record.Record.fillFields(Record.java:142) at org.apache.poi.hssf.record.Record.<init>(Record.java:104) at org.apache.poi.hssf.record.FontRecord.<init>(FontRecord.java:125) at java.lang.reflect.Constructor.newInstance(Native Method) at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:246 ) at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:18 4) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:140) at com.forumedia.dwb.spreadsheet.adapter.simple.SimpleWorkbookAdapter.open(Simp leWorkbookAdapter.java:242) at com.forumedia.dwb.spreadsheet.adapter.simple.SimpleWorkbookAdapter.open(Simp leWorkbookAdapter.java:229) at com.forumedia.dwb.datacollection.DataFile.getWorkbook(DataFile.java:189) at com.forumedia.dwb.ui.spreadsheet.SpreadSheetComponent.loadDatafile(SpreadShe etComponent.java:85) at com.forumedia.dwb.ui.spreadsheet.SpreadSheetComponent.setVisible(SpreadSheet Component.java:106) at com.forumedia.dwb.ui.commands.SelectWorkbookCommandContext.execute(SelectWor kbookCommandContext.java:48) at com.forumedia.dwb.ui.actions.SelectWorkbookAction.valueChanged(SelectWorkboo kAction.java:51) at javax.swing.JTree.fireValueChanged(JTree.java:2269) at javax.swing.JTree$TreeSelectionRedirector.valueChanged(JTree.java:2575) at javax.swing.tree.DefaultTreeSelectionModel.fireValueChanged(DefaultTreeSelec tionModel.java:612) at javax.swing.tree.DefaultTreeSelectionModel.notifyPathChange(DefaultTreeSelec tionModel.java:1006) at javax.swing.tree.DefaultTreeSelectionModel.setSelectionPaths(DefaultTreeSele ctionModel.java:288) at javax.swing.tree.DefaultTreeSelectionModel.setSelectionPath(DefaultTreeSelec tionModel.java:171) at javax.swing.JTree.setSelectionPath(JTree.java:1088) at javax.swing.plaf.basic.BasicTreeUI.selectPathForEvent(BasicTreeUI.java:2117) at javax.swing.plaf.basic.BasicTreeUI$MouseHandler.mousePressed(BasicTreeUI.jav a:2683) at java.awt.Component.processMouseEvent(Component.java:3712) at java.awt.Component.processEvent(Component.java:3544) at java.awt.Container.processEvent(Container.java:1164) at java.awt.Component.dispatchEventImpl(Component.java:2593) at java.awt.Container.dispatchEventImpl(Container.java:1213) at java.awt.Component.dispatchEvent(Component.java:2497) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2451) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2210) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125) at java.awt.Container.dispatchEventImpl(Container.java:1200) at java.awt.Window.dispatchEventImpl(Window.java:926) at java.awt.Component.dispatchEvent(Component.java:2497) at java.awt.EventQueue.dispatchEvent(EventQueue.java:339) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.ja va:131) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java :98) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:85) Exception occurred during event dispatching: org.apache.poi.hssf.record.RecordFormatException: Unable to construct record instance, the following exception occured: null at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:259 ) at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:18 4) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:140) at com.forumedia.dwb.spreadsheet.adapter.simple.SimpleWorkbookAdapter.open(Simp leWorkbookAdapter.java:242) at com.forumedia.dwb.spreadsheet.adapter.simple.SimpleWorkbookAdapter.open(Simp leWorkbookAdapter.java:229) at com.forumedia.dwb.datacollection.DataFile.getWorkbook(DataFile.java:189) at com.forumedia.dwb.ui.spreadsheet.SpreadSheetComponent.loadDatafile(SpreadShe etComponent.java:85) at com.forumedia.dwb.ui.spreadsheet.SpreadSheetComponent.setVisible(SpreadSheet Component.java:106) at com.forumedia.dwb.ui.commands.SelectWorkbookCommandContext.execute(SelectWor kbookCommandContext.java:48) at com.forumedia.dwb.ui.actions.SelectWorkbookAction.valueChanged(SelectWorkboo kAction.java:51) at javax.swing.JTree.fireValueChanged(JTree.java:2269) at javax.swing.JTree$TreeSelectionRedirector.valueChanged(JTree.java:2575) Any ideas, why this is happening. I always thought that POI is able read password protected excel files.... I attached the excel file that caused the trouble. The password of the excel file is simply "password" Cheers Lorenzo Resta <<passwordSample.xls>> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
