[gnumeric] xls: fix import of hard column widths.



commit be09fdd218c4dcd5fd8c6b6bec4228150b5728bb
Author: Morten Welinder <terra gnome org>
Date:   Sat Mar 10 14:47:13 2012 -0500

    xls: fix import of hard column widths.

 NEWS                          |    1 +
 plugins/excel/ChangeLog       |    4 ++++
 plugins/excel/ms-excel-read.c |    9 +++------
 src/colrow.c                  |    2 +-
 4 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/NEWS b/NEWS
index 40a0e7d..072e852 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,7 @@ Morten:
 	* Fix sheet object order on xls export.
 	* Fix xls export for formulas in conditions.  [Part of #671513]
 	* Export non-visible style stuff to xls.  [Part of #671513]
+	* Improve xls import re. hard column widths.
 
 --------------------------------------------------------------------------
 Gnumeric 1.11.2
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 66c5cb8..e984c8f 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,5 +1,9 @@
 2012-03-10  Morten Welinder  <terra gnome org>
 
+	* ms-excel-read.c (excel_read_COLINFO): Drop work-around for buggy
+	pre-Gnumeric 1.7.5 export.  This fixes hard-size-set detection for
+	11_1040.xls
+
 	* ms-excel-write.c (excel_write_objs_v8): Unify writing of objects
 	to help fix stacking issues.
 	(excel_sheet_new): Eliminate special lists for lines and
diff --git a/plugins/excel/ms-excel-read.c b/plugins/excel/ms-excel-read.c
index 03cce5b..588867d 100644
--- a/plugins/excel/ms-excel-read.c
+++ b/plugins/excel/ms-excel-read.c
@@ -4290,7 +4290,7 @@ excel_read_COLINFO (BiffQuery *q, ExcelReadSheet *esheet)
 	guint16 const  xf	  = GSF_LE_GET_GUINT16 (q->data + 6);
 	guint16 const  options	  = GSF_LE_GET_GUINT16 (q->data + 8);
 	gboolean       hidden	  = (options & 0x0001) != 0;
-	/*gboolean const customWidth= (options & 0x0002) != 0;	   undocumented */
+	gboolean const customWidth= (options & 0x0002) != 0;	/* undocumented */
 	gboolean const bestFit    = (options & 0x0004) != 0;	/* undocumented */
 	gboolean const collapsed  = (options & 0x1000) != 0;
 	unsigned const outline_level = (unsigned)((options >> 8) & 0x7);
@@ -4333,11 +4333,8 @@ excel_read_COLINFO (BiffQuery *q, ExcelReadSheet *esheet)
 	if (lastcol >= gnm_sheet_get_max_cols (esheet->sheet))
 		lastcol = gnm_sheet_get_max_cols (esheet->sheet) - 1;
 	for (i = firstcol; i <= lastcol; i++) {
-		/* Kludge : we should really use
-		 *	hard_size == customWidth && !bestFit
-		 * but these flags are undocumented and gnumeric < 1.7.5 && OOo
-		 * export them as 0.  So we are reduced to using */
-		sheet_col_set_size_pts (esheet->sheet, i, width, !bestFit);
+		sheet_col_set_size_pts (esheet->sheet, i, width,
+					customWidth && !bestFit);
 		if (outline_level > 0 || collapsed)
 			colrow_set_outline (sheet_col_fetch (esheet->sheet, i),
 					    outline_level, collapsed);
diff --git a/src/colrow.c b/src/colrow.c
index bc18227..8c861a3 100644
--- a/src/colrow.c
+++ b/src/colrow.c
@@ -129,7 +129,7 @@ colrow_equal (ColRowInfo const *a, ColRowInfo const *b)
  * @dst :
  * @src :
  *
- * Assign all content, accept the position of @src to @dst
+ * Assign all content, except the position of @src to @dst
  */
 void
 colrow_copy (ColRowInfo *dst, ColRowInfo const *src)



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