std::to_string is not good fpr serialising doubles

-- it uses fixed 6dp, xlsx wants 15sf
-- stringstream with precision set to 15 serialises correctly
This commit is contained in:
Crzyrndm 2018-06-24 14:29:56 +12:00
parent e8fcd49c0d
commit d12d2e450b

View File

@ -22,6 +22,7 @@
// @author: see AUTHORS file // @author: see AUTHORS file
#include <detail/header_footer/header_footer_code.hpp> #include <detail/header_footer/header_footer_code.hpp>
#include <sstream>
namespace xlnt { namespace xlnt {
namespace detail { 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()) if (run.second.get().has_size())
{ {
encoded.push_back('&'); 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()) if (run.second.get().has_color())