mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
Add serialisation of "topLeftCell" sheetView attribute
This commit is contained in:
parent
d2d0c2ab55
commit
e8fcd49c0d
|
@ -192,6 +192,30 @@ public:
|
||||||
return type_;
|
return type_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// has a top left cell?
|
||||||
|
/// </summary>
|
||||||
|
bool has_top_left_cell() const
|
||||||
|
{
|
||||||
|
return top_left_cell_.is_set();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the top left cell of this view.
|
||||||
|
/// </summary>
|
||||||
|
void top_left_cell(const cell_reference& ref)
|
||||||
|
{
|
||||||
|
top_left_cell_.set(ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the top left cell of this view.
|
||||||
|
/// </summary>
|
||||||
|
cell_reference top_left_cell() const
|
||||||
|
{
|
||||||
|
return top_left_cell_.get();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if this view is equal to rhs based on its id, grid lines setting,
|
/// Returns true if this view is equal to rhs based on its id, grid lines setting,
|
||||||
/// default grid color, pane, and selections.
|
/// default grid color, pane, and selections.
|
||||||
|
@ -202,7 +226,8 @@ public:
|
||||||
&& show_grid_lines_ == rhs.show_grid_lines_
|
&& show_grid_lines_ == rhs.show_grid_lines_
|
||||||
&& default_grid_color_ == rhs.default_grid_color_
|
&& default_grid_color_ == rhs.default_grid_color_
|
||||||
&& pane_ == rhs.pane_
|
&& pane_ == rhs.pane_
|
||||||
&& selections_ == rhs.selections_;
|
&& selections_ == rhs.selections_
|
||||||
|
&& top_left_cell_ == rhs.top_left_cell_;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -231,6 +256,11 @@ private:
|
||||||
/// </summary>
|
/// </summary>
|
||||||
optional<xlnt::pane> pane_;
|
optional<xlnt::pane> pane_;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The top left cell
|
||||||
|
/// </summary>
|
||||||
|
optional<cell_reference> top_left_cell_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The collection of selections
|
/// The collection of selections
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -465,6 +465,10 @@ std::string xlsx_consumer::read_worksheet_begin(const std::string &rel_id)
|
||||||
{
|
{
|
||||||
new_view.show_grid_lines(is_true(parser().attribute("showGridLines")));
|
new_view.show_grid_lines(is_true(parser().attribute("showGridLines")));
|
||||||
}
|
}
|
||||||
|
if (parser().attribute_present("topLeftCell"))
|
||||||
|
{
|
||||||
|
new_view.top_left_cell(cell_reference(parser().attribute("topLeftCell")));
|
||||||
|
}
|
||||||
|
|
||||||
if (parser().attribute_present("defaultGridColor")) // default="true"
|
if (parser().attribute_present("defaultGridColor")) // default="true"
|
||||||
{
|
{
|
||||||
|
|
|
@ -2298,13 +2298,17 @@ void xlsx_producer::write_worksheet(const relationship &rel)
|
||||||
write_attribute("tabSelected", write_bool(true));
|
write_attribute("tabSelected", write_bool(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
write_attribute("workbookViewId", view.id());
|
|
||||||
|
|
||||||
if (view.type() != sheet_view_type::normal)
|
if (view.type() != sheet_view_type::normal)
|
||||||
{
|
{
|
||||||
write_attribute("view", view.type() == sheet_view_type::page_break_preview
|
write_attribute("view", view.type() == sheet_view_type::page_break_preview
|
||||||
? "pageBreakPreview" : "pageLayout");
|
? "pageBreakPreview" : "pageLayout");
|
||||||
}
|
}
|
||||||
|
if (view.has_top_left_cell())
|
||||||
|
{
|
||||||
|
write_attribute("topLeftCell", view.top_left_cell().to_string());
|
||||||
|
}
|
||||||
|
|
||||||
|
write_attribute("workbookViewId", view.id());
|
||||||
|
|
||||||
if (view.has_pane())
|
if (view.has_pane())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user