Hello Ravi,
That's because one style can be applied to several cells.
Excel is "clever" and save style objects when they are equals.
So you have to clone the HSSFStyle that you find in the cell, update it, and
set it again in your cell
If you want to apply the same change to all you cells, you can also keep
this clone and set it in all your cells.
I don't remember but there is a specific method to clone the cell style.
Pierre
On Fri, Sep 26, 2008 at 2:54 PM, Ravi Sundaar <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a question about the HSSFStyle object:
>
> I need to change the style for a few cells in my spreadsheet - setting a
> thick border and so on. However, when I try that the style gets applied to
> the whole spreadsheet!! Even if I set the style for just for one cell, it
> seems to apply it to all cells.
>
>
> Here is the code snippet that does that:
>
> int col = 10;
> for (int i = startRow; i <= endRow; i++)
> { HSSFCell cell = sheet.getRow(i).getCell(col,
> HSSFRow.CREATE_NULL_AS_BLANK); HSSFCellStyle style = cell.getCellStyle();
> style.setBorderRight(HSSFCellStyle.BORDER_THICK);
> style.getRightBorderColor(); cell.setCellStyle(style); }
>
> What am I doing wrong? Is there a workaround?
>
> Thanks,
> Ravi.
> _________________________________________________________________
> Want to do more with Windows Live? Learn "10 hidden secrets" from Jamie.
>
> http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008<http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns%21550F681DAD532637%215295.entry?ocid=TXT_TAGLM_WL_domore_092008>
--
Cordialement,
Pierre Lavignotte
Ingénieur Conception & Développement
http://pierre.lavignotte.googlepages.com