From d12d2e450b5552327a854cedd82ed1c2257eb2ad Mon Sep 17 00:00:00 2001 From: Crzyrndm Date: Sun, 24 Jun 2018 14:29:56 +1200 Subject: [PATCH] std::to_string is not good fpr serialising doubles -- it uses fixed 6dp, xlsx wants 15sf -- stringstream with precision set to 15 serialises correctly --- source/detail/header_footer/header_footer_code.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/detail/header_footer/header_footer_code.cpp b/source/detail/header_footer/header_footer_code.cpp index 725ec09a..6479cd42 100644 --- a/source/detail/header_footer/header_footer_code.cpp +++ b/source/detail/header_footer/header_footer_code.cpp @@ -22,6 +22,7 @@ // @author: see AUTHORS file #include +#include namespace xlnt { namespace detail { @@ -527,7 +528,10 @@ std::string encode_header_footer(const rich_text &t, header_footer::location whe if (run.second.get().has_size()) { encoded.push_back('&'); - encoded.append(std::to_string(run.second.get().size())); + std::stringstream ss; + ss.precision(15); + ss << run.second.get().size(); + encoded.append(ss.str()); } if (run.second.get().has_color())