From 976917d3f661f4c4080d5478dbb73fb1ef29b451 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 31 Dec 2020 22:19:13 -0800 Subject: [PATCH] pivot-table: Define numeric formats of categories as well as their cells. --- src/output/pivot-table.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/output/pivot-table.c b/src/output/pivot-table.c index c255ea83b0..6029224734 100644 --- a/src/output/pivot-table.c +++ b/src/output/pivot-table.c @@ -396,6 +396,13 @@ pivot_category_set_rc (struct pivot_category *category, const char *s) category->dimension->table, s); if (format) category->format = *format; + + /* Ensure that the category itself, in addition to the cells within it, takes + the format. (It's kind of rare for a category to have a numeric format + though.) */ + struct pivot_value *name = category->name; + if (name->type == PIVOT_VALUE_NUMERIC && !name->numeric.format.w) + name->numeric.format = format ? *format : *settings_get_format (); } static void -- 2.30.2