How are you attempting to modify the background colour of the cell? Date values are simply numbers formatted to appear in a specific manner. If you are affecting the data format applied to the cell in any way - i.e. by creating a new cell style object and applying it to the date cell - then you will see the date value revert to a simple number. Ideally, you should do something like the following;
Recover the cell style object from the date cell you wish to modify. Set the background colour for that cell style object. There is however, one big problem with this. Cell styles are shared and so changing a style for one cell will also change the appearance of all of the cells the object is applied to. So, the better course of action would be to do something like this; Create a cell style object that you will apply to the date cells you wish to highlight before you begin processing the sheet. Set the data format and background colour appropriately. Apply this to the date cells you wish to highlight as you come across them whilst processing the sheet. A third option would be to do something like this. Declare a cell style object in you code that will be used to hold the style you use to highlight the date cells. The first time you identify a date cell that has to be highlighted, clone the style from that cell and store the reference in the variable declared above. Modify the background colour of the that cell style object. Apply it to the date cell you have found and to any other date cells you wish to highlight. Hope this helps Yours Mark B -- View this message in context: http://apache-poi.1045710.n5.nabble.com/date-cell-converted-into-numeric-tp3279534p3279674.html Sent from the POI - Dev mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
