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



Create a 3rd cell style named CurrBlue, and set both the data format _and_ the fill pattern/color in it.

Assuming this code occurs after you've already looked up the value for NumFmt4, it'd simply be:

CurrBlue = HSSFWorkbook_createCellStyle(book);
HSSFCellStyle_setDataFormat(CurrBlue: NumFmt4);
HSSFCellStyle_setAlignment(CurrBlue: ALIGN_RIGHT);
HSSFCellStyle_setFillForegroundColor( CurrBlue
: HSSFColor_BLUE);
HSSFCellStyle_setFillPattern(CurrBlue: SOLID_FOREGROUND);




On 12/14/2011 2:57 PM, Terry Anderson wrote:
List,
I have two formats defined in my program. One sets the cell style for
currency, and the other sets the background color. They are listed
below.

Currency = HSSFWorkbook_createCellStyle(book);
DataFmt = HSSFWorkbook_createDataFormat(book);
TempStr = new_String('$#,##0.00_);[Red]($#,##0.00)');
NumFmt4 = HSSFDataFormat_getFormat(DataFmt: TempStr);
HSSFCellStyle_setDataFormat(Currency: NumFmt4);
HSSFCellStyle_setAlignment(Currency: ALIGN_RIGHT);


BG_BLUE = HSSFWorkbook_createCellStyle(book);
HSSFCellStyle_setFillForegroundColor( BG_BLUE
: HSSFColor_BLUE);
HSSFCellStyle_setFillPattern(style: SOLID_FOREGROUND);


Can anyone explain how can I combine the two so that the cell shows
$1,234.56 and is highlighted in blue?


Thanks,


Terry Anderson
Programming Manager
Grede LLC.
Switchboard 1.251.867.5481 ext 212
Direct Line 1.251.809.2312
Fax 251.867.0525
Cell 1.251.363.4975



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