Skip to content

Commit

Permalink
worksheet: Add method to check if the worksheet is empty
Browse files Browse the repository at this point in the history
A worksheet is considered empty if it doesn't have any cells.
  • Loading branch information
emmanuel099 committed Dec 2, 2020
1 parent 3c7122a commit 9df7c83
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/xlnt/worksheet/worksheet.hpp
Expand Up @@ -770,6 +770,12 @@ class XLNT_API worksheet
/// </summary>
bool has_drawing() const;

/// <summary>
/// Returns true if this worksheet is empty.
/// A worksheet is considered empty if it doesn't have any cells.
/// </summary>
bool is_empty() const;

private:
friend class cell;
friend class const_range_iterator;
Expand Down
5 changes: 5 additions & 0 deletions source/worksheet/worksheet.cpp
Expand Up @@ -1335,4 +1335,9 @@ bool worksheet::has_drawing() const
return d_->drawing_.is_set();
}

bool worksheet::is_empty() const
{
return d_->cell_map_.empty();
}

} // namespace xlnt

0 comments on commit 9df7c83

Please sign in to comment.