[gnumeric] xlsx: improve roundtrip of numbers.



commit 4e291177dcd11a6e2da717c8048085030953f2bb
Author: Morten Welinder <terra gnome org>
Date:   Mon Feb 17 23:35:43 2014 -0500

    xlsx: improve roundtrip of numbers.

 NEWS                         |    1 +
 plugins/excel/ChangeLog      |    3 +++
 plugins/excel/xlsx-utils.c   |    5 +++++
 plugins/openoffice/ChangeLog |    2 +-
 4 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index e3e260c..890f540 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ Jean:
 Morten:
        * Fix BIFF7 import of long strings.  [#724399]
        * Improve testing.
+       * Fix XLSX number roundtrip issue.
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.11
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index ce30a15..64c242e 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,5 +1,8 @@
 2014-02-17  Morten Welinder  <terra gnome org>
 
+       * xlsx-utils.c (xlsx_conventions_new): use same
+       decimal_digits as in gnumeric export.
+
        * ms-biff.c (ms_biff_query_next): Handle continuation records
        here for certain opcodes.  Fixes part of #724399.
 
diff --git a/plugins/excel/xlsx-utils.c b/plugins/excel/xlsx-utils.c
index 9bae9e0..3810432 100644
--- a/plugins/excel/xlsx-utils.c
+++ b/plugins/excel/xlsx-utils.c
@@ -588,6 +588,11 @@ xlsx_conventions_new (gboolean output)
                g_free, (GDestroyNotify) g_object_unref);
 
        if (output) {
+               gnm_float l10 = gnm_log10 (FLT_RADIX);
+               convs->output.decimal_digits =
+                       (int)gnm_ceil (GNM_MANT_DIG * l10) +
+                       (l10 == (int)l10 ? 0 : 1);
+
                convs->output.func      = xlsx_func_map_out;
 
                xconv->xlfn_map = g_hash_table_new (go_ascii_strcase_hash,
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 7e64d1b..d66367c 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,7 +1,7 @@
 2014-02-17  Andreas J. Guelzow <aguelzow pyrshep ca>
 
        * openoffice-write.c (odf_expr_conventions_new): use same
-       decimal_digits as in gnumeric export. 
+       decimal_digits as in gnumeric export.
 
 2014-02-16  Andreas J. Guelzow <aguelzow pyrshep ca>
 


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