Parsing headerFotter block of test sheet correctly

This commit is contained in:
Crzyrndm 2018-06-24 17:31:05 +12:00
parent d12d2e450b
commit 1c1d63498a
3 changed files with 31 additions and 5 deletions

View File

@ -242,7 +242,10 @@ public:
/// <summary>
/// Returns true if left is not exactly equal to right.
/// </summary>
bool operator!=(const font &other) const;
bool operator!=(const font &other) const
{
return !operator==(other);
}
private:
friend class style;

View File

@ -360,6 +360,11 @@ std::array<xlnt::optional<xlnt::rich_text>, 3> decode_header_footer(const std::s
case hf_code::text_single_underline:
{
if (!current_run.second.is_set())
{
current_run.second = xlnt::font();
}
current_run.second.get().underline(font::underline_style::single);
break;
}
@ -533,7 +538,23 @@ std::string encode_header_footer(const rich_text &t, header_footer::location whe
ss << run.second.get().size();
encoded.append(ss.str());
}
if (run.second.get().underlined())
{
switch (run.second.get().underline())
{
case font::underline_style::single:
case font::underline_style::single_accounting:
encoded.append("&U");
break;
case font::underline_style::double_:
case font::underline_style::double_accounting:
encoded.append("&E");
break;
default:
case font::underline_style::none:
break;
}
}
if (run.second.get().has_color())
{
encoded.push_back('&');

View File

@ -29,8 +29,6 @@
namespace xlnt {
font::font()
: name_("Calibri"),
size_(12.0)
{
}
@ -156,7 +154,11 @@ font &font::name(const std::string &name)
std::string font::name() const
{
if (name_.is_set())
{
return name_.get();
}
return "Calibri";
}
bool font::has_color() const