× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



> 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.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

This mailing list archive is Copyright 1997-2024 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.