Re: Controlling gnumeric from Python



Ok, here is another question.

I gave up on idea of calling gnumeric from outside python process, as
this seems to be unsupported. However, new gnumeric (1.4.1 on Ubuntu,
for example) has python console.

So I enter 1 in cell A1, 2 in B1, =A1+B1 in C1
Obviously, 3 shows up in C1.

I write the following little program (testg.py):


import Gnumeric

def tst(n1,n2):
    wb=Gnumeric.workbooks()[0]
    s=wb.sheets()[0]
    c1=s[0,0]
    c2=s[1,0]

    c1.set_text(str(n1))
    c2.set_text(str(n2))

    c3=s[2,0]
    return c3.get_value()


and in Gnumeric python console:
import testg
testg.tst(6,8)

After this A1 contains 6, B1 -- 8, but C1 still shows 3, not 14 until
I hit F9 (recalculate).

Question: How do I call "recalculate" function from built-in Python?

If this is impossible --- why?

Thanks!


John, is anyone working on this interface? Is it going to be available
anytime soon? If in few years --- this is too long for me....


On Thu, 06 Jan 2005 12:07:19 +0000, John Gill
<jng earthenware-services org> wrote:
 

 Longer term, I think the way to go is to have some python bindings to
Jody's libgnumeric.
 
 John




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]