[gnumeric] xlsx: fix reading percentages.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] xlsx: fix reading percentages.
- Date: Sat, 17 Jan 2015 22:30:24 +0000 (UTC)
commit 46f84a5ed4176c4879e4363f652473b7902d44d0
Author: Morten Welinder <terra gnome org>
Date: Sat Jan 17 17:30:01 2015 -0500
xlsx: fix reading percentages.
These, per spec, have a "%" at the end, so deal with that.
plugins/excel/ChangeLog | 3 +++
plugins/excel/xlsx-read-drawing.c | 29 +++++++++++++++++++----------
2 files changed, 22 insertions(+), 10 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 0b36c12..d47cf32 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,5 +1,8 @@
2015-01-17 Morten Welinder <terra gnome org>
+ * xlsx-read-drawing.c (xlsx_chart_bar_overlap)
+ (xlsx_chart_bar_gap): Fix reading percentages.
+
* xlsx-write-drawing.c (xlsx_write_axis): Factor this out from
xlsx_write_one_plot. Write axis label.
(xlsx_write_one_chart): Write chart title.
diff --git a/plugins/excel/xlsx-read-drawing.c b/plugins/excel/xlsx-read-drawing.c
index b64ec12..a753e7a 100644
--- a/plugins/excel/xlsx-read-drawing.c
+++ b/plugins/excel/xlsx-read-drawing.c
@@ -437,13 +437,18 @@ xlsx_chart_bar_dir (GsfXMLIn *xin, xmlChar const **attrs)
static void
xlsx_chart_bar_overlap (GsfXMLIn *xin, xmlChar const **attrs)
{
- XLSXReadState *state = (XLSXReadState *)xin->user_state;
- int overlap;
- g_return_if_fail (state->plot != NULL);
- if (simple_int (xin, attrs, &overlap))
- g_object_set (G_OBJECT (state->plot),
- "overlap-percentage", CLAMP (overlap, -100, 100), NULL);
+ XLSXReadState *state = (XLSXReadState *)xin->user_state;
+
+ for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2) {
+ if (0 == strcmp (attrs[0], "val")) {
+ int overlap = strtol (attrs[1], NULL, 10);
+ g_object_set (G_OBJECT (state->plot),
+ "overlap-percentage", CLAMP (overlap, -100, 100),
+ NULL);
+ }
+ }
}
+
static void
xlsx_chart_bar_group (GsfXMLIn *xin, xmlChar const **attrs)
{
@@ -465,10 +470,14 @@ static void
xlsx_chart_bar_gap (GsfXMLIn *xin, xmlChar const **attrs)
{
XLSXReadState *state = (XLSXReadState *)xin->user_state;
- int gap;
- if (simple_int (xin, attrs, &gap))
- g_object_set (G_OBJECT (state->plot),
- "gap-percentage", CLAMP (gap, 0, 500), NULL);
+
+ for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2) {
+ if (0 == strcmp (attrs[0], "val")) {
+ int gap = strtol (attrs[1], NULL, 10);
+ g_object_set (G_OBJECT (state->plot),
+ "gap-percentage", CLAMP (gap, 0, 500), NULL);
+ }
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]