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



Hi All,

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.  No problem I thought, I'll just go to the Jakarta POI HSSF
website (http://jakarta.apache.org/poi/hssf/index.html) and figure it out.
There's a sample in Java:

Fills and colors
    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet sheet = wb.createSheet("new sheet");

    // Create a row and put some cells in it. Rows are 0 based.
    HSSFRow row = sheet.createRow((short) 1);

    // Aqua background
    HSSFCellStyle style = wb.createCellStyle();
    style.setFillBackgroundColor(HSSFColor.AQUA.index);
    style.setFillPattern(HSSFCellStyle.BIG_SPOTS);
    HSSFCell cell = row.createCell((short) 1);
    cell.setCellValue("X");
    cell.setCellStyle(style);

After looking at the Java definition for setFillbackgroundColor

java.lang.Object
  org.apache.poi.hssf.usermodel.HSSFCellStyle

Method:
 void setFillBackgroundColor(short bg)
          set the background fill color.

I added a prototype for setFillBackgroundColor to Scott's HSSF_H source
member:

D HSSFCellStyle_setFillBackgroundColor...
D                 PR                  EXTPROC(*JAVA
D                                     :'org.apache.poi.hssf.usermodel-
D                                     .HSSFCellStyle'
D                                     :'setFillBackgroundColor')
D   color                        5I 0 value

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?

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


---
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/2/2004



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.