Calc numbers are always string
Reading your documentation I noticed than:
Within ODS templates, a Python expression that produces a Python int, long or float will be rendered as a float value within the resulting spreadsheet.
But, I'm not able to get float numbers, rendered numbers are all time strings, with a quote before the number.
Sample: I write [="float(1)"] in a cell and I get ['1.0] ( brackets to indicate this is a cell )
I have tested with LibreOffice 3.5.
( Appy 0.8.5 )
============
My workaround:
Because I work with 2 decimals, I have a helper class than multiplies the number by 100:
class my_appyhelper:
def x100( self, n ):
try:
return int( float( n ) * 100 )
except:
return None
lets suppose than context contains: { 'h': my_appyhelper(), 'some_value' = Decimal( 1232.234 ) }
In excel I write in, for example, G3 cell: [ ="h.x100( some_value ) "]
And then I apply a formula: [=value( G3/100 ) ] or [=if( G3 = ""; ""; value( G3/100 ) ]
============
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Appy Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply: