[gnumeric] xlsx: fix export of rotated styles.



commit 7f7915a9c514897b809d5475715a2d0c09fcd144
Author: Morten Welinder <terra gnome org>
Date:   Mon Feb 24 13:05:20 2014 -0500

    xlsx: fix export of rotated styles.
    
    The value used in xlsx is weird:
    0-90 is the normal thing
    91-180 really means 90-that
    255 is the special vertically-stacked value

 NEWS                       |    1 +
 plugins/excel/ChangeLog    |    2 ++
 plugins/excel/xlsx-write.c |    7 ++++++-
 3 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index 1a67dae..6fc328d 100644
--- a/NEWS
+++ b/NEWS
@@ -33,6 +33,7 @@ Morten:
        * Fix xls export of headers and footers.  [Part of #724516]
        * Fix xls import of headers and footers.  [Part of #724516]
        * Fix xlsx export of row heights.
+       * Fix xlsx export of rotated styles.
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.11
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 0f299aa..3b95ec0 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -2,6 +2,8 @@
 
        * xlsx-write.c (xlsx_write_cells): Export row height when it is
        not default, even if it is not user-set.
+       (xlsx_write_style_write_alignment): Fix rotation export for
+       downward angles.
 
 2014-02-23  Morten Welinder  <terra gnome org>
 
diff --git a/plugins/excel/xlsx-write.c b/plugins/excel/xlsx-write.c
index 7c443b8..5449c8e 100644
--- a/plugins/excel/xlsx-write.c
+++ b/plugins/excel/xlsx-write.c
@@ -945,7 +945,12 @@ xlsx_write_style_write_alignment (G_GNUC_UNUSED XLSXWriteState *state, GsfXMLOut
                gsf_xml_out_add_bool (xml, "shrinkToFit", gnm_style_get_shrink_to_fit (style));
        }
        if (gnm_style_is_element_set (style, MSTYLE_ROTATION)) {
-               gsf_xml_out_add_int (xml, "textRotation", gnm_style_get_rotation (style));
+               int r = gnm_style_get_rotation (style);
+               if (r == -1)
+                       r = 0xff;
+               else if (r >= 270)
+                       r = (360 - r) + 90;
+               gsf_xml_out_add_int (xml, "textRotation", r);
        }
        if (gnm_style_is_element_set (style, MSTYLE_INDENT)) {
                gsf_xml_out_add_int (xml, "indent", gnm_style_get_indent (style));


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