diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index 2e0d694..0d785a8 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -7376,9 +7376,10 @@ go_format_locale_currency (void)
 
 #ifdef DEFINE_COMMON
 char *
-go_format_odf_style_map (GOFormat const *fmt, int cond_part)
+go_format_odf_style_map (GOFormat const *fmt, int cond_part, int digits)
 {
 	char const *format_string = NULL;
+	GString *gstr;
 
 	g_return_val_if_fail (fmt != NULL, NULL);
 	g_return_val_if_fail (fmt->typ == GO_FMT_COND, NULL);
@@ -7388,31 +7389,35 @@ go_format_odf_style_map (GOFormat const *fmt, int cond_part)
 
 	switch (fmt->u.cond.conditions[cond_part].op) {
 	case GO_FMT_COND_EQ:
-		format_string = "value()=%g";
+		format_string = "value()=";
 		break;
 	case GO_FMT_COND_NE:
-		format_string = "value()!=%g";
+		format_string = "value()!=";
 		break;
 	case GO_FMT_COND_NONTEXT: /* Under certain circumstances this */
                                   /*appears for second of two conditions */
 	case GO_FMT_COND_LT:
-		format_string = "value()<%g";
+		format_string = "value()<";
 		break;
 	case GO_FMT_COND_LE:
-		format_string = "value()<=%g";
+		format_string = "value()<=";
 		break;
 	case GO_FMT_COND_GT:
-		format_string = "value()>%g";
+		format_string = "value()>";
 		break;
 	case GO_FMT_COND_GE:
-		format_string = "value()>=%g";
+		format_string = "value()>=";
 		break;
 	default:
 		return NULL;
 	}
-	return g_strdup_printf (format_string,
+	
+	gstr = g_string_new (format_string);
+	g_string_append_printf (gstr, "%.*g",
+				digits,
 				fmt->u.cond.conditions[cond_part].val);
 
+	return g_string_free (gstr, FALSE);
 }
 #endif
 
diff --git a/goffice/utils/go-format.h b/goffice/utils/go-format.h
index 61b9751..9576ca9 100644
--- a/goffice/utils/go-format.h
+++ b/goffice/utils/go-format.h
@@ -264,7 +264,7 @@ GOFormat *go_format_toggle_1000sep	(GOFormat const *fmt);
 
 /******************* GOFormat ODF Support ********************************/
 
-char *go_format_odf_style_map (GOFormat const *fmt, int cond_part);
+char *go_format_odf_style_map (GOFormat const *fmt, int cond_part, int digits);
 gboolean go_format_output_to_odf (GsfXMLOut *xout, GOFormat const *fmt,
 				  int cond_part, char const *name,
 				  gboolean with_extension);
