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



Thanks for the help. I used this format.

new_String('#,##0_);[Red]-#,##0');

It gives the red and negative sign like the manual sheet they created. I can live without bold for now.

This has been really helpful. I tend to lock things in compartments, number formats apply to numbers. This a formula. Without thinking it is eventually displaying a number.

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Darren Strong
Sent: Friday, July 08, 2016 11:12 AM
To: RPG programming on the IBM i (AS/400 and iSeries) <rpg400-l@xxxxxxxxxxxx>
Subject: RE: hssf poi conditional formatting.

Well, a formula cell needs to have a format too, just like a numeric. I've pasted the entire definition code to give it more context. I am using some format arrays which you don't need, so your RegCur(idx1) would be just RegCur = ...

RegCur(idx1) = SSWorkbook_createCellStyle(book);

DataFmt = SSWorkbook_createDataFormat(book);

TempStr = new_String(

'$#,##0_);[Red]($#,##0)');

NumFmt = SSDataFormat_getFormat(DataFmt: TempStr);

SSCellStyle_setDataFormat(RegCur(idx1): NumFmt);

SSCellStyle_setFont(RegCur(idx1): RegFont);

SSCellStyle_setAlignment(RegCur(idx1): ALIGN_RIGHT);

callp $SetAllBorder(RegCur(idx1):BORDER_THIN);

hssf_freeLocalRef(TempStr);

hssf_freeLocalRef(DataFmt);




Now, the formula would call would look like this, again, the array reference is something you wouldn't necessarily need:

ss_formula(Row:CurCol : 'SUM('

+$col(CurCol:TopRow) + ':'

+$col(CurCol:RowCount-1) + ')'

:RegCur(ci1));


___________________________________
Darren Strong
Dekko





From: "Roche, Bob" <broche@xxxxxxxxxxxxxxxxx>
To: "RPG programming on the IBM i (AS/400 and iSeries)"
<rpg400-l@xxxxxxxxxxxx>
Date: 07/08/2016 11:54 AM
Subject: RE: hssf poi conditional formatting.
Sent by: "RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxx>



Let me see if I can wrap my head around posting that format to a formula cell. Maybe it's just me. I read that as being used in a numeric cell, and I am creating a formula cell.

My cell contains for example
SS_FORMULA(ROW: 2: CFORMULA: COMMTOTAL).
Where CFORMULA is "(A2-A3)".
And COMMTOTAL is a predefined cell style.
A2 and A3 are numeric cells and I just need the difference positive or negative.

I do have a sample of using data format to add a % to some cells, let me add yours to my cell see what happens. Red would be enough for them I think.

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Darren Strong
Sent: Friday, July 08, 2016 6:45 AM
To: RPG programming on the IBM i (AS/400 and iSeries) <rpg400-l@xxxxxxxxxxxx>
Subject: Re: hssf poi conditional formatting.

I have a sheet with calculations. If the value is negative make it red
and bold. Sounds easy I thought.

I've done plenty of wheel inventing, but I haven't ventured into straight on conditional formatting. You can get red when negative formatting with a edit word, but I don't think bold.


TempStr = new_String('#,##0_);[Red](#,##0)');

NumFmt = SSDataFormat_getFormat(DataFmt: TempStr);


--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.midrange.com_mailman_listinfo_rpg400-2Dl&d=CwICAg&c=S6jE3hMA0s16gx2_CUBBn4vjc1odLunI6MSvd_AfdV8&r=Ub_YbVSedaHB7-0yGANN94iTrfkU2nCKT1D5-5Jv01Y&m=ftzip4D5mNY74L2K61LNZKSyw41KVleEuBJgtY37Bdg&s=nj7uzsSlRdOcD08arCMC-05m1CXdE2ih89tb2gMkM2k&e=

or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://urldefense.proofpoint.com/v2/url?u=http-3A__archive.midrange.com_rpg400-2Dl&d=CwICAg&c=S6jE3hMA0s16gx2_CUBBn4vjc1odLunI6MSvd_AfdV8&r=Ub_YbVSedaHB7-0yGANN94iTrfkU2nCKT1D5-5Jv01Y&m=ftzip4D5mNY74L2K61LNZKSyw41KVleEuBJgtY37Bdg&s=OBsB-3zHe-ALfqINbIgs2wMcbJ2npXdJBc-aM939vS8&e=
.

Please contact support@xxxxxxxxxxxx for any subscription related questions.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.midrange.com_mailman_listinfo_rpg400-2Dl&d=CwICAg&c=S6jE3hMA0s16gx2_CUBBn4vjc1odLunI6MSvd_AfdV8&r=Ub_YbVSedaHB7-0yGANN94iTrfkU2nCKT1D5-5Jv01Y&m=3XQh479BmPDyp8TYhHDf-qveYUHlrdcOYJ-ZAfySXfU&s=z-uzkEHbGmZEk08ZjQT3IhO4fRUw6VL1tMlVelrlt5M&e=
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://urldefense.proofpoint.com/v2/url?u=http-3A__archive.midrange.com_rpg400-2Dl&d=CwICAg&c=S6jE3hMA0s16gx2_CUBBn4vjc1odLunI6MSvd_AfdV8&r=Ub_YbVSedaHB7-0yGANN94iTrfkU2nCKT1D5-5Jv01Y&m=3XQh479BmPDyp8TYhHDf-qveYUHlrdcOYJ-ZAfySXfU&s=0WnJ87RXQL-xxNFCB8-PFIDcNVF1ZBXlJAEkspCBym0&e= .

Please contact support@xxxxxxxxxxxx for any subscription related questions.



--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.midrange.com_mailman_listinfo_rpg400-2Dl&d=CwICAg&c=S6jE3hMA0s16gx2_CUBBn4vjc1odLunI6MSvd_AfdV8&r=Ub_YbVSedaHB7-0yGANN94iTrfkU2nCKT1D5-5Jv01Y&m=3XQh479BmPDyp8TYhHDf-qveYUHlrdcOYJ-ZAfySXfU&s=z-uzkEHbGmZEk08ZjQT3IhO4fRUw6VL1tMlVelrlt5M&e=
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://urldefense.proofpoint.com/v2/url?u=http-3A__archive.midrange.com_rpg400-2Dl&d=CwICAg&c=S6jE3hMA0s16gx2_CUBBn4vjc1odLunI6MSvd_AfdV8&r=Ub_YbVSedaHB7-0yGANN94iTrfkU2nCKT1D5-5Jv01Y&m=3XQh479BmPDyp8TYhHDf-qveYUHlrdcOYJ-ZAfySXfU&s=0WnJ87RXQL-xxNFCB8-PFIDcNVF1ZBXlJAEkspCBym0&e= .

Please contact support@xxxxxxxxxxxx for any subscription related questions.

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.