[gnumeric] Fix ODF number roundtrip issue. [part of #724568]



commit 3302fd13d6e5cd6145a201978deedc68d0a68b77
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Mon Feb 17 15:40:16 2014 -0700

    Fix ODF number roundtrip issue. [part of #724568]
    
    2014-02-17  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * openoffice-write.c (odf_expr_conventions_new): use same
        decimal_digits as in gnumeric export.

 NEWS                                  |    1 +
 plugins/openoffice/ChangeLog          |    5 +++++
 plugins/openoffice/openoffice-write.c |    5 +++++
 3 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/NEWS b/NEWS
index f3a7d19..e3e260c 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ Gnumeric 1.12.12
 Andreas:
        * Fix ODF roundtrip of some header/footer markers. [part of #724487]
        * Fix ODF roundtrip of preferred window size. [part of #724487]
+       * Fix ODF number roundtrip issue. [part of #724568]
 
 Jean:
        * Fix persistence of hyperlinks tips. [see #724108]
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index a4ea602..7e64d1b 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,8 @@
+2014-02-17  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * openoffice-write.c (odf_expr_conventions_new): use same
+       decimal_digits as in gnumeric export. 
+
 2014-02-16  Andreas J. Guelzow <aguelzow pyrshep ca>
 
        * openoffice-read.c (odf_apply_gnm_config): handle geometry
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 326e2ac..062b65f 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -2764,6 +2764,7 @@ odf_expr_conventions_new (GnmOOExport *state)
        GnmConventions *conv = gnm_conventions_new_full
                (sizeof (ODFConventions));
        ODFConventions *oconv = (ODFConventions *)conv;
+       gnm_float l10;
 
        conv->sheet_name_sep            = '.';
        conv->arg_sep                   = ';';
@@ -2777,6 +2778,10 @@ odf_expr_conventions_new (GnmOOExport *state)
        conv->output.func               = odf_expr_func_handler;
        conv->output.boolean            = odf_boolean_handler;
 
+       l10 = gnm_log10 (FLT_RADIX);
+       conv->output.decimal_digits     = (int)gnm_ceil (GNM_MANT_DIG * l10) +
+                                         (l10 == (int)l10 ? 0 : 1);
+
        oconv->state                    = state;
 
        return conv;


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