[gnumeric] Export defined names to xlsx. [#655010]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Export defined names to xlsx. [#655010]
- Date: Thu, 21 Jul 2011 07:11:39 +0000 (UTC)
commit 8427fad355f78b1a531f8df1176b083b27679a2d
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Thu Jul 21 01:11:08 2011 -0600
Export defined names to xlsx. [#655010]
2011-07-21 Andreas J. Guelzow <aguelzow pyrshep ca>
* xlsx-write.c (xlsx_write_named_expression): new
(xlsx_write_definedNames): new
(xlsx_write_workbook): call xlsx_write_definedNames
NEWS | 1 +
plugins/excel/ChangeLog | 8 +++++++-
plugins/excel/xlsx-write.c | 38 ++++++++++++++++++++++++++++++++++++++
3 files changed, 46 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index a9be638..72b3be5 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,7 @@ Andreas:
* Fix bar and column chart import/export to ODF.
* Speed up frequent calls to INTERPOLATION with the same
abscissae/ordinates. [#654538]
+ * Export defined names to xlsx. [#655010]
Morten:
* Fix --with-gnome compilation: [#652802]
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 43f4d22..ed4d75f 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,9 @@
+2011-07-21 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * xlsx-write.c (xlsx_write_named_expression): new
+ (xlsx_write_definedNames): new
+ (xlsx_write_workbook): call xlsx_write_definedNames
+
2011-07-03 Jean Brefort <jean brefort normalesup org>
* xlsx-read-drawing.c (xlsx_chart_text_start), (xlsx_chart_text),
@@ -5,7 +11,7 @@
2011-07-01 Andreas J. Guelzow <aguelzow pyrshep ca>
- * xlsx-write-docprops.c (xlsx_map_prop_name_to_output_fun):
+ * xlsx-write-docprops.c (xlsx_map_prop_name_to_output_fun):
use GSF_META_NAME_MM_CLIP_COUNT
* xlsx-read-docprops.c: use GSF_META_NAME_MM_CLIP_COUNT
diff --git a/plugins/excel/xlsx-write.c b/plugins/excel/xlsx-write.c
index 45e9b66..88bec48 100644
--- a/plugins/excel/xlsx-write.c
+++ b/plugins/excel/xlsx-write.c
@@ -51,6 +51,7 @@
#include "graph.h"
#include "style-border.h"
#include "gutils.h"
+#include "expr-name.h"
#include "go-val.h"
@@ -2044,6 +2045,41 @@ xlsx_write_sheet (XLSXWriteState *state, GsfOutfile *dir, GsfOutfile *wb_part, u
}
static void
+xlsx_write_named_expression (gpointer key, GnmNamedExpr *nexpr, XLSXClosure *closure)
+{
+ char *formula;
+
+ g_return_if_fail (nexpr != NULL);
+ if (!expr_name_is_active (nexpr) || nexpr->is_permanent)
+ return;
+
+ gsf_xml_out_start_element (closure->xml, "definedName");
+ gsf_xml_out_add_cstr (closure->xml, "name", expr_name_name (nexpr));
+
+ if (nexpr->pos.sheet != NULL)
+ gsf_xml_out_add_int (closure->xml, "localSheetId",
+ nexpr->pos.sheet->index_in_wb);
+
+ formula = expr_name_as_string (nexpr, NULL, closure->state->convs);
+ gsf_xml_out_add_cstr (closure->xml, NULL, formula);
+ g_free (formula);
+
+ gsf_xml_out_end_element (closure->xml);
+}
+
+static void
+xlsx_write_definedNames (XLSXWriteState *state, GsfXMLOut *xml)
+{
+ XLSXClosure closure = {state, xml};
+
+ gsf_xml_out_start_element (xml, "definedNames");
+ workbook_foreach_name
+ (state->base.wb, FALSE,
+ (GHFunc)&xlsx_write_named_expression, &closure);
+ gsf_xml_out_end_element (xml);
+}
+
+static void
xlsx_write_calcPR (XLSXWriteState *state, GsfXMLOut *xml)
{
Workbook const *wb = state->base.wb;
@@ -2144,6 +2180,8 @@ xlsx_write_workbook (XLSXWriteState *state, GsfOutfile *root_part)
}
gsf_xml_out_end_element (xml); /* </sheets> */
+ xlsx_write_definedNames (state, xml);
+
xlsx_write_calcPR (state, xml);
if (NULL != cacheRefs) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]