[gnumeric] xlsx: at least write one chart when there are multiple.



commit 0c19fdf51ac8b41da130e4bad4603e401ec38a0c
Author: Morten Welinder <terra gnome org>
Date:   Mon Jan 26 21:36:38 2015 -0500

    xlsx: at least write one chart when there are multiple.
    
    That's a bit better than dropping everything silently.  Need to
    investigate if xlsx can actually handle multiple.  If it can,
    it will be inside the plotArea tag.

 plugins/excel/xlsx-write-drawing.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/plugins/excel/xlsx-write-drawing.c b/plugins/excel/xlsx-write-drawing.c
index 82def5a..e539345 100644
--- a/plugins/excel/xlsx-write-drawing.c
+++ b/plugins/excel/xlsx-write-drawing.c
@@ -833,7 +833,6 @@ static void
 xlsx_write_chart (XLSXWriteState *state, GsfOutput *chart_part, SheetObject *so)
 {
        GogGraph const *graph;
-       GogObject const *chart;
        GsfXMLOut *xml;
 
        xml = gsf_xml_out_new (chart_part);
@@ -844,9 +843,16 @@ xlsx_write_chart (XLSXWriteState *state, GsfOutput *chart_part, SheetObject *so)
 
        graph = sheet_object_graph_get_gog (so);
        if (graph != NULL) {
-               chart = gog_object_get_child_by_name (GOG_OBJECT (graph), "Chart");
-               if (chart != NULL)
-                       xlsx_write_one_chart (state, xml, chart);
+               GogObjectRole const *role = gog_object_find_role_by_name (GOG_OBJECT (graph), "Chart");
+               GSList *charts = gog_object_get_children (GOG_OBJECT (graph), role);
+               if (charts != NULL) {
+                       GogObject const *chart1 = charts->data;
+                       xlsx_write_one_chart (state, xml, chart1);
+                       if (charts->next)
+                               g_warning ("Dropping %d charts on the floor!",
+                                          g_slist_length (charts));
+                       g_slist_free (charts);
+               }
        }
        gsf_xml_out_end_element (xml); /* </c:chartSpace> */
        g_object_unref (xml);


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