[gnumeric] xlsx: fix export of rotated axis labels.



commit 8fd065c8fc4bc2b2637d8418772645ebd61bb761
Author: Morten Welinder <terra gnome org>
Date:   Fri Apr 24 11:33:36 2015 -0400

    xlsx: fix export of rotated axis labels.

 NEWS                               |    1 +
 plugins/excel/ChangeLog            |    5 +++++
 plugins/excel/xlsx-write-drawing.c |   15 +++++++++++++--
 3 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index 07bfcc0..06714bd 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Jean:
 Morten:
        * Fix import/export of graph backplane.
        * Fix export of unlabelled axes.
+       * Fix export of rotated axis labels.
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.22
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index a61aa75..55f60f2 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-24  Morten Welinder  <terra gnome org>
+
+       * xlsx-write-drawing.c (xlsx_write_go_style_full): Export
+       rotatation.
+
 2015-04-23  Morten Welinder  <terra gnome org>
 
        * xlsx-read.c: simplify parsing and fix attribute namespace
diff --git a/plugins/excel/xlsx-write-drawing.c b/plugins/excel/xlsx-write-drawing.c
index 9dd456d..99a9be5 100644
--- a/plugins/excel/xlsx-write-drawing.c
+++ b/plugins/excel/xlsx-write-drawing.c
@@ -320,6 +320,8 @@ xlsx_write_go_style_full (GsfXMLOut *xml, GOStyle *style, const XLSXStyleContext
        gboolean has_font_color = ((style->interesting_fields & GO_STYLE_FONT) &&
                                   !style->font.auto_color);
        gboolean has_font = xlsx_go_style_has_font (style);
+       gboolean has_layout_angle = ((style->interesting_fields & GO_STYLE_TEXT_LAYOUT) &&
+                                    !style->text_layout.auto_angle);
        gboolean ext_fill_pattern = FALSE;
        gboolean ext_fill_auto_pattern = FALSE;
        gboolean ext_fill_auto_back = FALSE;
@@ -605,9 +607,18 @@ xlsx_write_go_style_full (GsfXMLOut *xml, GOStyle *style, const XLSXStyleContext
        gsf_xml_out_end_element (xml);  /* "NS:spPr" */
        g_free (spPr_tag);
 
-       if (has_font_color || has_font) {
+       if (has_font_color || has_font || has_layout_angle) {
                gsf_xml_out_start_element (xml, "c:txPr");
-               gsf_xml_out_simple_element (xml, "a:bodyPr", NULL);
+
+               gsf_xml_out_start_element (xml, "a:bodyPr");
+               if (has_layout_angle) {
+                       double angle = fmod (360 - style->text_layout.angle, 360.0);
+                       if (angle <= -180) angle += 360;
+                       if (angle > 180) angle -= 360;
+                       gsf_xml_out_add_int (xml, "rot", (int)(angle * 60000));
+               }
+               gsf_xml_out_end_element (xml);  /* "a:bodyPr" */
+
                gsf_xml_out_simple_element (xml, "a:lstStyle", NULL);
                gsf_xml_out_start_element (xml, "a:p");
                gsf_xml_out_start_element (xml, "a:pPr");


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