You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by adile <ai...@gmail.com> on 2012/11/26 11:16:10 UTC

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: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: How to use CellUtil class to add cell properties

Posted by Lo...@log-net.com.
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 <ai...@gmail.com> wrote on 2012-11-26 05:16:10 AM:

> From: adile <ai...@gmail.com>
> To: user@poi.apache.org, 
> 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: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>