[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: Casting rules in kspread
From: Brad Hards <bhards () bigpond ! net ! au>
Date: 2004-07-21 12:18:26
Message-ID: 200407212218.27830.bhards () bigpond ! net ! au
[Download RAW message or body]
I'm looking at a problem with kspread's TEXT() function.
=text(1.234) produces "True", instead of "1.234"
If I'm getting this correctly, kspread_functions_text.cc has a
kspreadfunc_text() function, that makes a text string based
on the variable type.
I've got the problem "worked around", with the following patch:
RCS file: /home/kde/koffice/kspread/kspread_functions_text.cc,v
retrieving revision 1.24
diff -u -4 -p -r1.24 kspread_functions_text.cc
--- kspread_functions_text.cc 13 May 2004 16:32:13 -0000 1.24
+++ kspread_functions_text.cc 21 Jul 2004 12:15:55 -0000
@@ -872,11 +872,8 @@ bool kspreadfunc_text( KSContext& contex
if( KSUtil::checkType( context, args[0], KSValue::StringType, false ) )
result = args[0]->stringValue();
- else if( KSUtil::checkType( context, args[0], KSValue::BoolType, false ) )
- result = args[0]->boolValue() ? i18n("True") : i18n("False");
-
else if( KSUtil::checkType( context, args[0], KSValue::DoubleType, false ) )
result = KGlobal::locale()->formatNumber( args[0]->doubleValue() );
else if( KSUtil::checkType( context, args[0], KSValue::TimeType, false ) )
@@ -887,8 +884,11 @@ bool kspreadfunc_text( KSContext& contex
else if( KSUtil::checkType( context, args[0], KSValue::IntType, false ) )
result = KGlobal::locale()->formatNumber( args[0]->intValue() );
+ else if( KSUtil::checkType( context, args[0], KSValue::BoolType, false ) )
+ result = args[0]->boolValue() ? i18n("True") : i18n("False");
+
context.setValue( new KSValue( result ));
return true;
}
libs/koscript/ has a couple of functions that do the casting. I'm
just a bit confused about how kspread decides when the
contents are integer, and when it is a bool. Can anyone
give me a hint as to how it is supposed to work?
Brad
_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic