hello guys,
I hope some of you can help me.....I am using Apache POI, and it is an
excellent library for generating excel files on the fly
But I have an issue , I am trying to apply background colors to some cells, but
they dont apply, if I apply font colors, bold ...and so , any other style
feature it works, but I dont know what happens with backgrond colors
I am using :
* latest apache poi 3.0.1
* jdk 1.6
* Excel 2000
And Bellow it is my code;
font3 = book.createFont();
font3.setFontHeightInPoints((short)10);
font3.setFontName(HSSFFont.FONT_ARIAL);
font3.setColor(HSSFColor.BLUE.index);
font3.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
font4 = book.createFont();
font4.setFontHeightInPoints((short)9);
font4.setFontName(HSSFFont.FONT_ARIAL);
font4.setColor(HSSFColor.BLUE.index);
font4.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
estiloEncabezado1 = book.createCellStyle();
estiloEncabezado2 = book.createCellStyle();
estiloEncabezado1.setFillBackgroundColor(HSSFColor.SKY_BLUE.index);
estiloEncabezado1.setAlignment(HSSFCellStyle.ALIGN_CENTER);
estiloEncabezado1.setFont(font3);
estiloEncabezado2.setFillBackgroundColor(HSSFColor.GREEN.index);
estiloEncabezado2.setAlignment(HSSFCellStyle.ALIGN_CENTER);
estiloEncabezado2.setFont(font4);
..................
y aqui aplico los estilos.........
row = sheet.createRow((short)filaNumber);
cell = row.createCell((short) 0);
value = new HSSFRichTextString("CORRELACIONES");
cell.setCellValue(value);
cell.setCellStyle(estiloEncabezado1);
sheet.addMergedRegion(new Region(filaNumber,(short)0,filaNumber,(short)6));
filaNumber = filaNumber + 2;
row = sheet.createRow((short)filaNumber);
cell = row.createCell((short) 0);
value = new HSSFRichTextString("No.");
cell.setCellValue(value);
cell.setCellStyle(estiloEncabezado2);
cell = row.createCell((short) 1);
value = new HSSFRichTextString("Indicador");
cell.setCellValue(value);
cell.setCellStyle(estiloEncabezado2);
...........
Fonts and Alignment are applied , but background colors are not...
In the Quick-Guide in the apche poi HSSF documentation , i guess it is
supported , but I am really unsure about what I might be missing
I really appreciate any help
deibys
Send instant messages to your online friends http://uk.messenger.yahoo.com