Importing row spans in the row_properties object

This commit is contained in:
Kostas Dizas 2018-10-19 20:48:54 +01:00
parent db5abec894
commit 3ab49c8af6
2 changed files with 19 additions and 3 deletions

View File

@ -63,6 +63,13 @@ public:
/// The index to the style used by all cells in this row /// The index to the style used by all cells in this row
/// </summary> /// </summary>
optional<std::size_t> style; optional<std::size_t> style;
/// <summary>
/// The row column span, used as part of the row block optimisation.
/// This used for loading this attribute from existing excel files mainly for inspecting
/// and not used when saving, it is calculated in the xlsx_producer.
/// </summary>
optional<std::string> spans;
}; };
inline bool operator==(const row_properties &lhs, const row_properties &rhs) inline bool operator==(const row_properties &lhs, const row_properties &rhs)
@ -72,7 +79,8 @@ inline bool operator==(const row_properties &lhs, const row_properties &rhs)
&& lhs.custom_height == rhs.custom_height && lhs.custom_height == rhs.custom_height
&& lhs.hidden == rhs.hidden && lhs.hidden == rhs.hidden
&& lhs.custom_format == rhs.custom_format && lhs.custom_format == rhs.custom_format
&& lhs.style == rhs.style; && lhs.style == rhs.style
&& lhs.spans == rhs.spans;
} }
} // namespace xlnt } // namespace xlnt

View File

@ -221,9 +221,13 @@ cell xlsx_consumer::read_cell()
row_properties.dy_descent = parser().attribute<double>(qn("x14ac", "dyDescent")); row_properties.dy_descent = parser().attribute<double>(qn("x14ac", "dyDescent"));
} }
if (parser().attribute_present("spans")) {
row_properties.spans = parser().attribute("spans");
}
skip_attributes({"customFormat", "s", "customFont", skip_attributes({"customFormat", "s", "customFont",
"outlineLevel", "collapsed", "thickTop", "thickBot", "outlineLevel", "collapsed", "thickTop", "thickBot",
"ph", "spans"}); "ph"});
} }
if (!in_element(qn("spreadsheetml", "row"))) if (!in_element(qn("spreadsheetml", "row")))
@ -713,9 +717,13 @@ void xlsx_consumer::read_worksheet_sheetdata()
row_properties.custom_format.set(parser().attribute<bool>("customFormat")); row_properties.custom_format.set(parser().attribute<bool>("customFormat"));
} }
if (parser().attribute_present("spans")) {
row_properties.spans = parser().attribute("spans");
}
skip_attributes({"customFont", skip_attributes({"customFont",
"outlineLevel", "collapsed", "thickTop", "thickBot", "outlineLevel", "collapsed", "thickTop", "thickBot",
"ph", "spans"}); "ph"});
while (in_element(qn("spreadsheetml", "row"))) while (in_element(qn("spreadsheetml", "row")))
{ {