[gnumeric] xlsx: fix export of underlining.



commit ccb7caa67c9b8b982f11c454fe77e7ea82fcc3f5
Author: Morten Welinder <terra gnome org>
Date:   Wed Feb 19 20:16:22 2014 -0500

    xlsx: fix export of underlining.

 NEWS                       |    1 +
 plugins/excel/ChangeLog    |    2 ++
 plugins/excel/xlsx-write.c |   18 ++++++++++++++++++
 3 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/NEWS b/NEWS
index 265ecf1..533dd9e 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,7 @@ Morten:
        * Improve ssdiff's report of differences.
        * Improve LOG2's accuracy.
        * Fix BIFF7 export of page headers and footers.
+       * Fix xlsx export of underlines.
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.11
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 7e76c78..f966593 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,5 +1,7 @@
 2014-02-19  Morten Welinder  <terra gnome org>
 
+       * xlsx-write.c (xlsx_write_fonts): Handle underline.
+
        * ms-excel-write.c (excel_write_HEADER_FOOTER): Use one-byte
        strings for BIFF7 and earlier.  That matches the way we read
        things.
diff --git a/plugins/excel/xlsx-write.c b/plugins/excel/xlsx-write.c
index 823f32b..c075650 100644
--- a/plugins/excel/xlsx-write.c
+++ b/plugins/excel/xlsx-write.c
@@ -418,6 +418,8 @@ xlsx_find_font (GnmStyle const *style, GPtrArray  *styles)
                    gnm_style_is_element_set (old_style, MSTYLE_FONT_BOLD) ||
                    gnm_style_is_element_set (style, MSTYLE_FONT_ITALIC) !=
                    gnm_style_is_element_set (old_style, MSTYLE_FONT_ITALIC) ||
+                   gnm_style_is_element_set (style, MSTYLE_FONT_UNDERLINE) !=
+                   gnm_style_is_element_set (old_style, MSTYLE_FONT_UNDERLINE) ||
                    gnm_style_is_element_set (style, MSTYLE_FONT_COLOR) !=
                    gnm_style_is_element_set (old_style, MSTYLE_FONT_COLOR) ||
                    gnm_style_is_element_set (style, MSTYLE_FONT_NAME) !=
@@ -429,6 +431,7 @@ xlsx_find_font (GnmStyle const *style, GPtrArray  *styles)
                        continue;
                if (gnm_style_get_font_bold (style) != gnm_style_get_font_bold (old_style) ||
                    gnm_style_get_font_italic (style) != gnm_style_get_font_italic (old_style) ||
+                   gnm_style_get_font_uline (style) != gnm_style_get_font_uline (old_style) ||
                    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) ||
@@ -452,6 +455,7 @@ xlsx_write_fonts (XLSXWriteState *state, GsfXMLOut *xml)
                GnmStyle const *style = g_ptr_array_index (state->styles_array, i);
                if (gnm_style_is_element_set (style, MSTYLE_FONT_BOLD) ||
                    gnm_style_is_element_set (style, MSTYLE_FONT_ITALIC) ||
+                   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_SIZE) ||
@@ -483,6 +487,20 @@ xlsx_write_fonts (XLSXWriteState *state, GsfXMLOut *xml)
                                xlsx_add_bool (xml, "val", gnm_style_get_font_italic (style));
                                gsf_xml_out_end_element (xml);
                        }
+                       if (gnm_style_is_element_set (style, MSTYLE_FONT_UNDERLINE)) {
+                               static const char * const types[] = {
+                                       "none",
+                                       "single",
+                                       "double",
+                                       "singleAccounting",
+                                       "doubleAccounting"
+                               };
+
+                               gsf_xml_out_start_element (xml, "u");
+                               gsf_xml_out_add_cstr
+                                       (xml, "val", types[gnm_style_get_font_uline (style)]);
+                               gsf_xml_out_end_element (xml);
+                       }
                        if (gnm_style_is_element_set (style, MSTYLE_FONT_COLOR))
                                xlsx_write_color_element
                                        (xml, "color",


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