serialisation of custom row format property added

This commit is contained in:
Crzyrndm 2018-06-23 22:29:57 +12:00
parent fe90c9d488
commit 3eb06bac0d
3 changed files with 29 additions and 6 deletions

View File

@ -54,6 +54,11 @@ public:
/// </summary>
bool hidden = false;
/// <summary>
/// True if row style should be applied
/// </summary>
optional<bool> custom_format;
/// <summary>
/// The index to the style used by all cells in this row
/// </summary>

View File

@ -659,7 +659,16 @@ void xlsx_consumer::read_worksheet_sheetdata()
row_properties.dy_descent = parser().attribute<double>(qn("x14ac", "dyDescent"));
}
skip_attributes({ "customFormat", "s", "customFont",
if (parser().attribute_present("s"))
{
row_properties.style.set(static_cast<std::size_t>(std::stoull(parser().attribute("s"))));
}
if (parser().attribute_present("customFormat"))
{
row_properties.custom_format.set(parser().attribute<bool>("customFormat"));
}
skip_attributes({ "customFont",
"outlineLevel", "collapsed", "thickTop", "thickBot",
"ph", "spans" });

View File

@ -2362,11 +2362,6 @@ void xlsx_producer::write_worksheet(const relationship &rel)
write_attribute("width", (props.width.get() * 7 + 5) / 7);
}
if (props.custom_width)
{
write_attribute("customWidth", write_bool(true));
}
if (props.style.is_set())
{
write_attribute("style", props.style.get());
@ -2377,6 +2372,11 @@ void xlsx_producer::write_worksheet(const relationship &rel)
write_attribute("hidden", write_bool(true));
}
if (props.custom_width)
{
write_attribute("customWidth", write_bool(true));
}
write_end_element(xmlns, "col");
}
@ -2440,6 +2440,15 @@ void xlsx_producer::write_worksheet(const relationship &rel)
{
const auto &props = ws.row_properties(row);
if (props.style.is_set())
{
write_attribute("s", props.style.get());
}
if (props.custom_format.is_set())
{
write_attribute("customFormat", write_bool(props.custom_format.get()));
}
if (props.height.is_set())
{
auto height = props.height.get();