Re: automatic or scripted export of graphics from gnumeric



On 01/13/2017 02:38 AM, Jean Brefort wrote:

There is currently no script or program doing that but I suppose it
would be not so hard to implement either in C or using a scripting
language and introspection. Probably a few hours or work, depending of
the wanted options.


I spent a couple hours already looking into this.  The closest I
could come to a working model using a scripting language was this:
  https://mail.gnome.org/archives/gnumeric-list/2015-November/msg00001.html

which doesn't actually work.  When I try it using python (aka
python2.7) I observe:

Traceback (most recent call last):
  File "./gnumeric-introspection", line 4, in <module>
    gi.require_version('GOffice','0.10')
AttributeError: 'module' object has no attribute 'require_version'

or using python3 (aka python3.5) it doesn't even get that far.
I observe:

Traceback (most recent call last):
  File "./gnumeric-introspection", line 3, in <module>
    import gi
  File "/usr/local/lib/python3.5/dist-packages/gi/__init__.py", line 39
    print url
            ^
SyntaxError: Missing parentheses in call to 'print'



Also, the closest I could come to useful documentation was this:
  https://lazka.github.io/pgi-docs/Gnm-1.12/classes.html
  https://lazka.github.io/pgi-docs/Gnm-1.12/classes/Workbook.html
  etc.

which AFAICT makes no mention of saving a graph, or even inspecting
the structures within a graph.

-- Are there any working examples of gnumeric introspection that
   could be used as a model?
-- Where should one look for documentation?
-- Or would it be better to give up on introspection and just write
   in C, using ssconvert.c as a model?


=======================

Also, given a workbook with multiple sheets and multiple graphs per
sheet, what is the proper way to identify a particular graph?  In
.svg format, the objects have id="whatever" attributes, but AFAICT
in .gnumeric format they don't.

I suppose one could add a title to each graph, using a zero-point
font, and use that for identification.  Is there a better way?

This may be related to the code in ssconvert.c where it says:
* HACK: (bug 694408).
*
* We don't have a good way of specifying the
* sheet.
  https://bugzilla.gnome.org/show_bug.cgi?id=694408



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