[gnumeric] xlsx: export super and subscript.



commit 562b0c90874999535b151813e823cac60ebefcdf
Author: Morten Welinder <terra gnome org>
Date:   Mon Mar 10 11:57:02 2014 -0400

    xlsx: export super and subscript.

 NEWS                       |    1 +
 plugins/excel/ChangeLog    |    4 ++++
 plugins/excel/xlsx-write.c |   19 +++++++++++++++++++
 3 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/NEWS b/NEWS
index 4e3fcc0..a0d45af 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ Andreas:
 Morten:
        * Support volatile functions.  [#305798]
        * Improve testing.
+       * Export super/subscript fonts to xlsx.  [Part of #726035]
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.12
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 7667d0a..7fde9a9 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,7 @@
+2014-03-10  Morten Welinder  <terra gnome org>
+
+       * xlsx-write.c (xlsx_write_fonts): Save super/sub attribute.
+
 2014-03-05  Morten Welinder  <terra gnome org>
 
        * ms-formula-write.c (excel_write_prep_expr): Rewrite in terms of
diff --git a/plugins/excel/xlsx-write.c b/plugins/excel/xlsx-write.c
index 104f607..9ee0e36 100644
--- a/plugins/excel/xlsx-write.c
+++ b/plugins/excel/xlsx-write.c
@@ -433,6 +433,8 @@ xlsx_find_font (GnmStyle const *style, GPtrArray  *styles)
                    gnm_style_is_element_set (old_style, MSTYLE_FONT_NAME) ||
                    gnm_style_is_element_set (style, MSTYLE_FONT_SIZE) !=
                    gnm_style_is_element_set (old_style, MSTYLE_FONT_SIZE) ||
+                   gnm_style_is_element_set (style, MSTYLE_FONT_SCRIPT) !=
+                   gnm_style_is_element_set (old_style, MSTYLE_FONT_SCRIPT) ||
                    gnm_style_is_element_set (style, MSTYLE_FONT_STRIKETHROUGH) !=
                    gnm_style_is_element_set (old_style, MSTYLE_FONT_STRIKETHROUGH))
                        continue;
@@ -442,6 +444,7 @@ xlsx_find_font (GnmStyle const *style, GPtrArray  *styles)
                    gnm_style_get_font_color (style)->go_color !=
                    gnm_style_get_font_color (old_style)->go_color ||
                    gnm_style_get_font_size (style) != gnm_style_get_font_size (old_style) ||
+                   gnm_style_get_font_script (style) != gnm_style_get_font_script (old_style) ||
                    gnm_style_get_font_strike (style) != gnm_style_get_font_strike (old_style))
                        continue;
                if (0 == strcmp (gnm_style_get_font_name (style),
@@ -465,6 +468,7 @@ xlsx_write_fonts (XLSXWriteState *state, GsfXMLOut *xml)
                    gnm_style_is_element_set (style, MSTYLE_FONT_UNDERLINE) ||
                    gnm_style_is_element_set (style, MSTYLE_FONT_COLOR) ||
                    gnm_style_is_element_set (style, MSTYLE_FONT_NAME) ||
+                   gnm_style_is_element_set (style, MSTYLE_FONT_SCRIPT) ||
                    gnm_style_is_element_set (style, MSTYLE_FONT_SIZE) ||
                    gnm_style_is_element_set (style, MSTYLE_FONT_STRIKETHROUGH)) {
                        gint font_n = xlsx_find_font (style, styles_w_fonts);
@@ -518,6 +522,21 @@ xlsx_write_fonts (XLSXWriteState *state, GsfXMLOut *xml)
                                        (xml, "val", gnm_style_get_font_name (style));
                                gsf_xml_out_end_element (xml);
                        }
+                       if (gnm_style_is_element_set (style, MSTYLE_FONT_SCRIPT)) {
+                               GOFontScript scr = gnm_style_get_font_script (style);
+                               const char *val;
+
+                               switch (scr) {
+                               case GO_FONT_SCRIPT_SUB: val = "subscript"; break;
+                               case GO_FONT_SCRIPT_SUPER: val = "superscript"; break;
+                               default: val = NULL;
+                               }
+                               if (val) {
+                                       gsf_xml_out_start_element (xml, "vertAlign");
+                                       gsf_xml_out_add_cstr (xml, "val", val);
+                                       gsf_xml_out_end_element (xml);
+                               }
+                       }
                        if (gnm_style_is_element_set (style, MSTYLE_FONT_SIZE)) {
                                gsf_xml_out_start_element (xml, "sz");
                                gsf_xml_out_add_float


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