Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions include/xlnt/worksheet/pane.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ enum class XLNT_API pane_corner

/// <summary>
/// A fixed portion of a worksheet.
/// Implements section 3.3.1.64 of ECMA 376 - Worksheet view pane
/// </summary>
struct XLNT_API pane
{
Expand All @@ -64,22 +65,22 @@ struct XLNT_API pane
/// <summary>
/// The state of the pane
/// </summary>
pane_state state = pane_state::split;
optional<pane_state> state = pane_state::split;

/// <summary>
/// The pane which contains the active cell
/// </summary>
pane_corner active_pane = pane_corner::top_left;
optional<pane_corner> active_pane = pane_corner::top_left;

/// <summary>
/// The row where the split should take place
/// </summary>
row_t y_split = 1;
optional<double> y_split = 0.0;

/// <summary>
/// The column where the split should take place
/// </summary>
column_t x_split = 1;
optional<double> x_split = 0.0;

/// <summary>
/// Returns true if this pane is equal to rhs based on its top-left cell, state,
Expand Down
24 changes: 15 additions & 9 deletions source/detail/serialization/xlsx_producer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down