[gnumeric] More xlsx fixes.
- From: Jean Bréfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] More xlsx fixes.
- Date: Wed, 15 Feb 2017 17:12:48 +0000 (UTC)
commit 0b6586d3c9d2e260adbc565f98c4727fc03e0297
Author: Jean Brefort <jean brefort normalesup org>
Date: Wed Feb 15 18:12:21 2017 +0100
More xlsx fixes.
plugins/excel/ChangeLog | 6 ++++++
plugins/excel/xlsx-read-drawing.c | 17 ++++++++++++++++-
plugins/excel/xlsx-write-drawing.c | 30 ++++++++++++++++++++++++++++++
3 files changed, 52 insertions(+), 1 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 6dc5450..64a9517 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,5 +1,11 @@
2017-02-15 Jean Brefort <jean brefort normalesup org>
+ * xlsx-read-drawing.c (xlsx_chart_text), (xlsx_text_value),
+ (xlsx_body_pr): read text value.
+ * xlsx-write-drawing.c (xlsx_write_one_chart): export legend position.
+
+2017-02-15 Jean Brefort <jean brefort normalesup org>
+
* xlsx-write-drawing.c (xlsx_write_series_dim): Fix xlsx export of chart
series names. [#778618]
diff --git a/plugins/excel/xlsx-read-drawing.c b/plugins/excel/xlsx-read-drawing.c
index 39dcb47..955e0b1 100644
--- a/plugins/excel/xlsx-read-drawing.c
+++ b/plugins/excel/xlsx-read-drawing.c
@@ -169,6 +169,12 @@ xlsx_chart_text (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
if (!state->inhibit_text_pop)
xlsx_chart_pop_obj (state);
}
+ } else if (state->chart_tx != NULL) {
+ /* set the series title */
+ gog_series_set_dim (state->series, -1,
+ gnm_go_data_scalar_new_expr (state->sheet,
+ gnm_expr_top_new_constant (
+ value_new_string (state->chart_tx))), NULL);
}
g_free (state->chart_tx);
state->chart_tx = NULL;
@@ -176,6 +182,14 @@ xlsx_chart_text (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
}
static void
+xlsx_text_value (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
+{
+ XLSXReadState *state = (XLSXReadState *)xin->user_state;
+ g_return_if_fail (state->chart_tx == NULL);
+ state->chart_tx = g_strdup (xin->content->str);
+}
+
+static void
xlsx_chart_title_start (GsfXMLIn *xin, xmlChar const **attrs)
{
XLSXReadState *state = (XLSXReadState *)xin->user_state;
@@ -316,7 +330,7 @@ xlsx_body_pr (GsfXMLIn *xin, xmlChar const **attrs)
{ NULL, 0 }
};
- if (GO_IS_STYLED_OBJECT (state->cur_obj) && state->cur_style) {
+ if (GO_IS_STYLED_OBJECT (state->cur_obj) && state->cur_style && !GOG_IS_LEGEND (state->cur_obj)) {
for (; attrs && *attrs; attrs += 2) {
int val;
@@ -2486,6 +2500,7 @@ GSF_XML_IN_NODE_FULL (START, CHART_SPACE, XL_NS_CHART, "chartSpace", GSF_XML_NO_
GSF_XML_IN_NODE_FULL (MAN_LAYOUT, MAN_LAYOUT_YMODE, XL_NS_CHART, "yMode", GSF_XML_NO_CONTENT,
FALSE, TRUE, &xlsx_chart_layout_mode, NULL, 2),
GSF_XML_IN_NODE (TITLE, SHAPE_PR, XL_NS_CHART, "spPr", GSF_XML_2ND, NULL, NULL),
GSF_XML_IN_NODE (TITLE, TEXT, XL_NS_CHART, "tx", GSF_XML_NO_CONTENT, &xlsx_chart_text_start,
&xlsx_chart_text),
+ GSF_XML_IN_NODE (TEXT, TEXT_VALUE, XL_NS_CHART, "v", GSF_XML_CONTENT, NULL, &xlsx_text_value),
GSF_XML_IN_NODE (TEXT, TX_RICH, XL_NS_CHART, "rich", GSF_XML_NO_CONTENT, NULL, NULL),
GSF_XML_IN_NODE (TX_RICH, TX_RICH_BODY, XL_NS_CHART, "bodyP", GSF_XML_NO_CONTENT, NULL, NULL),
GSF_XML_IN_NODE (TX_RICH, TEXT_PR_BODY, XL_NS_DRAW, "bodyPr", GSF_XML_NO_CONTENT, NULL, NULL),
diff --git a/plugins/excel/xlsx-write-drawing.c b/plugins/excel/xlsx-write-drawing.c
index 43f37bc..24bdd5d 100644
--- a/plugins/excel/xlsx-write-drawing.c
+++ b/plugins/excel/xlsx-write-drawing.c
@@ -1257,7 +1257,37 @@ xlsx_write_one_chart (XLSXWriteState *state, GsfXMLOut *xml, GogObject const *ch
gsf_xml_out_end_element (xml); /* </c:plotArea> */
if ((obj = gog_object_get_child_by_name (chart, "Legend"))) {
+ char const *str;
+ unsigned pos = gog_object_get_position_flags (obj, GOG_POSITION_COMPASS);
gsf_xml_out_start_element (xml, "c:legend");
+ switch (pos) {
+ case GOG_POSITION_N:
+ str = "t";
+ break;
+ case GOG_POSITION_S:
+ str = "b";
+ break;
+ case GOG_POSITION_W:
+ str = "l";
+ break;
+ case GOG_POSITION_E:
+ default:
+ str = "r";
+ break;
+ case GOG_POSITION_N | GOG_POSITION_E:
+ str = "tr";
+ break;
+ case GOG_POSITION_N | GOG_POSITION_W:
+ str = "tl";
+ break;
+ case GOG_POSITION_S | GOG_POSITION_E:
+ str = "br";
+ break;
+ case GOG_POSITION_S | GOG_POSITION_W:
+ str = "bl";
+ break;
+ }
+ xlsx_write_chart_cstr_unchecked (xml, "c:legendPos", str);
gsf_xml_out_end_element (xml); /* </c:legend> */
}
gsf_xml_out_end_element (xml); /* </c:chart> */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]