Re: how to convert VB scripts to Gnumeric python

I think with the changes made to function definitions from the patch you've incorporated into workbook-view.c file I/O should be functional, since they're the identical to a known
functional code on my end.

The blessed API call list will be quite helpful! It'll be nice to know where not to poke Gnumeric.

I'm looking forward to trying out the copy/paste, particularly if it functions across workbooks.

At this point I think I think it's more appropriate for me to pull Morten's latest changes and do any work against that, and anyone that wants to develop in Python against gnumeric should do the same. I'll work on getting an example done today but the pull and build may slow me down a bit. Morten's example will render a lot of this moot, but I think a practical sample is probably still useful to some.

Thanks for all your work on this, Morten! Not having to maintain my own copy of Gnumeric plus getting all these features functional without workarounds is going to make life a _lot_ easier for me (and everyone else!)

Since your test program is already well ahead of my sample, here's the core file open and save routines from my application for inspiration, some of which I already pasted. You probably know this better than I:


    s_wbv=Gnm.WorkbookView.new_from_uri(s_uri, None, io, None)
    s_wb = Gnm.wb_view_get_workbook(s_wbv)

for file save (reuses the cc from above):

    # Save as new file


Of course you need to do a "from gi.repository import GOffice" and in my application I import GLib as well, but I haven't tested to see if that's strictly necessary for just file I/O. I don't believe the plugins_init above is strictly necessary either, but it was for my application.

On 04/13/2018 11:17 AM, Morten Welinder wrote:
Major progress on my end. I found two major sources of crashes (1: many of our boxed types were bad; 2: some pygobject versions fail on transfer-full arguments).

You can follow the battle at
although that file may move.  This file also contains the "blessed" API.
This is still evolving.

My main test script is at It does pretty much everything one can do to a workbook other than file i/o.
(That's somewhere on my list.)

Note: I have marked lots of functions as "skip" because they are low-level functions not intended for scripting. Most of GnmCell's methods are like that. They don't do what you would expect of them and there are proper alternatives, typically in Sheet.Â


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