void test_comment() { xlnt::workbook wb; auto ws = wb.active_sheet(); auto cell = ws.cell("A1"); xlnt_assert(!cell.has_comment()); xlnt_assert_throws(cell.comment(), xlnt::exception); cell.comment(xlnt::comment("comment", "author")); xlnt_assert(cell.has_comment()); xlnt_assert_equals(cell.comment(), xlnt::comment("comment", "author")); cell.clear_comment(); xlnt_assert(!cell.has_comment()); xlnt_assert_throws(cell.comment(), xlnt::exception); }
void cell::clear_comment() { if (has_comment()) { get_parent().decrement_comments(); } d_->comment_ = nullptr; }
void cell::set_comment(const xlnt::comment &c) { if (c.d_ != d_->comment_.get()) { throw xlnt::attribute_error(); } if (!has_comment()) { get_parent().increment_comments(); } *get_comment().d_ = *c.d_; }
bool cell::garbage_collectible() const { return !(get_data_type() != type::null || is_merged() || has_comment() || has_formula() || has_style()); }