Update pane struct to match spec

Fixes #388
This commit is contained in:
snippet 2022-11-22 17:54:43 +11:00
parent f0801fb7c7
commit e61f807dfd
2 changed files with 20 additions and 13 deletions

View File

@ -53,6 +53,7 @@ enum class XLNT_API pane_corner
/// <summary> /// <summary>
/// A fixed portion of a worksheet. /// A fixed portion of a worksheet.
/// Implements section 3.3.1.64 of ECMA 376 - Worksheet view pane
/// </summary> /// </summary>
struct XLNT_API pane struct XLNT_API pane
{ {
@ -64,22 +65,22 @@ struct XLNT_API pane
/// <summary> /// <summary>
/// The state of the pane /// The state of the pane
/// </summary> /// </summary>
pane_state state = pane_state::split; optional<pane_state> state = pane_state::split;
/// <summary> /// <summary>
/// The pane which contains the active cell /// The pane which contains the active cell
/// </summary> /// </summary>
pane_corner active_pane = pane_corner::top_left; optional<pane_corner> active_pane = pane_corner::top_left;
/// <summary> /// <summary>
/// The row where the split should take place /// The row where the split should take place
/// </summary> /// </summary>
row_t y_split = 1; optional<double> y_split = 0.0;
/// <summary> /// <summary>
/// The column where the split should take place /// The column where the split should take place
/// </summary> /// </summary>
column_t x_split = 1; optional<double> x_split = 0.0;
/// <summary> /// <summary>
/// Returns true if this pane is equal to rhs based on its top-left cell, state, /// Returns true if this pane is equal to rhs based on its top-left cell, state,

View File

@ -2400,24 +2400,30 @@ void xlsx_producer::write_worksheet(const relationship &rel)
write_attribute("topLeftCell", current_pane.top_left_cell.get().to_string()); 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"); write_end_element(xmlns, "pane");