• Post Reply Bookmark Topic Watch Topic
  • New Topic

jxl(v2.0 thru 2.6.10) throws possible false exception "The workbook is password protected"  RSS feed

 
Herbert Wu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
New to java/excel parsing, and I am using jxl to parse some Excel(MS Excel workbook 97-2003 format) files and the code line(running under JDK6)
Workbook w = Workbook.getWorkbook(inputWorkbook);
throws this exception:

jxl.read.biff.PasswordException: The workbook is password protected
at jxl.read.biff.WorkbookParser.parse(WorkbookParser.java:582)
at jxl.Workbook.getWorkbook(Workbook.java:237)
at jxl.Workbook.getWorkbook(Workbook.java:198)

However I do not think the excel file is password protected as I can use MS Office Excel 2007 to open it(on Windows XP) without problem.
Anyone knows what might be the real cause of this problem or some tools to analyze the Excel file content?

A few tests I did so far:
(0) The jxl source code looks like this:
563 record = excelFile.next();
......
580 else if (record.getType() == Type.FILEPASS)
581 {
582 throw new PasswordException();
583 }
(1) I use MS Office Excel 2007 to open the original Excel file and copy-paste to a new blank workbook, then save it as a new file. The new file can be parsed by the same above code without problem.
(2) If I really use MS Office Excel 2007 to open the original Excel file and then saved it as password protected file, the jxl throws a different exception:
jxl.read.biff.BiffException: Compound file does not contain the specified stream
at jxl.read.biff.CompoundFile.getPropertyStorage(CompoundFile.java:443)
at jxl.read.biff.CompoundFile.getStream(CompoundFile.java:318)
at jxl.read.biff.File.<init>(File.java:135)
at jxl.Workbook.getWorkbook(Workbook.java:221)
at jxl.Workbook.getWorkbook(Workbook.java:198)


Thanks a lot for your help!

Herbert
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!