[gnumeric] xlsx: simplify last change using gnm_cell_get_format_given_style.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] xlsx: simplify last change using gnm_cell_get_format_given_style.
- Date: Sat, 31 May 2014 16:26:24 +0000 (UTC)
commit ff09d9967f2831eb54ea629d165c99b6f9d656a4
Author: Morten Welinder <terra gnome org>
Date: Sat May 31 12:25:31 2014 -0400
xlsx: simplify last change using gnm_cell_get_format_given_style.
The logic is complicated. Let's not copy it all over the place.
plugins/excel/xlsx-write.c | 13 +++++--------
1 files changed, 5 insertions(+), 8 deletions(-)
---
diff --git a/plugins/excel/xlsx-write.c b/plugins/excel/xlsx-write.c
index 330a476..1406432 100644
--- a/plugins/excel/xlsx-write.c
+++ b/plugins/excel/xlsx-write.c
@@ -1382,7 +1382,7 @@ xlsx_write_cells (XLSXWriteState *state, GsfXMLOut *xml,
GnmStyle const *style;
GnmStyle *style1 = NULL;
gint style_id;
- GOFormat const *fmt;
+ GOFormat const *fmt1, *fmt2;
cell = g_ptr_array_index (all_cells, cno);
if (cell && cell->pos.row == r && cell->pos.col == c) {
@@ -1395,14 +1395,11 @@ xlsx_write_cells (XLSXWriteState *state, GsfXMLOut *xml,
/* FIXME: Use sheet_style_get_row once per row */
style = sheet_style_get (sheet, c, r);
- fmt = gnm_style_get_format (style);
- if (go_format_is_general (fmt) &&
- val &&
- VALUE_FMT (val) &&
- !go_format_is_markup (VALUE_FMT (val))) {
- fmt = VALUE_FMT (val);
+ fmt1 = gnm_style_get_format (style);
+ fmt2 = cell ? gnm_cell_get_format_given_style (cell, style) : fmt1;
+ if (fmt1 != fmt2) {
style = style1 = gnm_style_dup (style);
- gnm_style_set_format (style1, fmt);
+ gnm_style_set_format (style1, fmt2);
}
style_id = style && style != col_styles[c]
? xlsx_get_style_id (state, style)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]