Bug 11097 - problem setting cell type through HSSF
Summary: problem setting cell type through HSSF
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 1.5
Hardware: All other
: P3 major (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2002-07-23 18:20 UTC by Dan Podsedly
Modified: 2004-11-16 19:05 UTC (History)
0 users

excel spreadsheet (13.50 KB, application/octet-stream)
2002-07-24 04:38 UTC, Dan Podsedly

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Podsedly 2002-07-23 18:20:29 UTC
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.
Comment 1 Andy Oliver 2002-07-24 02:05:21 UTC
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.  

Comment 2 Dan Podsedly 2002-07-24 04:38:45 UTC
Created attachment 2462 [details]
excel spreadsheet
Comment 3 Andy Oliver 2002-08-02 01:39:37 UTC
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.

Comment 4 Dan Podsedly 2002-08-06 17:42:13 UTC
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.
Comment 5 Andy Oliver 2002-08-06 23:43:16 UTC
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).
Comment 6 Dan Podsedly 2002-08-07 00:40:45 UTC
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?
Comment 7 Andy Oliver 2002-08-07 01:07:17 UTC
Sorry I mistyped I meant upgrade to 1.5.1.  

As for how to use HSSFColor, please read this

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.