mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
Add "bestFit" column attribute serialisation
This commit is contained in:
parent
4cfb74443c
commit
d81555dbae
|
@ -51,6 +51,12 @@ public:
|
||||||
/// </summary>
|
/// </summary>
|
||||||
optional<std::size_t> style;
|
optional<std::size_t> style;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Is this column sized to fit its content as best it can
|
||||||
|
/// serialise if true
|
||||||
|
/// </summary>
|
||||||
|
bool best_fit = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If true, this column will be hidden
|
/// If true, this column will be hidden
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -588,6 +588,9 @@ std::string xlsx_consumer::read_worksheet_begin(const std::string &rel_id)
|
||||||
? is_true(parser().attribute("customWidth")) : false;
|
? is_true(parser().attribute("customWidth")) : false;
|
||||||
auto hidden = parser().attribute_present("hidden")
|
auto hidden = parser().attribute_present("hidden")
|
||||||
? is_true(parser().attribute("hidden")) : false;
|
? is_true(parser().attribute("hidden")) : false;
|
||||||
|
auto best_fit = parser().attribute_present("bestFit")
|
||||||
|
? is_true(parser().attribute("bestFit"))
|
||||||
|
: false;
|
||||||
|
|
||||||
expect_end_element(qn("spreadsheetml", "col"));
|
expect_end_element(qn("spreadsheetml", "col"));
|
||||||
|
|
||||||
|
@ -607,6 +610,7 @@ std::string xlsx_consumer::read_worksheet_begin(const std::string &rel_id)
|
||||||
|
|
||||||
props.hidden = hidden;
|
props.hidden = hidden;
|
||||||
props.custom_width = custom;
|
props.custom_width = custom;
|
||||||
|
props.best_fit = best_fit;
|
||||||
ws.add_column_properties(column, props);
|
ws.add_column_properties(column, props);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2362,6 +2362,11 @@ void xlsx_producer::write_worksheet(const relationship &rel)
|
||||||
write_attribute("width", (props.width.get() * 7 + 5) / 7);
|
write_attribute("width", (props.width.get() * 7 + 5) / 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (props.best_fit)
|
||||||
|
{
|
||||||
|
write_attribute("bestFit", write_bool(true));
|
||||||
|
}
|
||||||
|
|
||||||
if (props.style.is_set())
|
if (props.style.is_set())
|
||||||
{
|
{
|
||||||
write_attribute("style", props.style.get());
|
write_attribute("style", props.style.get());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user