First create your style:

            CellStyle sectionHeaderStyle = wb.createCellStyle();
            sectionHeaderStyle.setFillPattern(CellStyle.SOLID_FOREGROUND 
);
 
sectionHeaderStyle.setFillForegroundColor(IndexedColors.LIGHT_CORNFLOWER_BLUE.getIndex());

Then apply it:

            cell.setCellStyle(sectionHeaderStyle);

-Lou

adile <[email protected]> wrote on 2012-11-26 05:16:10 AM:

> From: adile <[email protected]>
> To: [email protected], 
> Date: 2012-11-26 05:16 AM
> Subject: How to use CellUtil class to add cell properties
> 
> Hi,
> 
> Does anyone have an example to use CellUtil class - for example  change
> background color in a cell ?
> 
> 
> i try something but that doesn't work
> 
> CellUtil.setCellStyleProperty(cell, wb, CellUtil.FILL_BACKGROUND_COLOR,
> HSSFColor.VIOLET.index);
> 
> i'm not sur for the 2 last parameters.
> 
> Thank you
> 
> 
> 
> --
> View this message in context: http://apache-poi.
> 1045710.n5.nabble.com/How-to-use-CellUtil-class-to-add-cell-
> properties-tp5711548.html
> Sent from the POI - User mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 

Reply via email to