|
I had similar problems with setFillBackgroundColor(short arg) method - it hasn't worked anything... But I figured out that combination setFillForegroundColor(HSSFColor.ACQUA.index) and setFillPattern(HSSFCellStyle.SOLID_FOREGROUND) do what I wanted. It's not same but it looks similar - I was short with time so I made colored cells in documents with this peace of code. One more thing, I had another program that had to copy some rows from one xls to another. I had the same problem with HSSFCellStyle and Colors. Copy of xls finaly looked OK after I created a method for copying all CellStyle properties of source cell to destination cell. There are probably some more steps that have to be performed while setting background color but I don't no them:)) Best regards, Igor Bešlić, dipl. ing. rač. e-mail: Igor.Beslic@xxxxxxxxxxxx "Peter Dow" <maillist@xxxxxxxxxxxxxxx> Sent by: rpg400-l-bounces@xxxxxxxxxxxx 05.12.2004 19:40 Please respond to RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> To <RPG400-L@xxxxxxxxxxxx> cc Subject Using Java in RPGLE - setFillBackgroundColor 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 -- 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.
As an Amazon Associate we earn from qualifying purchases.
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.