[gnumeric] xlsx: export line style too.



commit 50ee7fd39083df10b823771249fd9f947681fe51
Author: Morten Welinder <terra gnome org>
Date:   Fri Jan 16 21:08:20 2015 -0500

    xlsx: export line style too.
    
    We already import this.  Not everything is a perfect match to our
    settings, but this does the opposite of the import.

 NEWS                               |    3 ++-
 plugins/excel/ChangeLog            |    2 ++
 plugins/excel/xlsx-write-drawing.c |   23 ++++++++++++++++++++++-
 3 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index 234dd19..1cf81f6 100644
--- a/NEWS
+++ b/NEWS
@@ -25,7 +25,8 @@ Morten:
        * Fix ADDRESS problem.
        * Fix sheet-filter problem with errors.  [#742601]
        * Improve error handling for .gnumeric a bit.
-       * Improve xlsx graph import.
+       * Improve xlsx graph import: line colour.
+       * Improve xlsx graph export: line style.
 
 Thomas Kluyver:
        * Fix import of extended floats from wk4 files.  [#739679]
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index ca9b17b..ffba84e 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,5 +1,7 @@
 2015-01-16  Morten Welinder  <terra gnome org>
 
+       * xlsx-write-drawing.c (xlsx_write_go_style): Export line style.
+
        * xlsx-read-drawing.c (xlsx_style_line_start): Also point to the
        right auto_color location so we don't end up ignoring the colors
        we read.
diff --git a/plugins/excel/xlsx-write-drawing.c b/plugins/excel/xlsx-write-drawing.c
index bb24bea..5a5d71b 100644
--- a/plugins/excel/xlsx-write-drawing.c
+++ b/plugins/excel/xlsx-write-drawing.c
@@ -134,7 +134,21 @@ xlsx_write_go_style (GsfXMLOut *xml, GOStyle *style)
        gsf_xml_out_start_element (xml, "c:spPr");
        if ((style->interesting_fields & (GO_STYLE_LINE | GO_STYLE_OUTLINE)) &&
            style->line.dash_type != GO_LINE_NONE) {/* TODO: add more tests for transparent line */
-               /* export the line color */
+               static const char * const dashes[] = {
+                       NULL,            /* GO_LINE_NONE */
+                       "solid",         /* GO_LINE_SOLID */
+                       "sysDot",        /* GO_LINE_S_DOT */
+                       "sysDashDot",    /* GO_LINE_S_DASH_DOT */
+                       "sysDashDotDot", /* GO_LINE_S_DASH_DOT_DOT */
+                       "lgDashDotDot",  /* GO_LINE_DASH_DOT_DOT_DOT */
+                       "dot",           /* GO_LINE_DOT */
+                       "sysDash",       /* GO_LINE_S_DASH */
+                       "dash",          /* GO_LINE_DASH */
+                       "lgDash",        /* GO_LINE_LONG_DASH */
+                       "dashDot",       /* GO_LINE_DASH_DOT */
+                       "lgDashDot",     /* GO_LINE_DASH_DOT_DOT */
+               };
+
                gsf_xml_out_start_element (xml, "a:ln");
                if (style->line.width > 0)
                        gsf_xml_out_add_int (xml, "w", style->line.width * 12700);
@@ -144,6 +158,13 @@ xlsx_write_go_style (GsfXMLOut *xml, GOStyle *style)
                        gsf_xml_out_end_element (xml);
                }
 
+               if (style->line.dash_type < G_N_ELEMENTS (dashes) &&
+                   dashes[style->line.dash_type]) {
+                       gsf_xml_out_start_element (xml, "a:prstDash");
+                       gsf_xml_out_add_cstr_unchecked (xml, "val", dashes[style->line.dash_type]);
+                       gsf_xml_out_end_element (xml);
+               }
+
                gsf_xml_out_end_element (xml);
        }
        if ((style->interesting_fields & GO_STYLE_FILL) &&


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