[gnumeric] xlsx: handle some auto-style issues.



commit e6fe7e4026e053888f0812fb5b145726b96d5445
Author: Morten Welinder <terra gnome org>
Date:   Sat Jan 17 10:46:14 2015 -0500

    xlsx: handle some auto-style issues.

 plugins/excel/xlsx-read-drawing.c  |    7 +++++--
 plugins/excel/xlsx-write-drawing.c |    5 +++--
 2 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/plugins/excel/xlsx-read-drawing.c b/plugins/excel/xlsx-read-drawing.c
index 7f6e623..1ae53a5 100644
--- a/plugins/excel/xlsx-read-drawing.c
+++ b/plugins/excel/xlsx-read-drawing.c
@@ -1228,7 +1228,7 @@ static void
 xlsx_style_line_start (GsfXMLIn *xin, xmlChar const **attrs)
 {
        XLSXReadState   *state = (XLSXReadState *)xin->user_state;
-       int w = 0;
+       int w = -1;
 
        for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2) {
                if (attr_int (xin, attrs, "w", &w))
@@ -1238,7 +1238,10 @@ xlsx_style_line_start (GsfXMLIn *xin, xmlChar const **attrs)
        state->sp_type |= GO_STYLE_LINE;
        if (!state->cur_style)
                state->cur_style = (GOStyle *) gog_style_new ();
-       state->cur_style->line.width = w / 12700.;
+       
+       state->cur_style->line.auto_width = (w < 0);
+       if (!state->cur_style->line.auto_width)
+               state->cur_style->line.width = w / 12700.;
        state->gocolor = &state->cur_style->line.color;
        state->auto_color = &state->cur_style->line.auto_color;
 }
diff --git a/plugins/excel/xlsx-write-drawing.c b/plugins/excel/xlsx-write-drawing.c
index e39de60..b53ec2c 100644
--- a/plugins/excel/xlsx-write-drawing.c
+++ b/plugins/excel/xlsx-write-drawing.c
@@ -151,7 +151,7 @@ xlsx_write_go_style (GsfXMLOut *xml, GOStyle *style)
                };
 
                gsf_xml_out_start_element (xml, "a:ln");
-               if (style->line.width > 0)
+               if (!style->line.auto_width && style->line.width > 0)
                        gsf_xml_out_add_int (xml, "w", style->line.width * 12700);
                if (!style->line.auto_color) {
                        gsf_xml_out_start_element (xml, "a:solidFill");
@@ -159,7 +159,8 @@ xlsx_write_go_style (GsfXMLOut *xml, GOStyle *style)
                        gsf_xml_out_end_element (xml);
                }
 
-               if (style->line.dash_type < G_N_ELEMENTS (dashes) &&
+               if (!style->line.auto_dash &&
+                   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]);


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