From cc88c4829b757e60ce5c347a85fb560499d9793f Mon Sep 17 00:00:00 2001 From: Thomas Fussell Date: Sun, 7 Jul 2019 11:17:00 -0400 Subject: [PATCH] fix frozen first rows/columns for #369 --- source/detail/serialization/xlsx_consumer.cpp | 5 ++++- source/detail/serialization/xlsx_producer.cpp | 11 +++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/source/detail/serialization/xlsx_consumer.cpp b/source/detail/serialization/xlsx_consumer.cpp index aea033e6..18504ff1 100644 --- a/source/detail/serialization/xlsx_consumer.cpp +++ b/source/detail/serialization/xlsx_consumer.cpp @@ -552,7 +552,10 @@ std::string xlsx_consumer::read_worksheet_begin(const std::string &rel_id) current_selection.sqref(sqref); } - current_selection.pane(pane_corner::top_left); + if (parser().attribute_present("pane")) + { + current_selection.pane(parser().attribute("pane")); + } new_view.add_selection(current_selection); diff --git a/source/detail/serialization/xlsx_producer.cpp b/source/detail/serialization/xlsx_producer.cpp index 0bd2d569..66c4860c 100644 --- a/source/detail/serialization/xlsx_producer.cpp +++ b/source/detail/serialization/xlsx_producer.cpp @@ -2326,8 +2326,15 @@ void xlsx_producer::write_worksheet(const relationship &rel) write_attribute("topLeftCell", current_pane.top_left_cell.get().to_string()); } - write_attribute("xSplit", current_pane.x_split.index); - write_attribute("ySplit", current_pane.y_split); + if (current_pane.x_split + 1 == current_pane.top_left_cell.get().column()) + { + write_attribute("xSplit", current_pane.x_split.index); + } + + if (current_pane.y_split + 1 == current_pane.top_left_cell.get().row()) + { + write_attribute("ySplit", current_pane.y_split); + } if (current_pane.active_pane != pane_corner::top_left) {