Calc numbers are always string

Asked by daniel herrera on 2014-04-20

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:
2014-04-20
Last reply:
2014-06-23
Launchpad Janitor (janitor) said : #1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Hi Daniel,
I just tested again and Python float values are really converted into LibreOffice float cells. I've tested with the basic example shown on http://appyframework.org/pod.html. Could you please test with this example? Thank you, Gaetan

Check the tied bug.