×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Hi Scott,

Thanks once again!  The original article by you was also iSeriesNetwork, and
it had a link to your service program and prototypes, but the prototypes did
not have the setFillBackgroundColor or setFillForegroundColor.  I actually
did think about it setting the color of the pattern because the Jakarta
POI/HSSF website talked about setting the fillforeground, not the font
color, but I didn't see anything that would let me set the pattern to a
solid, so I figured I was on the wrong track.  I'll check out your article
on fills & colors.

Peter Dow
Dow Software Services, Inc.
909 793-9050 voice
909 793-4480 fax
951 522-3214 cell

----- Original Message ----- 
From: "Scott Klement" <rpg400-l@xxxxxxxxxxxxxxxx>
To: "RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx>
Sent: Sunday, December 05, 2004 11:55 PM
Subject: Re: Using Java in RPGLE - setFillBackgroundColor


>
> > I'm creating a spreadsheet from an RPGLE program, using Scott Klement's
> > service program and prototypes (thanks Scott!) and discovered the only
color
> > stuff provided is for setting the color of the font, and only the color
red
> > or automatic.
>
> I wrote an article on this subject calld "HSSF Fills and Colors". Is that
> the article that you're referring to?
>
> In that article, it demonstrates aqua, orange, black and white.  All of
> those colors can be used for anything (including the font color or the
> background color, etc.)  They're just indexes into the default color
> palette -- just integers, nothing special.
>
> I know what you mean about red being the only color they've got defined in
> the class for font color -- but you can use the other colors as well.  I
> tested it with some of them, they work fine.
>
> Anyway, make sure you check out my article on fills and colors from the
> Oct 28th newsletter.  You can read it at the following link (requires a
> membership to the iSeries Network, but a free associate membership should
> work.)
>
> http://www.iseriesnetwork.com/article.cfm?ID=19610
>
>
> > D HSSFCellStyle_setFillBackgroundColor...
> > D                 PR                  EXTPROC(*JAVA
> > D                                     :'org.apache.poi.hssf.usermodel-
> > D                                     .HSSFCellStyle'
> > D                                     :'setFillBackgroundColor')
> > D   color                        5I 0 value
>
> The article that I point to above already has a definition for this, and
> the other things you need.
>
> > I'm not sure what the "bg" means in (short bg), but the above compiled
just
> > fine.  I then use it to set the background color of a cell style:
> >
> > HSSFCellStyle_setFillBackgroundColor(ColHeading: COLOR_RED);
> >
> > and apply the cell style to a cell:
> >
> > hssf_text( row: 0 : 'Description': ColHeading);
> >
> > however, the resulting spreadsheet has all the other attributes of
> > ColHeading (bold, border, font color, etc) but not the background color.
> >
> > What am I missing?
> >
>
> I explain this in the above article... but the basic mistake that you're
> making is that you're thinking that the background color sets the
> background of the cell.  And, well, it sort of does, but not really.
>
> The background of the cell is represented by what's call a "fill".  The
> foreground is represented by what's known as a "font".  To set the way the
> background is displayed, you modify the fill.  To set the way the text is
> displayed, you modify the font.
>
> The setFillBackgroundColor() method doesn't set the background of the
> cell  It sets the background of the FILL.  Likewise, the
> setFillForegroundColor doesn't set the foreground of the cell -- it sets
> the foreground of the fill.  (Clear as mud?)
>
> A fill also has a pattern.  So, if you wanted a polka dotted background to
> your cell, you could set the fill pattern to be dots.  The foreground
> color of the fill would be the color of the dots.  The background color
> would be the color of the area surrounding the dots.
>
> The default pattern is "solid."  In that case, the background color of the
> fill isn't visible, since the pattern is one solid color -- the foreground
> color.  Since your code doesn't set the pattern, the background color that
> you're setting is not visible.  You probably wanted to set the fill's
> foreground color instead.
>
> Anyway, this is explained in the article above, and it includes sample
> code.
>
> --
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
> To post a message email: RPG400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: RPG400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.802 / Virus Database: 545 - Release Date: 12/3/2004



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.