mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
Parsing headerFotter block of test sheet correctly
This commit is contained in:
parent
d12d2e450b
commit
1c1d63498a
|
@ -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;
|
||||
|
|
|
@ -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('&');
|
||||
|
|
|
@ -29,8 +29,6 @@
|
|||
namespace xlnt {
|
||||
|
||||
font::font()
|
||||
: name_("Calibri"),
|
||||
size_(12.0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -155,9 +153,13 @@ 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
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user