[gnumeric] xls: fix problem with print area.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] xls: fix problem with print area.
- Date: Wed, 13 Oct 2010 19:26:28 +0000 (UTC)
commit b0182154973e79e4ea570965c65ab7306b0ef0e8
Author: Morten Welinder <terra gnome org>
Date: Wed Oct 13 15:26:14 2010 -0400
xls: fix problem with print area.
NEWS | 1 +
plugins/excel/ChangeLog | 1 +
plugins/excel/ms-excel-read.c | 36 +++++++++++++++++++++++++++++++++---
3 files changed, 35 insertions(+), 3 deletions(-)
---
diff --git a/NEWS b/NEWS
index da11b6d..e2a6119 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,7 @@ Jean:
Morten:
* Fix crash related to broken xls. [#632050]
+ * Fix print area problem from broken xls.
--------------------------------------------------------------------------
Gnumeric 1.10.11
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index d6a1f6e..f35694e 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -2,6 +2,7 @@
* ms-excel-read.c (excel_read_SELECTION): Work around missing
selection. Fixes #632050.
+ (excel_parse_name): Treat global Print_Area a tad better.
2010-10-03 Jean Brefort <jean brefort normalesup org>
diff --git a/plugins/excel/ms-excel-read.c b/plugins/excel/ms-excel-read.c
index c51847f..7f04e6f 100644
--- a/plugins/excel/ms-excel-read.c
+++ b/plugins/excel/ms-excel-read.c
@@ -3381,15 +3381,45 @@ excel_parse_name (GnmXLImporter *importer, Sheet *sheet, char *name,
if (val != NULL && val->type == VALUE_CELLRANGE) {
GnmEvalPos ep;
int height, width;
+
+ if (sheet == NULL) {
+ Sheet *start_sheet, *end_sheet;
+ GnmRange dest;
+
+ /* Turn a global Print_Area name into a local
+ name for the sheet it specifies. This
+ triggers on the file from 632050. */
+ gnm_rangeref_normalize_pp (value_get_rangeref (val),
+
+ &pp,
+
+ &start_sheet,
+ &end_sheet,
+ &dest);
+ if (start_sheet && end_sheet == start_sheet) {
+ sheet = start_sheet;
+ pp.sheet = sheet;
+ gnm_expr_top_unref (texpr);
+ texpr = gnm_expr_top_new_constant (value_new_cellrange_r (NULL, &dest));
+ }
+ }
+
eval_pos_init_sheet (&ep, sheet);
height = value_area_get_height (val, &ep);
width = value_area_get_width (val, &ep);
- value_release (val);
- if ((height == 65536) && (width == 256)) {
+ if (height == gnm_sheet_get_max_rows (sheet) &&
+ width == gnm_sheet_get_max_cols (sheet)) {
gnm_expr_top_unref (texpr);
- texpr = gnm_expr_top_new_constant (value_new_error_REF (&ep));
+ texpr = NULL;
}
}
+ value_release (val);
+
+ /* Completely ignore Print_Area settings of #REF! */
+ if (texpr == NULL || gnm_expr_top_is_err (texpr, GNM_ERROR_REF)) {
+ if (texpr) gnm_expr_top_unref (texpr);
+ return NULL;
+ }
}
nexpr = expr_name_add (&pp, name,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]