After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 778618 - charts exported to xlsx loose series names
charts exported to xlsx loose series names
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: import/export MS Excel (tm)
1.12.x
Other Linux
: Normal normal
: ---
Assigned To: Jody Goldberg
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2017-02-14 18:12 UTC by Duane Voth
Modified: 2017-02-18 12:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Sample xlsx file (13.37 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2017-02-14 19:31 UTC, Morten Welinder
Details
Sample with manually positioned legend (13.46 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2017-02-15 17:40 UTC, Morten Welinder
Details

Description Duane Voth 2017-02-14 18:12:22 UTC
- run $ gnumeric samples/chart-tests.gnumeric
- save-as any Excel formated xlsx file   
- load with Excel

Currently (1.12.32) you will see that many but not all of the series names in the chart legends have lost their original name and been reset to the default value 'Series N'.

The following is a very sloppy and poorly tested patch that at least documents how to tell Excel the series names...

--- plugins/excel/xlsx-write-drawing.c.00       2017-02-13 16:29:23.112734854 -0600
+++ plugins/excel/xlsx-write-drawing.c  2017-02-13 20:25:59.987408970 -0600
@@ -90,6 +90,13 @@
        int dim;
        GOData const *dat;
 
+        if (strcmp(name, "c:tx") == 0  &&  series->base.base.user_name) {
+                //g_printerr ("+++ %s\n", series->base.base.user_name);
+                gsf_xml_out_start_element (xml, "c:tx");
+                gsf_xml_out_simple_element (xml, "c:v", series->base.base.user_name);
+                gsf_xml_out_end_element (xml); // c:tx
+        }
+
        for (dim = 0; dim < (int) desc->num_dim; dim++)
                if (desc->dim[dim].ms_type == ms_type)
                        break;


So why am I exporting to Excel?  Cause its far easier to create the charts in Gnumeric, but everyone still wants xlsx formated sheets.  :/   Great work all!
Comment 1 Jean Bréfort 2017-02-14 19:22:25 UTC
Well, the patch is not correct. Can you provide a sample xslx file created with excel, and with at least one named series?
Comment 2 Morten Welinder 2017-02-14 19:31:38 UTC
Created attachment 345752 [details]
Sample xlsx file

In xl/charts/chart1.xml, search for Oink:

      <c:pieChart>
        <c:varyColors val="1"/>
        <c:ser>
          <c:idx val="0"/>
          <c:order val="0"/>
          <c:tx>
            <c:v>Oink</c:v>
          </c:tx>
Comment 3 Morten Welinder 2017-02-14 19:32:42 UTC
(My gnumeric complains about a tx1 colour on load.  That's unrelated.)
Comment 4 Jean Bréfort 2017-02-15 07:40:12 UTC
This problem has been fixed in our software repository. The fix will go into the next software release. Once that release is available, you may want to check for a software upgrade provided by your Linux distribution.
Comment 5 Morten Welinder 2017-02-15 12:33:29 UTC
I can confirm that with this change, Excel does import the series name.

However, note the sample file attached.  This was created with Excel from
scratch and we do not import the name at all.
Comment 6 Jean Bréfort 2017-02-15 13:26:38 UTC
LOCalc does not import it correctly either. Weird.
Comment 7 Jean Bréfort 2017-02-15 13:35:48 UTC
Hmm, that file seems to have been saved from gnumeric, not excel and contains nodes like:
<a:extLst>
  <a:ext uri="http://www.gnumeric.org/ext/spreadsheetml">
    <gnmx:gostyle dashType="auto" pattern="solid" auto-pattern="0"/>
  </a:ext>
</a:extLst>
Comment 8 Jean Bréfort 2017-02-15 13:44:52 UTC
My bad, sorry for the noise.
Comment 9 Morten Welinder 2017-02-15 16:40:44 UTC
If I read http://www.datypic.com/sc/ooxml/e-draw-chart_tx-4.html correctly,
then there is a choice between strRef and v.  At least for simple strings.


Gnumeric: write strRef; read strRef
Excel: write v; read either

As a guess:
LO: write v, read v
Comment 10 Jean Bréfort 2017-02-15 17:16:22 UTC
OK, we now read v too.
I also added legendPos writing. But it will not work with manual positions. Does XL allows a manual position for the legend? If so, a sample would be welcome.
Comment 11 Morten Welinder 2017-02-15 17:40:45 UTC
Created attachment 345859 [details]
Sample with manually positioned legend

To get this in Excel, one drags the legend to the desired position.
Comment 12 Jean Bréfort 2017-02-16 07:01:15 UTC
The position now roundtrips, at least in this case. Until now, we did not export any manual position to either xlsx or even xls.
Comment 13 Morten Welinder 2017-02-18 03:02:00 UTC
Are we done here?
Comment 14 Jean Bréfort 2017-02-18 07:09:37 UTC
I suppose, even if not perfectly. At least, the original issue is fixed.
Comment 15 Morten Welinder 2017-02-18 12:30:06 UTC
This problem has been fixed in our software repository. The fix will go into the next software release. Once that release is available, you may want to check for a software upgrade provided by your Linux distribution.