We are creating Excel workbooks through HSSF. Cell types are explicitly set to Numeric using cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC). Excel (version 9.0.2720) is having have a problem with SOME of these cells - they do not seem to have a specific cell type, and it does not allow a cell format to be set. The cell format item on the pop-up menu does nothing. Other cells seem to be fine. So far I have not been able to find a consistent pattern to this, but I do have a sample worksheet file which has some of these 'bad' cells.
please attach your worksheet. It would also be helpful to see some sample of the code you used to create it. Lastly, you're using 1.5 and not 1.5.1? Please confirm this is a problem in 1.5.1. -Andy
Created attachment 2462 [details] excel spreadsheet
Everything in this Workbook is a LabelSST record. Can you give us a copy of the source you generated this with? Generally when this happens we've got an invalid palette index. -Andy
Unfortunately I can't really give you the code that generated this - it's part of a rather complicated framework. How do you usually end up with an invalid palette index? We are using HSSFColorConstants to set cell colors.
upgrade to HSSF 1.5 and use HSSFColor instead. Some of these were corrected in 1.5 (this is a bug that has been fixed).
We are already using 1.5. There doesn't seem to be a way to use HSSFColor (even in 1.5.1) to set cell colors. The comment in the HSSFColor class states that the class "intends to provide support for the very evil index to triplet issue and will likely replace the color constants interface for HSSF 2.0". So, how do we use HSSFColor instead of the HSSFColorConstants?
Sorry I mistyped I meant upgrade to 1.5.1. As for how to use HSSFColor, please read this http://jakarta.apache.org/poi/hssf/quick-guide.html You are correct that the comment in HSSFColor is not nice. I believe it was just not changed when we decided to do a 1.5 release.