Bug 6806 - HSSFCellStyle - fillBackgroundColor
Summary: HSSFCellStyle - fillBackgroundColor
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 1.0.2
Hardware: Other other
: P3 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-03-01 21:21 UTC by Andy Oliver
Modified: 2005-08-22 21:19 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andy Oliver 2002-03-01 21:21:05 UTC
[ 523894 ] HSSFCellStyle - fillBackgroundColor
Email:    (?)
Date:
2002-02-28 08:02 Priority:
5
Submitted By:
Mose IADAROLA (miadarola) Assigned To:
Glen Stampoultzis (gstamp)
Category:
HSSF API Status:
Open
Summary:
HSSFCellStyle - fillBackgroundColor
Hello,

the properties fillBackgroundColor and
fillForegroungColor of HSSFCellStyle are ignored
during the generation of the excel file.

Add A Comment:
Please log in!

If you cannot login, then enter your email address here:

DO NOT enter passwords or confidential information in your message!

Followups:

No Followups Have Been Posted
Attached Files:
Name Description Download
No Files Currently Attached
Changes:

No Changes Have Been Made to This Item
Comment 1 Mose IADAROLA 2002-03-05 16:29:47 UTC
Hello,

I noticed the following things:

I forgot to invoke the method setFillPattern((short)1) before invoking the 
method setFillForegroundColor(short color).

But in this last case too, I found confusing that it is the background which is 
set! The method setFillBackgroundColor(short color) seems to produce no effect!


Kind regards,
Mose





Comment 2 Glen Stampoultzis 2002-03-10 12:06:05 UTC
This is a little confusing but if you try one of the other fills you'll see 
whats happening.  I'm toying with the idea of automatically invoking the fill 
pattern if forecolor is selected.  Comments?  BTW, there are now constants for 
the various fill pattern available in CVS.
Comment 3 Andy Oliver 2002-03-10 14:32:19 UTC
See I agree its confusing but I think its a bug that should be resolved through
documentation/etc:

Fill patterns have foreground and background elements.

Fill solid = fill solidly with the foreground color.  Perhaps change the
constant to SOLID_FOREGROUND instead.  That would make it clearer I think.

thoughts?

-Andy
Comment 4 Glen Stampoultzis 2002-03-11 02:14:52 UTC
Changed according to Andy's suggestion.
Comment 5 Asier 2005-06-13 17:07:15 UTC
But if you want to fill solidly with the background color, and write something 
else with other color in the foreground, how do you do it?

Asier
Comment 6 Jason Height 2005-08-23 05:19:43 UTC
OK I think that this can be closed.

To answer the final query to write someting out in a different foreground color
use the HSSFFont color ie:

      HSSFCellStyle cs_amt = wb.createCellStyle();
      HSSFFont f = wb.createFont();                        
      f.setColor(new HSSFColor.BLUE().getIndex());      
      f.setFontHeightInPoints((short)10);
      f.setBoldweight(f.BOLDWEIGHT_BOLD);
      
      cs_amt.setFont(f);
      cs_amt.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND );
      cs_amt.setFillForegroundColor(new HSSFColor.RED().getIndex());

      r = s.createRow((short)1);
      c = r.createCell((short)1);
      c.setCellStyle(cs_amt);
      c.setCellValue("Test");