[gnumeric] Fix export of FLOOR(x) to xlsx. [Debian #464732]



commit 8aa364e900b008601a712c0490a7e115fd4c7cd6
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Sat Jun 22 00:34:18 2013 -0600

    Fix export of FLOOR(x) to xlsx. [Debian #464732]
    
    2013-06-22  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * xlsx-utils.c (xlsx_func_floor_output_handler): new
        (xlsx_conventions_new): connect new handler

 NEWS                       |    1 +
 plugins/excel/ChangeLog    |    5 +++++
 plugins/excel/xlsx-utils.c |   18 +++++++++++++++++-
 3 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index 680e968..f9f3f72 100644
--- a/NEWS
+++ b/NEWS
@@ -31,6 +31,7 @@ Andreas:
        * Fix reading of conditional formats from xls files. [#702612]
        * Fix reading of solid fill conditional formats from xlsx files. [#702615]
        * Improve xlsx import of new stat function names.
+       * Fix export of FLOOR(x) to xlsx. [Debian #464732]
 
 Darrell Tangman:
        * Update documentation for Edit and Insert menus. [#700596]
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index fda6df5..7fd954f 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,8 @@
+2013-06-22  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * xlsx-utils.c (xlsx_func_floor_output_handler): new
+       (xlsx_conventions_new): connect new handler
+
 2013-06-21  Andreas J. Guelzow <aguelzow pyrshep ca>
 
        * ms-formula-read.c (ms-formula-read.c): add more
diff --git a/plugins/excel/xlsx-utils.c b/plugins/excel/xlsx-utils.c
index d71e2ee..374382b 100644
--- a/plugins/excel/xlsx-utils.c
+++ b/plugins/excel/xlsx-utils.c
@@ -222,7 +222,7 @@ xlsx_func_binominv_output_handler (GnmConventionsOut *out, GnmExprFunction const
                gnm_expr_as_gstring (ptr[2], out);
                g_string_append_c (out->accum, ',');
                gnm_expr_as_gstring (ptr[0], out);
-               g_string_append (out->accum, ")");
+               g_string_append_c (out->accum, ')');
                return TRUE;
        }
        return FALSE;
@@ -254,6 +254,21 @@ xlsx_func_finv_output_handler (GnmConventionsOut *out, GnmExprFunction const *fu
        return FALSE;
 }
 
+static gboolean
+xlsx_func_floor_output_handler (GnmConventionsOut *out, GnmExprFunction const *func)
+/* FLOOR(a) --> ROUNDDOWN(a,0) */
+{
+       if (func->argc == 1) {
+               GString *target = out->accum;
+               GnmExprConstPtr const *ptr = func->argv;
+               g_string_append (target, "ROUNDDOWN(");
+               gnm_expr_as_gstring (ptr[0], out);
+               g_string_append (out->accum, ",0)");
+               return TRUE;
+       }
+       return FALSE;
+}
+
 
 GnmConventions *
 xlsx_conventions_new (gboolean output)
@@ -273,6 +288,7 @@ xlsx_conventions_new (gboolean output)
                {"R.QBINOM", xlsx_func_binominv_output_handler},
                {"R.QCHISQ", xlsx_func_chisqinv_output_handler},
                {"R.QF", xlsx_func_finv_output_handler},
+               {"FLOOR", xlsx_func_floor_output_handler},
                {NULL, NULL}
        };
        


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