[gnumeric] xlsx: workbook "0" is "self". I hope.



commit 61b243bc1e2dc3013f421b10c152a28bb8789330
Author: Morten Welinder <terra gnome org>
Date:   Sun Mar 13 13:16:33 2011 -0400

    xlsx: workbook "0" is "self".  I hope.

 plugins/excel/ChangeLog    |    5 +++++
 plugins/excel/xlsx-utils.c |    7 +++++--
 2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 61f3b42..46f43cb 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-13  Morten Welinder  <terra gnome org>
+
+	* xlsx-utils.c (xlsx_lookup_external_wb): It looks like [0] is
+	used to refer to the "self" workbook.
+
 2011-03-12  Jean Brefort  <jean brefort normalesup org>
 
 	* Makefile.am: add new xlsx drawing/chart files.
diff --git a/plugins/excel/xlsx-utils.c b/plugins/excel/xlsx-utils.c
index f73fbd6..7a4f463 100644
--- a/plugins/excel/xlsx-utils.c
+++ b/plugins/excel/xlsx-utils.c
@@ -34,6 +34,7 @@
 #include "gnm-format.h"
 #include <goffice/goffice.h>
 #include <glib-object.h>
+#include <string.h>
 
 typedef struct {
 	GnmConventions base;
@@ -63,7 +64,9 @@ xlsx_lookup_external_wb (GnmConventions const *convs,
 			 char const *name)
 {
 	XLSXExprConventions const *xconv = (XLSXExprConventions const *)convs;
-	g_print ("lookup '%s'\n", name);
+	if (strcmp (name, "0") == 0)
+		return ref_wb;
+	if (0) g_printerr ("lookup '%s'\n", name);
 	return g_hash_table_lookup (xconv->extern_wb_by_id, name);
 }
 
@@ -113,7 +116,7 @@ xlsx_conventions_add_extern_ref (GnmConventions *convs, char const *path)
 	g_hash_table_insert (xconv->extern_wb_by_id,
 		g_strdup_printf ("%d", g_hash_table_size (xconv->extern_wb_by_id) + 1),
 		res);
-	g_print ("add %d = '%s'\n", g_hash_table_size (xconv->extern_wb_by_id), path);
+	if (0) g_printerr ("add %d = '%s'\n", g_hash_table_size (xconv->extern_wb_by_id), path);
 	return res;
 }
 



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