Commit bd6dae23 authored by Morten Welinder's avatar Morten Welinder

xlsx: fix problem that cleared cells referencing other workbooks.

We end up destroying fake workbooks created for external references.
That rewrites all dependencies which, in turn, cleared the values.
parent b0dbfbb8
2014-03-16 Morten Welinder <terra@gnome.org>
* src/cell.c (cell_set_expr_internal): Don't change an existing
value.
2014-03-15 Morten Welinder <terra@gnome.org>
* src/style-border.c (gnm_border_shutdown): New function to help
......
......@@ -26,7 +26,8 @@ Morten:
* Fix minor conditional format GUI issues.
* Plug leak.
* Fix font dialog problem with underline.
* Fix crash reading strane xls file. [Redhat #1076912]
* Fix crash reading strange xls file. [Redhat #1076912]
* Fix problem clearing existing values in some xlsx cells. [#726297]
--------------------------------------------------------------------------
Gnumeric 1.12.12
......
......@@ -118,11 +118,15 @@ xlsx_conventions_add_extern_ref (GnmConventions *convs, char const *path)
{
XLSXExprConventions *xconv = (XLSXExprConventions *)convs;
Workbook *res = g_object_new (WORKBOOK_TYPE, NULL);
char *id;
(void) go_doc_set_uri (GO_DOC (res), 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);
if (0) g_printerr ("add %d = '%s'\n", g_hash_table_size (xconv->extern_wb_by_id), path);
id = g_strdup_printf ("%d", g_hash_table_size (xconv->extern_wb_by_id) + 1);
if (0) g_printerr ("add %s = '%s'\n", id, path);
g_hash_table_insert (xconv->extern_wb_by_id, id, res);
return res;
}
......
......@@ -209,19 +209,18 @@ gnm_cell_set_expr_and_value (GnmCell *cell, GnmExprTop const *texpr, GnmValue *v
static void
cell_set_expr_internal (GnmCell *cell, GnmExprTop const *texpr)
{
GnmValue *save_value;
gnm_expr_top_ref (texpr);
/* Don't touch the value. */
save_value = cell->value ? cell->value : value_new_empty ();
cell->value = NULL;
gnm_cell_cleanout (cell);
cell->base.flags |= GNM_CELL_HAS_NEW_EXPR;
cell->base.texpr = texpr;
/* Until the value is recomputed, we put in this value.
*
* We should consider using 0 instead and take out the
* gnm_cell_needs_recalc call in sheet_foreach_cell_in_range.
*/
cell->value = value_new_empty ();
cell->value = save_value;
}
/*
......
......@@ -238,7 +238,9 @@ gnm_rendered_value_new (GnmCell const *cell,
sheet = cell->base.sheet;
if (debug)
g_printerr ("Rendering %s\n", cell_name (cell));
g_printerr ("Rendering %s value [%s]\n",
cell_name (cell),
value_peek_string (cell->value));
displayed_formula =
gnm_cell_has_expr (cell) && sheet->display_formulas;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment