Re: automatic or scripted export of graphics from gnumeric



Le vendredi 13 janvier 2017 à 06:37 -0700, John Denker a écrit :
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/msg0000
1.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'

You might have a too old GObject Introspection version, try without
this line.

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'

Weird.


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.

A good start.

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

You must get the list of graphs using Sheet::objects_get()

-- 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?

May be C might be easier, not sure.

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

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.

There is no identifier for graphs or any other object for now. May be
in next major version.

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

_______________________________________________
gnumeric-list mailing list
gnumeric-list gnome org
https://mail.gnome.org/mailman/listinfo/gnumeric-list



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