poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deibys F Quintero <d_...@yahoo.com>
Subject Re: backgrounf colors for cells do not apply
Date Wed, 03 Oct 2007 13:19:19 GMT
Paul, thanks a lot !!
easy trick, but useful,    by the way , it it a bug in apache poi api that setFillBackgroundColor
Does not work ? 
it would be great if any of you guys (commiters) could make it ? or see if it oem some sort
of my current software issue ( Office 2000 SR-1)

thanks !

deibys

----- Original Message ----
From: "Barrett, Paul" <Paul.Barrett@evotec.com>
To: POI Users List <user@poi.apache.org>
Sent: Wednesday, October 3, 2007 3:58:04 AM
Subject: RE: backgrounf colors for cells do not apply

...I did of course mean setFillForegroundColor() instead of
setFillForeground()... more haste less speed (or caffeine)!

Paul

-----Original Message-----
From: Deibys F Quintero [mailto:d_fdo@yahoo.com] 
Sent: 02 October 2007 21:59
To: user@poi.apache.org
Subject: backgrounf colors for cells do not apply

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 
Evotec (UK) Ltd is a limited company registered in England and Wales. Registration number:2674265.
Registered office: 111 Milton Park, Abingdon, Oxfordshire, OX14 4RZ, United Kingdom.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org







Send instant messages to your online friends http://uk.messenger.yahoo.com 
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message