[gnumeric] xls: rounding row height rounding issue.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] xls: rounding row height rounding issue.
- Date: Sat, 10 Mar 2012 23:15:51 +0000 (UTC)
commit 49483ac2fcb32dc781f00088dad327691820fd1b
Author: Morten Welinder <terra gnome org>
Date: Sat Mar 10 18:14:51 2012 -0500
xls: rounding row height rounding issue.
On import we divide by 20, on export we multiply by 20. Add in 1e-6
to ensure round-tripping.
NEWS | 1 +
plugins/excel/ChangeLog | 4 ++++
plugins/excel/ms-excel-write.c | 4 ++--
3 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index 370059f..10c38e5 100644
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,7 @@ Morten:
* Improve xls import re. hard column widths.
* Export only needed col/row styles to .gnumeric.
* Fix export of colours to .gnumeric.
+ * Fix row height xls export rounding issue. [Part of #671513]
--------------------------------------------------------------------------
Gnumeric 1.11.2
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index e984c8f..8097eab 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,5 +1,9 @@
2012-03-10 Morten Welinder <terra gnome org>
+ * ms-excel-write.c (excel_write_DEFAULT_ROW_HEIGHT)
+ (excel_write_ROWINFO): Add 1e-6 to toughen against rounding
+ errors.
+
* 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
diff --git a/plugins/excel/ms-excel-write.c b/plugins/excel/ms-excel-write.c
index 9542429..ce59bd1 100644
--- a/plugins/excel/ms-excel-write.c
+++ b/plugins/excel/ms-excel-write.c
@@ -3615,7 +3615,7 @@ excel_write_DEFAULT_ROW_HEIGHT (BiffPut *bp, ExcelWriteSheet *esheet)
guint16 height;
def_height = sheet_row_get_default_size_pts (esheet->gnum_sheet);
- height = (guint16) (20. * def_height);
+ height = (guint16) (20. * def_height + 1e-6);
d (1, g_printerr ("Default row height 0x%x;\n", height););
data = ms_biff_put_len_next (bp, BIFF_DEFAULTROWHEIGHT_v2, 4);
GSF_LE_SET_GUINT16 (data + 0, options);
@@ -5014,7 +5014,7 @@ excel_write_ROWINFO (BiffPut *bp, ExcelWriteSheet *esheet, guint32 row, guint32
/* We don't worry about standard height. I haven't seen it
* indicated in any actual esheet. */
- height = (guint16) (20. * ri->size_pts);
+ height = (guint16) (20. * ri->size_pts + 1e-6);
options |= (MIN (ri->outline_level, 0x7));
if (ri->is_collapsed)
options |= 0x10;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]