[gnumeric] xlsx: fix export of HYPGEOMDIST.



commit d62016ed32e52336b0d70617e760b76757e38bd0
Author: Morten Welinder <terra gnome org>
Date:   Tue Dec 16 13:44:14 2014 -0500

    xlsx: fix export of HYPGEOMDIST.
    
    HYPGEOM.DIST requires the cumulative flag argument.

 NEWS                       |    1 +
 plugins/excel/ChangeLog    |    5 +++++
 plugins/excel/xlsx-utils.c |   17 ++++++++++++++++-
 3 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index 9e9f30c..8a87274 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,7 @@ Morten:
        * Truncate long strings for display in stf import.
        * Fix crash on closing a graph sheet.
        * Fix undo crash with conditional formatting and insert row.  [#741197]
+       * Fix xlsx export of HYPGEOMDIST.
 
 Thomas Kluyver:
        * Fix import of extended floats from wk4 files.  [#739697]
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index f5b6fd5..2aef374 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-16  Morten Welinder  <terra gnome org>
+
+       * xlsx-utils.c (xlsx_func_hypgeomdist_output_handler): New handler
+       for HYPGEOMDIST.
+
 2014-11-01  Morten Welinder  <terra gnome org>
 
        * ms-escher.c (ms_escher_get_data): Plug leak.
diff --git a/plugins/excel/xlsx-utils.c b/plugins/excel/xlsx-utils.c
index c289151..15a543b 100644
--- a/plugins/excel/xlsx-utils.c
+++ b/plugins/excel/xlsx-utils.c
@@ -494,6 +494,20 @@ xlsx_func_erf_output_handler (GnmConventionsOut *out, GnmExprFunction const *fun
        return FALSE;
 }
 
+static gboolean
+xlsx_func_hypgeomdist_output_handler (GnmConventionsOut *out, GnmExprFunction const *func)
+{
+       /* The cumulative flag is not optional.  */
+       if (func->argc != 5) {
+               g_string_append (out->accum, "_xlfn.HYPGEOM.DIST");
+               gnm_expr_list_as_string (func->argc, func->argv, out);
+               g_string_insert (out->accum, out->accum->len - 1, ",FALSE");
+               return TRUE;
+       }
+       return FALSE;
+}
+
+
 static char const *
 xlsx_string_parser (char const *in, GString *target,
                   G_GNUC_UNUSED GnmConventions const *convs)
@@ -563,6 +577,7 @@ xlsx_conventions_new (gboolean output)
                {"R.QT", xlsx_func_tinv_output_handler},
                {"ERF", xlsx_func_erf_output_handler},
                {"FLOOR", xlsx_func_floor_output_handler},
+               {"HYPGEOMDIST", xlsx_func_hypgeomdist_output_handler},
                {NULL, NULL}
        };
 
@@ -588,7 +603,7 @@ xlsx_conventions_new (gboolean output)
                { "F.TEST", "FTEST" },
                { "GAMMA.DIST", "GAMMADIST" },
                { "GAMMA.INV", "GAMMAINV" },
-               { "HYPGEOM.DIST", "HYPGEOMDIST" },
+               { "HYPGEOM.DIST", "HYPGEOMDIST" },  /* see output handler */
                { "LOGNORM.INV", "LOGINV" },
                { "MODE.SNGL", "MODE" },
                { "NORM.DIST", "NORMDIST" },


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