The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages - More
> ColdFusion Development
|
POI and display of numeric values
Discuss POI and display of numeric values in the ColdFusion Development forum on Dev Shed. POI and display of numeric values ColdFusion Development forum discussing CFML coding practices, tips on CFML, and other CFML related topics. Find out why ColdFusion is the tool of choice for many e-commerce developers.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

January 15th, 2013, 08:06 AM
|
|
Registered User
|
|
Join Date: Nov 2009
Posts: 8
Time spent in forums: 1 h 23 m 34 sec
Reputation Power: 0
|
|
|
POI and display of numeric values
hi,
i am trying to write a numeric value using POI and i get the strange results:
<poi:cell type="numeric" numberformat="##,####0.00" value="1075483609"/>
<cfset x=#NumberFormat('1075483609','999,999,999,999.99')#> <poi:cell type="string" value="#x#"/>
if you run the above you get 1,075,483,648.00 1,075,483,609.00 respectively  . notice that the last three digits are different, can someone explain this?
thanks
|

January 15th, 2013, 02:52 PM
|
|
Moderator
|
|
Join Date: Jun 2002
Location: Raleigh, NC
|
|
|
What if you remove the quotes: <cfset x=#NumberFormat(1075483609,'999,999,999,999.99')#> ?
|

January 16th, 2013, 01:07 AM
|
|
Registered User
|
|
Join Date: Nov 2009
Posts: 8
Time spent in forums: 1 h 23 m 34 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by kiteless What if you remove the quotes: <cfset x=#NumberFormat(1075483609,'999,999,999,999.99')#> ? |
the numberformat() function is giving the correct value, the problem is with the other statement
<poi:cell type="numeric" numberformat="##,####0.00" value="1075483609"/>
|

January 16th, 2013, 08:16 AM
|
|
Moderator
|
|
Join Date: Jun 2002
Location: Raleigh, NC
|
|
|
Ah, in that case I'm not sure. You may have to dig through the Apache POI docs since that's an external library. The only three things I can think of are: something is wrong with your format string, POI is doing something weird with the number because it is so large, or there's a bug in POI.
|

January 22nd, 2013, 11:19 PM
|
|
Contributing User
|
|
Join Date: May 2008
Posts: 117
Time spent in forums: 17 h 16 m 2 sec
Reputation Power: 6
|
|
Actually that is not pure POI. It looks like Ben Nadel's custom tag wrapper. I am not very familiar with it but had a brief look. The problem seems to involve this line.
Code:
<!--- Set numeric value. --->
<cfset VARIABLES.Cell.SetCellValue(
JavaCast( "float", THISTAG.GeneratedContent )
) />
It has something to do with casting the value as "float". If you cast it as a "double" instead of "float" you get the expected output "1,075,483,609.00".
I have no idea what effect that has on the rest of tag. So I would suggest searching his site to see if a similar issue was raised already, and if so what is the best work-around.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|