[gnumeric] xls: fix export of conditional formats' patterns.



commit b5245636cc26bba67b1365fdd2daef95eea28499
Author: Morten Welinder <terra gnome org>
Date:   Wed Mar 7 20:00:23 2012 -0500

    xls: fix export of conditional formats' patterns.
    
    Typo: we tested the wrong partial style.

 NEWS                           |    1 +
 plugins/excel/ChangeLog        |    4 ++++
 plugins/excel/ms-excel-read.c  |    5 +++--
 plugins/excel/ms-excel-write.c |    2 +-
 4 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/NEWS b/NEWS
index 99a8200..592eef2 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ Morten:
 	* Fix xls save crash.  [#671267]
 	* Fix xls page break export.  [Part of #671513]
 	* Fix xls export of conditional formats' font.  [Part of #671513]
+	* Fix xls export of conditional formats' pattern.  [Part of #671513]
 	* Improve xls import of rich text.  [Part of #671513]
 	* Fix rich text export problem with non-ASCII.  [Part of #671513]
 
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index aee9cfc..8d6ee81 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,10 +1,14 @@
 2012-03-07  Morten Welinder  <terra gnome org>
 
+	* ms-excel-read.c (ms_sheet_parse_expr_internal): Fix crash when
+	debugging was turned on.
+
 	* ms-excel-write.c (cb_write_condition): Actually save the font
 	flags.  Part of #671531.
 	(excel_write_ClientTextbox): Fix confusion between byte offsets
 	and character offsets.
 	(excel_write_RSTRING): Ditto.  Part of #671531.
+	(cb_write_condition): Fix pattern export.  Part of #671531.
 
 2012-03-06  Morten Welinder  <terra gnome org>
 
diff --git a/plugins/excel/ms-excel-read.c b/plugins/excel/ms-excel-read.c
index 2f656ce..35cd513 100644
--- a/plugins/excel/ms-excel-read.c
+++ b/plugins/excel/ms-excel-read.c
@@ -310,7 +310,7 @@ ms_sheet_parse_expr_internal (ExcelReadSheet *esheet, guint8 const *data, int le
 		tmp = gnm_expr_top_as_string (texpr,
 					      parse_pos_init (&pp, wb, sheet, 0, 0),
 					      gnm_conventions_default);
-		puts (tmp);
+		puts (tmp ? tmp : "(null)");
 		g_free (tmp);
 	}
 
@@ -1186,6 +1186,7 @@ excel_read_LABEL_markup (BiffQuery *q, ExcelReadSheet *esheet,
 	MSContainer const *c = &esheet->container;
 	TXORun txo_run;
 	unsigned n;
+	unsigned int clen = g_utf8_strlen (str, -1);
 
 	d (0, {
 			g_printerr ("strlen=%d len=%d\n", str_len, (int)strlen (str));
@@ -1209,7 +1210,7 @@ excel_read_LABEL_markup (BiffQuery *q, ExcelReadSheet *esheet,
 
 			o = GSF_LE_GET_GUINT16 (ptr + n);
 			l = GSF_LE_GET_GUINT16 (ptr + n + 2);
-			XL_CHECK_CONDITION_VAL (o + l <= str_len,
+			XL_CHECK_CONDITION_VAL (o <= clen,
 						go_format_new_markup (txo_run.accum, FALSE));
 
 			txo_run.first = g_utf8_offset_to_pointer (str, o) - str;
diff --git a/plugins/excel/ms-excel-write.c b/plugins/excel/ms-excel-write.c
index f8e54e8..55f243d 100644
--- a/plugins/excel/ms-excel-write.c
+++ b/plugins/excel/ms-excel-write.c
@@ -1056,7 +1056,7 @@ cb_write_condition (GnmStyleConditions const *sc, CondDetails *cd,
 
 			/* Gnumeric requires pattern = 1, whereas XL can store
 			 * just the color.  undo the mapping we made on import. */
-			if (gnm_style_is_element_set (s, MSTYLE_COLOR_PATTERN))
+			if (gnm_style_is_element_set (s, MSTYLE_PATTERN))
 				background = map_pattern_to_xl (
 					gnm_style_get_pattern (s)) << 10;
 			else



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