The file testBoolErr.xls generated by TestHSSFCell crashes Excel '97
Created attachment 4633 [details] Junit generated excel file
this one works in Excel v.X...
This does not work in any version of Excel, unless you run the testcase against the head. In that case, the testcase produces a spreadsheet that loads properly, but the testcase fails. The reason is that the testcase calls HSSCell.setErrorValue( (byte) 1), which is an invalid argument. The valid arguments are 0 #NULL! 7 #DIV/0! 15 #VALUE! 23 #REF! 29 #NAME? 36 #NUM! 42 #N/A These are the 7 error types allowed in Excel. There are no others. If you set the erro value of a BOOLERR record to any other value, the spreadsheet will not load in Excel. Why these magic numbers? Put the error codewords together in a string and seperate each with a \0, like you would if you were programming in C. The magic numbers are the offsets to the beginning of each codeword. #NULL! #DIV/0! #VALUE! #REF! #NAME? #NUM! #N/A 0123456789012345678901234567890123456789012345 0 1 2 3 4 I would work on a patch for this but... the HEAD is very strange right now. The performance branch merge seems to have changed *everything*. My instinct is that BoolErrRecord should throw an exception if the client tries to set an unacceptable value. Add public static final int into BoolErrRecord to represent the 7 allowed values. Change the testcase that produces testBoolErr.xls. And add a new testcase to verify that invalid arguments to HSSFCell.setErrorValue throw an exception.
Fixed in Branch. Added check to BoolErrorRecord, to throw RuntimeException, and updated Testcase. Committed the same changes to HEAD, but the tescase was already failing in HEAD.