Example #1
0
 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);
 }
Example #2
0
void cell::clear_comment()
{
    if (has_comment())
    {
        get_parent().decrement_comments();
    }

    d_->comment_ = nullptr;
}
Example #3
0
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_;
}
Example #4
0
bool cell::garbage_collectible() const
{
    return !(get_data_type() != type::null || is_merged() || has_comment() || has_formula() || has_style());
}