diff --git a/include/xlnt/worksheet/pane.hpp b/include/xlnt/worksheet/pane.hpp index 60f0c650d..f1e259420 100644 --- a/include/xlnt/worksheet/pane.hpp +++ b/include/xlnt/worksheet/pane.hpp @@ -53,6 +53,7 @@ enum class XLNT_API pane_corner /// /// A fixed portion of a worksheet. +/// Implements section 3.3.1.64 of ECMA 376 - Worksheet view pane /// struct XLNT_API pane { @@ -64,22 +65,22 @@ struct XLNT_API pane /// /// The state of the pane /// - pane_state state = pane_state::split; + optional state = pane_state::split; /// /// The pane which contains the active cell /// - pane_corner active_pane = pane_corner::top_left; + optional active_pane = pane_corner::top_left; /// /// The row where the split should take place /// - row_t y_split = 1; + optional y_split = 0.0; /// /// The column where the split should take place /// - column_t x_split = 1; + optional x_split = 0.0; /// /// Returns true if this pane is equal to rhs based on its top-left cell, state, diff --git a/source/detail/serialization/xlsx_producer.cpp b/source/detail/serialization/xlsx_producer.cpp index 6f6e26ccc..35cdb8736 100644 --- a/source/detail/serialization/xlsx_producer.cpp +++ b/source/detail/serialization/xlsx_producer.cpp @@ -2399,25 +2399,31 @@ void xlsx_producer::write_worksheet(const relationship &rel) { write_attribute("topLeftCell", current_pane.top_left_cell.get().to_string()); } - - if (current_pane.x_split + 1 == current_pane.top_left_cell.get().column()) + + if (current_pane.x_split.is_set()) { - write_attribute("xSplit", current_pane.x_split.index); + write_attribute("xSplit", current_pane.x_split.get()); } - if (current_pane.y_split + 1 == current_pane.top_left_cell.get().row()) + if (current_pane.x_split.is_set()) { - write_attribute("ySplit", current_pane.y_split); + write_attribute("ySplit", current_pane.y_split.get()); } - if (current_pane.active_pane != pane_corner::top_left) + if (current_pane.active_pane.is_set()) { - write_attribute("activePane", current_pane.active_pane); + if (current_pane.active_pane.get() != pane_corner::top_left) + { + write_attribute("activePane", current_pane.active_pane.get()); + } } - if (current_pane.state != pane_state::split) + if (current_pane.state.is_set()) { - write_attribute("state", current_pane.state); + if (current_pane.state.get() != pane_state::split) + { + write_attribute("state", current_pane.state.get()); + } } write_end_element(xmlns, "pane");