All unimplemented functions under cell/

This commit is contained in:
Crzyrndm 2018-07-02 10:29:58 +12:00
parent c0a90ccb7f
commit 49c4e725dc
4 changed files with 34 additions and 3 deletions

View File

@ -290,11 +290,11 @@ public:
/// </summary> /// </summary>
bool operator!=(const range &comparand) const; bool operator!=(const range &comparand) const;
private: private:
/// <summary> /// <summary>
/// The worksheet this range is within /// The worksheet this range is within
/// </summary> /// </summary>
worksheet ws_; class worksheet ws_;
/// <summary> /// <summary>
/// The reference of this range /// The reference of this range

View File

@ -434,6 +434,18 @@ void cell::hyperlink(xlnt::cell target)
value(cell_address); value(cell_address);
} }
void cell::hyperlink(xlnt::range target)
{
// TODO: should this computed value be a method on a cell?
const auto range_address = target.worksheet().title() + "!" + target.reference().to_string();
d_->hyperlink_ = detail::hyperlink_impl();
d_->hyperlink_.get().relationship = xlnt::relationship("", relationship_type::hyperlink,
uri(""), uri(range_address), target_mode::internal);
d_->hyperlink_.get().display = range_address;
value(range_address);
}
void cell::formula(const std::string &formula) void cell::formula(const std::string &formula)
{ {
if (formula.empty()) if (formula.empty())
@ -472,6 +484,15 @@ void cell::clear_formula()
} }
} }
std::string cell::error() const
{
if (d_->type_ != type::error)
{
throw xlnt::exception("called error() when cell type is not error");
}
return value<std::string>();
}
void cell::error(const std::string &error) void cell::error(const std::string &error)
{ {
if (error.length() == 0 || error[0] != '#') if (error.length() == 0 || error[0] != '#')
@ -743,6 +764,11 @@ calendar cell::base_date() const
return workbook().base_date(); return workbook().base_date();
} }
bool operator==(std::nullptr_t, const cell &cell)
{
return cell.data_type() == cell::type::empty;
}
XLNT_API std::ostream &operator<<(std::ostream &stream, const xlnt::cell &cell) XLNT_API std::ostream &operator<<(std::ostream &stream, const xlnt::cell &cell)
{ {
return stream << cell.to_string(); return stream << cell.to_string();

View File

@ -65,6 +65,11 @@ std::vector<rich_text_run> rich_text::runs() const
return runs_; return runs_;
} }
void rich_text::runs(const std::vector<rich_text_run> &new_runs)
{
runs_ = new_runs;
}
void rich_text::add_run(const rich_text_run &t) void rich_text::add_run(const rich_text_run &t)
{ {
runs_.push_back(t); runs_.push_back(t);

View File

@ -31,7 +31,7 @@
namespace xlnt { namespace xlnt {
range::range(worksheet ws, const range_reference &reference, major_order order, bool skip_null) range::range(class worksheet ws, const range_reference &reference, major_order order, bool skip_null)
: ws_(ws), : ws_(ws),
ref_(reference), ref_(reference),
order_(order), order_(order),