mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
Merge pull request #382 from kostasdizas/issue374-format
Update the format elements when setting the cell style
This commit is contained in:
commit
b1a2f6d0bf
|
@ -846,6 +846,12 @@ void cell::clear_style()
|
|||
void cell::style(const class style &new_style)
|
||||
{
|
||||
auto new_format = has_format() ? format() : workbook().create_format();
|
||||
|
||||
new_format.border(new_style.border());
|
||||
new_format.fill(new_style.fill());
|
||||
new_format.font(new_style.font());
|
||||
new_format.number_format(new_style.number_format());
|
||||
|
||||
format(new_format.style(new_style));
|
||||
}
|
||||
|
||||
|
|
|
@ -51,12 +51,7 @@ struct stylesheet
|
|||
|
||||
impl.parent = this;
|
||||
impl.id = format_impls.size() - 1;
|
||||
|
||||
impl.border_id = 0;
|
||||
impl.fill_id = 0;
|
||||
impl.font_id = 0;
|
||||
impl.number_format_id = 0;
|
||||
|
||||
|
||||
impl.references = default_format ? 1 : 0;
|
||||
|
||||
return xlnt::format(&impl);
|
||||
|
|
|
@ -2339,7 +2339,7 @@ void xlsx_consumer::read_stylesheet()
|
|||
}
|
||||
record.first.border_id = parser().attribute_present("borderId")
|
||||
? parser().attribute<std::size_t>("borderId")
|
||||
: 0;
|
||||
: optional<std::size_t>();
|
||||
|
||||
if (parser().attribute_present("applyFill"))
|
||||
{
|
||||
|
@ -2347,7 +2347,7 @@ void xlsx_consumer::read_stylesheet()
|
|||
}
|
||||
record.first.fill_id = parser().attribute_present("fillId")
|
||||
? parser().attribute<std::size_t>("fillId")
|
||||
: 0;
|
||||
: optional<std::size_t>();
|
||||
|
||||
if (parser().attribute_present("applyFont"))
|
||||
{
|
||||
|
@ -2355,7 +2355,7 @@ void xlsx_consumer::read_stylesheet()
|
|||
}
|
||||
record.first.font_id = parser().attribute_present("fontId")
|
||||
? parser().attribute<std::size_t>("fontId")
|
||||
: 0;
|
||||
: optional<std::size_t>();
|
||||
|
||||
if (parser().attribute_present("applyNumberFormat"))
|
||||
{
|
||||
|
@ -2363,7 +2363,7 @@ void xlsx_consumer::read_stylesheet()
|
|||
}
|
||||
record.first.number_format_id = parser().attribute_present("numFmtId")
|
||||
? parser().attribute<std::size_t>("numFmtId")
|
||||
: 0;
|
||||
: optional<std::size_t>();
|
||||
|
||||
auto apply_alignment_present = parser().attribute_present("applyAlignment");
|
||||
if (apply_alignment_present)
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user