You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Hamza Abdelkebir <ha...@gmail.com> on 2011/07/06 13:58:28 UTC

CellStyle cloneStyleFrom weird behavior (poi 3.8b3)

Hi all,
I am trying to apply a specific style to a certain cell (see file attached).
Nothing fancy just font size and set to bold.

The style is applied correctly to the wanted cell but also to all cells
below.

Here's the code to apply the cell style :

                        HSSFRow rt=sheet.getRow(writeIndex);
HSSFCell t=rt.getCell(5);
 t.setCellValue("Hardware List for Spare");
HSSFCellStyle style=destwb.createCellStyle();
 HSSFFont font=destwb.createFont();
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
 font.setFontHeightInPoints((short)24);
font.setFontName("Arial");
 style.setFont(font);
style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
t.getCellStyle().cloneStyleFrom(style);


PS: I am having the same problem when trying to draw cell borders (it works
fine with HSSFRegionUtil but it's REALLY slow)

Thanks for your help,
Hamza