GNOME Bugzilla – Bug 778618
charts exported to xlsx loose series names
Last modified: 2017-02-18 12:30:06 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!
Well, the patch is not correct. Can you provide a sample xslx file created with excel, and with at least one named series?
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>
(My gnumeric complains about a tx1 colour on load. That's unrelated.)
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.
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.
LOCalc does not import it correctly either. Weird.
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>
My bad, sorry for the noise.
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
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.
Created attachment 345859 [details] Sample with manually positioned legend To get this in Excel, one drags the legend to the desired position.
The position now roundtrips, at least in this case. Until now, we did not export any manual position to either xlsx or even xls.
Are we done here?
I suppose, even if not perfectly. At least, the original issue is fixed.