mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
add placeholder api comments for #28
This commit is contained in:
parent
846ea8e0d6
commit
340a4b3195
|
@ -21,15 +21,16 @@
|
|||
//
|
||||
// @license: http://www.opensource.org/licenses/mit-license.php
|
||||
// @author: see AUTHORS file
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <xlnt/xlnt_config.hpp> // for XLNT_API, XLNT_API
|
||||
#include <xlnt/cell/cell_type.hpp> // for cell_type
|
||||
#include <xlnt/cell/index_types.hpp> // for column_t, row_t
|
||||
#include <xlnt/xlnt_config.hpp>
|
||||
#include <xlnt/cell/cell_type.hpp>
|
||||
#include <xlnt/cell/index_types.hpp>
|
||||
|
||||
namespace xlnt {
|
||||
|
||||
|
@ -60,6 +61,7 @@ namespace detail {
|
|||
|
||||
class xlsx_consumer;
|
||||
class xlsx_producer;
|
||||
|
||||
struct cell_impl;
|
||||
|
||||
} // namespace detail
|
||||
|
@ -76,6 +78,9 @@ struct cell_impl;
|
|||
class XLNT_API cell
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
/// Alias xlnt::cell_type to xlnt::cell::type since it looks nicer.
|
||||
/// </summary>
|
||||
using type = cell_type;
|
||||
|
||||
/// <summary>
|
||||
|
@ -83,6 +88,9 @@ public:
|
|||
/// </summary>
|
||||
static const std::unordered_map<std::string, int> &error_codes();
|
||||
|
||||
/// <summary>
|
||||
/// Default copy constructor.
|
||||
/// </summary>
|
||||
cell(const cell &) = default;
|
||||
|
||||
// value
|
||||
|
@ -506,6 +514,9 @@ private:
|
|||
/// </summary>
|
||||
class format modifiable_format();
|
||||
|
||||
/// <summary>
|
||||
/// Delete default zero-argument constructor.
|
||||
/// </summary>
|
||||
cell() = delete;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -91,7 +91,7 @@ public:
|
|||
/// </summary>
|
||||
cell_reference(column_t column, row_t row);
|
||||
|
||||
// absoluateness
|
||||
// absoluteness
|
||||
|
||||
/// <summary>
|
||||
/// Convert a coordinate to an absolute coordinate string (e.g. B12 -> $B$12)
|
||||
|
|
|
@ -65,22 +65,49 @@ public:
|
|||
/// </summary>
|
||||
std::string author() const;
|
||||
|
||||
/// <summary>
|
||||
/// Make this comment only visible when the associated cell is hovered.
|
||||
/// </summary>
|
||||
void hide();
|
||||
|
||||
/// <summary>
|
||||
/// Make this comment always visible.
|
||||
/// </summary>
|
||||
void show();
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this comment is not hidden.
|
||||
/// </summary>
|
||||
bool visible() const;
|
||||
|
||||
/// <summary>
|
||||
/// Set the absolute position of this cell to the given coordinates.
|
||||
/// </summary>
|
||||
void position(int left, int top);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the distance from the left side of the sheet to the left side of the comment.
|
||||
/// </summary>
|
||||
int left() const;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the distance from the top of the sheet to the top of the comment.
|
||||
/// </summary>
|
||||
int top() const;
|
||||
|
||||
/// <summary>
|
||||
/// Set the size of the comment.
|
||||
/// </summary>
|
||||
void size(int width, int height);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the width of this comment.
|
||||
/// </summary>
|
||||
int width() const;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the height of this comment.
|
||||
/// </summary>
|
||||
int height() const;
|
||||
|
||||
/// <summary>
|
||||
|
@ -89,16 +116,44 @@ public:
|
|||
friend XLNT_API bool operator==(const comment &left, const comment &right);
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
/// The formatted textual content in this cell displayed directly after the author.
|
||||
/// </summary>
|
||||
formatted_text text_;
|
||||
|
||||
/// <summary>
|
||||
/// The name of the person that created this comment.
|
||||
/// </summary>
|
||||
std::string author_;
|
||||
|
||||
/// <summary>
|
||||
/// True if this comment is not hidden.
|
||||
/// </summary>
|
||||
bool visible_ = false;
|
||||
|
||||
/// <summary>
|
||||
/// The fill color
|
||||
/// </summary>
|
||||
std::string fill_;
|
||||
|
||||
/// <summary>
|
||||
/// Distance from the left side of the sheet.
|
||||
/// </summary>
|
||||
int left_ = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Distance from the top of the sheet.
|
||||
/// </summary>
|
||||
int top_ = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Width of the comment box.
|
||||
/// </summary>
|
||||
int width_ = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Height of the comment box.
|
||||
/// </summary>
|
||||
int height_ = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -30,21 +30,53 @@
|
|||
|
||||
namespace xlnt {
|
||||
|
||||
/// <summary>
|
||||
/// Encapsulates zero or more formatted text runs where a text run
|
||||
/// is a string of text with the same defined formatting.
|
||||
/// </summary>
|
||||
class XLNT_API formatted_text
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
/// Remove all text runs from this text.
|
||||
/// </summary>
|
||||
void clear();
|
||||
|
||||
/// <summary>
|
||||
/// Clear any runs in this text and add a single run with default formatting and
|
||||
/// the given string as its textual content.
|
||||
/// </summary>
|
||||
void plain_text(const std::string &s);
|
||||
|
||||
/// <summary>
|
||||
/// Combine the textual content of each text run in order and return the result.
|
||||
/// </summary>
|
||||
std::string plain_text() const;
|
||||
|
||||
/// <summary>
|
||||
/// Returns a copy of the individual runs that comprise this text.
|
||||
/// </summary>
|
||||
std::vector<text_run> runs() const;
|
||||
void runs(const std::vector<text_run> &new_runs);
|
||||
void add_run(const text_run &t);
|
||||
|
||||
/// <summary>
|
||||
/// Set the runs of this text all at once.
|
||||
/// </summary>
|
||||
void runs(const std::vector<text_run> &new_runs);
|
||||
|
||||
/// <summary>
|
||||
/// Add a new run to the end of the set of runs.
|
||||
/// </summary>
|
||||
void add_run(const text_run &t);
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the runs that make up this text are identical to those in rhs.
|
||||
/// </summary>
|
||||
bool operator==(const formatted_text &rhs) const;
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::vector<text_run> runs_;
|
||||
};
|
||||
|
||||
|
|
|
@ -30,49 +30,163 @@
|
|||
|
||||
namespace xlnt {
|
||||
|
||||
//todo: should this just be a struct?
|
||||
|
||||
/// <summary>
|
||||
/// A formatted string
|
||||
/// </summary>
|
||||
class XLNT_API text_run
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
text_run();
|
||||
text_run(const std::string &string);
|
||||
|
||||
bool has_formatting() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
text_run(const std::string &string);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_formatting() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string get_string() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_string(const std::string &string);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_size() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t get_size() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_size(std::size_t size);
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_color() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
color get_color() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_color(const color &new_color);
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_font() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string get_font() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_font(const std::string &font);
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_family() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t get_family() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_family(std::size_t family);
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_scheme() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string get_scheme() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_scheme(const std::string &scheme);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool bold_set() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool is_bold() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_bold(bool bold);
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string string_;
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<std::size_t> size_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<color> color_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<std::string> font_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<std::size_t> family_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<std::string> scheme_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<bool> bold_;
|
||||
};
|
||||
|
||||
|
|
|
@ -169,12 +169,24 @@ public:
|
|||
void unregister_override_type(const path &part);
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string next_relationship_id(const path &part) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::unordered_map<std::string, std::string> default_content_types_;
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::unordered_map<path, std::string> override_content_types_;
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::unordered_map<path, std::unordered_map<std::string, relationship>> relationships_;
|
||||
};
|
||||
|
||||
|
|
|
@ -102,8 +102,14 @@ class XLNT_API relationship
|
|||
public:
|
||||
using type = relationship_type;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
relationship();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
relationship(const std::string &id, type t, const uri &source, const uri &target, target_mode mode);
|
||||
|
||||
/// <summary>
|
||||
|
@ -142,10 +148,29 @@ public:
|
|||
bool operator!=(const relationship &rhs) const;
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string id_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
type type_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
uri source_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
uri target_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
target_mode mode_;
|
||||
};
|
||||
|
||||
|
|
|
@ -35,49 +35,190 @@ namespace xlnt {
|
|||
class XLNT_API uri
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
uri();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
uri(const uri &base, const uri &relative);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
uri(const uri &base, const path &relative);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
uri(const std::string &uri_string);
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool is_relative() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool is_absolute() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string get_scheme() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string get_authority() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_authentication() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string get_authentication() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string get_username() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string get_password() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string get_host() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_port() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t get_port() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
path get_path() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_query() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string get_query() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_fragment() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string get_fragment() const;
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string to_string() const;
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
uri make_absolute(const uri &base);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
uri make_reference(const uri &base);
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
friend XLNT_API bool operator==(const uri &left, const uri &right);
|
||||
|
||||
private:
|
||||
bool absolute_;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool absolute_ = false;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string scheme_;
|
||||
bool has_authentication_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_authentication_ = false;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string username_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string password_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string host_;
|
||||
bool has_port_;
|
||||
std::size_t port_;
|
||||
bool has_query_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_port_ = false;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t port_ = 0;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_query_ = false;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string query_;
|
||||
bool has_fragment_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_fragment_ = false;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string fragment_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
path path_;
|
||||
};
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <xlnt/xlnt_config.hpp>
|
||||
#include <xlnt/utils/hash_combine.hpp>
|
||||
#include <xlnt/styles/horizontal_alignment.hpp>
|
||||
#include <xlnt/styles/vertical_alignment.hpp>
|
||||
#include <xlnt/utils/optional.hpp>
|
||||
|
@ -37,28 +36,64 @@ namespace xlnt {
|
|||
class XLNT_API alignment
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<bool> shrink() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
alignment &shrink(bool shrink_to_fit);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<bool> wrap() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
alignment &wrap(bool wrap_text);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<int> indent() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
alignment &indent(int indent_size);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<int> rotation() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
alignment &rotation(int text_rotation);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<horizontal_alignment> horizontal() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
alignment &horizontal(horizontal_alignment horizontal);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<vertical_alignment> vertical() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
alignment &vertical(vertical_alignment vertical);
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -32,11 +32,13 @@
|
|||
#include <xlnt/styles/border_style.hpp>
|
||||
#include <xlnt/styles/color.hpp>
|
||||
#include <xlnt/styles/diagonal_direction.hpp>
|
||||
#include <xlnt/styles/side.hpp>
|
||||
#include <xlnt/utils/optional.hpp>
|
||||
|
||||
namespace xlnt {
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
enum class XLNT_API border_side
|
||||
{
|
||||
start,
|
||||
|
@ -58,13 +60,30 @@ namespace xlnt {
|
|||
class XLNT_API border
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
class XLNT_API border_property
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<class color> color() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
border_property &color(const xlnt::color &c);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<border_style> style() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
border_property &style(border_style style);
|
||||
|
||||
/// <summary>
|
||||
|
@ -78,40 +97,98 @@ public:
|
|||
friend bool operator!=(const border_property &left, const border_property &right) { return !(left == right); }
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<class color> color_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<border_style> style_;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const std::vector<border_side> &all_sides();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
border();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<border_property> side(border_side s) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
border &side(border_side s, const border_property &prop);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<diagonal_direction> diagonal() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
border &diagonal(diagonal_direction dir);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if left is exactly equal to right.
|
||||
/// </summary>
|
||||
XLNT_API friend bool operator==(const border &left, const border &right);
|
||||
|
||||
XLNT_API friend bool operator==(const border &left, const border &right);
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if left is not exactly equal to right.
|
||||
/// </summary>
|
||||
XLNT_API friend bool operator!=(const border &left, const border &right) { return !(left == right); }
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<border_property> start_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<border_property> end_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<border_property> top_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<border_property> bottom_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<border_property> vertical_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<border_property> horizontal_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<border_property> diagonal_;
|
||||
|
||||
//bool outline_ = true;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<diagonal_direction> diagonal_direction_;
|
||||
};
|
||||
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
|
||||
namespace xlnt {
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
enum class XLNT_API border_style
|
||||
{
|
||||
none,
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
|
||||
namespace xlnt {
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
class XLNT_API indexed_color
|
||||
{
|
||||
public:
|
||||
|
@ -43,6 +46,9 @@ private:
|
|||
std::size_t index_;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
class XLNT_API theme_color
|
||||
{
|
||||
public:
|
||||
|
@ -56,6 +62,9 @@ private:
|
|||
std::size_t index_;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
class XLNT_API rgb_color
|
||||
{
|
||||
public:
|
||||
|
@ -100,48 +109,155 @@ public:
|
|||
auto_
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const color black();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const color white();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const color red();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const color darkred();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const color blue();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const color darkblue();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const color green();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const color darkgreen();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const color yellow();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const color darkyellow();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
color();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
color(const rgb_color &rgb);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
color(const indexed_color &indexed);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
color(const theme_color &theme);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
type get_type() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool is_auto() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_auto(bool value);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const rgb_color &get_rgb() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const indexed_color &get_indexed() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const theme_color &get_theme() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
double get_tint() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_tint(double tint);
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator==(const color &other) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator!=(const color &other) const { return !(*this == other); }
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void assert_type(type t) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
type type_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
rgb_color rgb_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
indexed_color indexed_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
theme_color theme_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
double tint_;
|
||||
};
|
||||
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
|
||||
namespace xlnt {
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
enum class XLNT_API pattern_fill_type
|
||||
{
|
||||
none,
|
||||
|
@ -54,21 +57,45 @@ enum class XLNT_API pattern_fill_type
|
|||
gray0625
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
class XLNT_API pattern_fill
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
pattern_fill();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
pattern_fill_type type() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
pattern_fill &type(pattern_fill_type new_type);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<color> foreground() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
pattern_fill &foreground(const color &foreground);
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<color> background() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
pattern_fill &background(const color &background);
|
||||
|
||||
/// <summary>
|
||||
|
@ -82,64 +109,129 @@ public:
|
|||
XLNT_API friend bool operator!=(const pattern_fill &left, const pattern_fill &right) { return !(left == right); }
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
pattern_fill_type type_ = pattern_fill_type::none;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<color> foreground_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<color> background_;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
enum class XLNT_API gradient_fill_type
|
||||
{
|
||||
linear,
|
||||
path
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
class XLNT_API gradient_fill
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
gradient_fill();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
gradient_fill_type type() const;
|
||||
|
||||
// Type
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
gradient_fill &type(gradient_fill_type new_type);
|
||||
|
||||
// Degree
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
gradient_fill °ree(double degree);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
double degree() const;
|
||||
|
||||
// Left
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
double left() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
gradient_fill &left(double value);
|
||||
|
||||
// Right
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
double right() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
gradient_fill &right(double value);
|
||||
|
||||
// Top
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
double top() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
gradient_fill &top(double value);
|
||||
|
||||
// Bottom
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
double bottom() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
gradient_fill &bottom(double value);
|
||||
|
||||
// Stops
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
gradient_fill &add_stop(double position, color stop_color);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
gradient_fill &clear_stops();
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::unordered_map<double, color> stops() const;
|
||||
|
||||
/// <summary>
|
||||
|
@ -153,18 +245,45 @@ public:
|
|||
XLNT_API friend bool operator!=(const gradient_fill &left, const gradient_fill &right) { return !(left == right); }
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
gradient_fill_type type_ = gradient_fill_type::linear;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
double degree_ = 0;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
double left_ = 0;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
double right_ = 0;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
double top_ = 0;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
double bottom_ = 0;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::unordered_map<double, color> stops_;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
enum class XLNT_API fill_type
|
||||
{
|
||||
pattern,
|
||||
|
@ -229,8 +348,19 @@ public:
|
|||
XLNT_API friend bool operator!=(const fill &left, const fill &right) { return !(left == right); }
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
fill_type type_ = fill_type::pattern;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
xlnt::gradient_fill gradient_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
xlnt::pattern_fill pattern_;
|
||||
};
|
||||
|
||||
|
|
|
@ -39,6 +39,9 @@ class style;
|
|||
class XLNT_API font
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
enum class underline_style
|
||||
{
|
||||
none,
|
||||
|
@ -47,49 +50,115 @@ public:
|
|||
single,
|
||||
single_accounting
|
||||
};
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
font();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
font &bold(bool bold);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool bold() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
font &superscript(bool superscript);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool superscript() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
font &italic(bool italic);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool italic() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
font &strikethrough(bool strikethrough);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool strikethrough() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
font &underline(underline_style new_underline);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool underlined() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
underline_style underline() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
font &size(std::size_t size);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t size() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
font &name(const std::string &name);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string name() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
font &color(const color &c);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<xlnt::color> color() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
font &family(std::size_t family);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<std::size_t> family() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
font &scheme(const std::string &scheme);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<std::string> scheme() const;
|
||||
|
||||
/// <summary>
|
||||
|
@ -105,16 +174,59 @@ public:
|
|||
private:
|
||||
friend class style;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string name_ = "Calibri";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t size_ = 12;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool bold_ = false;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool italic_ = false;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool superscript_ = false;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool subscript_ = false;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool strikethrough_ = false;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
underline_style underline_ = underline_style::none;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<xlnt::color> color_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<std::size_t> family_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<std::string> scheme_;
|
||||
};
|
||||
|
||||
|
|
|
@ -38,8 +38,10 @@ class number_format;
|
|||
class protection;
|
||||
|
||||
namespace detail {
|
||||
|
||||
struct format_impl;
|
||||
struct stylesheet;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/// <summary>
|
||||
|
@ -48,48 +50,182 @@ struct stylesheet;
|
|||
class XLNT_API format
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t id() const;
|
||||
|
||||
// Alignment
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
class alignment &alignment();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const class alignment &alignment() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
format alignment(const xlnt::alignment &new_alignment, bool applied);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool alignment_applied() const;
|
||||
|
||||
// Border
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
class border &border();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const class border &border() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
format border(const xlnt::border &new_border, bool applied);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool border_applied() const;
|
||||
|
||||
// Fill
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
class fill &fill();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const class fill &fill() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
format fill(const xlnt::fill &new_fill, bool applied);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool fill_applied() const;
|
||||
|
||||
|
||||
// Font
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
class font &font();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const class font &font() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
format font(const xlnt::font &new_font, bool applied);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool font_applied() const;
|
||||
|
||||
// Number Format
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
class number_format &number_format();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const class number_format &number_format() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
format number_format(const xlnt::number_format &new_number_format, bool applied);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool number_format_applied() const;
|
||||
|
||||
// Protection
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
class protection &protection();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const class protection &protection() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
format protection(const xlnt::protection &new_protection, bool applied);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool protection_applied() const;
|
||||
|
||||
// Style
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_style() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void clear_style();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
format style(const std::string &name);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
format style(const xlnt::style &new_style);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const class style style() const;
|
||||
|
||||
private:
|
||||
friend struct detail::stylesheet;
|
||||
friend class cell;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
format(detail::format_impl *d);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
detail::format_impl *d_;
|
||||
};
|
||||
|
||||
|
|
|
@ -38,56 +38,206 @@ enum class calendar;
|
|||
class XLNT_API number_format
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const number_format general();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const number_format text();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const number_format number();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const number_format number_00();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const number_format number_comma_separated1();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const number_format percentage();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const number_format percentage_00();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const number_format date_yyyymmdd2();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const number_format date_yymmdd();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const number_format date_ddmmyyyy();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const number_format date_dmyslash();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const number_format date_dmyminus();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const number_format date_dmminus();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const number_format date_myminus();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const number_format date_xlsx14();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const number_format date_xlsx15();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const number_format date_xlsx16();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const number_format date_xlsx17();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const number_format date_xlsx22();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const number_format date_datetime();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const number_format date_time1();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const number_format date_time2();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const number_format date_time3();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const number_format date_time4();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const number_format date_time5();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static const number_format date_time6();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static number_format from_builtin_id(std::size_t builtin_id);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
number_format();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
number_format(std::size_t builtin_id);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
number_format(const std::string &code);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
number_format(const std::string &code, std::size_t custom_id);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_format_string(const std::string &format_code);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_format_string(const std::string &format_code, std::size_t custom_id);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string get_format_string() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_id() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_id(std::size_t id);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t get_id() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string format(const std::string &text) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string format(long double number, calendar base_date) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool is_date_format() const;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if left is exactly equal to right.
|
||||
/// </summary>
|
||||
|
@ -99,8 +249,19 @@ public:
|
|||
XLNT_API friend bool operator!=(const number_format &left, const number_format &right) { return !(left == right); }
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool id_set_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t id_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string format_string_;
|
||||
};
|
||||
|
||||
|
|
|
@ -36,17 +36,49 @@ namespace xlnt {
|
|||
class XLNT_API protection
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static protection unlocked_and_visible();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static protection locked_and_visible();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static protection unlocked_and_hidden();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static protection locked_and_hidden();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
protection();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool locked() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
protection &locked(bool locked);
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool hidden() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
protection &hidden(bool hidden);
|
||||
|
||||
/// <summary>
|
||||
|
@ -60,7 +92,14 @@ public:
|
|||
XLNT_API friend bool operator!=(const protection &left, const protection &right) { return !(left == right); }
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool locked_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool hidden_;
|
||||
};
|
||||
|
||||
|
|
|
@ -39,8 +39,10 @@ class number_format;
|
|||
class protection;
|
||||
|
||||
namespace detail {
|
||||
|
||||
struct style_impl;
|
||||
struct stylesheet;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/// <summary>
|
||||
|
@ -50,56 +52,194 @@ struct stylesheet;
|
|||
class XLNT_API style
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
/// Delete zero-argument constructor
|
||||
/// </summary>
|
||||
style() = delete;
|
||||
|
||||
/// <summary>
|
||||
/// Default copy constructor
|
||||
/// </summary>
|
||||
style(const style &other) = default;
|
||||
|
||||
/// <summary>
|
||||
/// Return the name of this style.
|
||||
/// </summary>
|
||||
std::string name() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
style name(const std::string &name);
|
||||
|
||||
class alignment &alignment();
|
||||
const class alignment &alignment() const;
|
||||
style alignment(const xlnt::alignment &new_alignment, bool applied = true);
|
||||
bool alignment_applied() const;
|
||||
|
||||
class border &border();
|
||||
const class border &border() const;
|
||||
style border(const xlnt::border &new_border, bool applied = true);
|
||||
bool border_applied() const;
|
||||
|
||||
class fill &fill();
|
||||
const class fill &fill() const;
|
||||
style fill(const xlnt::fill &new_fill, bool applied = true);
|
||||
bool fill_applied() const;
|
||||
|
||||
class font &font();
|
||||
const class font &font() const;
|
||||
style font(const xlnt::font &new_font, bool applied = true);
|
||||
bool font_applied() const;
|
||||
|
||||
class number_format &number_format();
|
||||
const class number_format &number_format() const;
|
||||
style number_format(const xlnt::number_format &new_number_format, bool applied = true);
|
||||
bool number_format_applied() const;
|
||||
|
||||
class protection &protection();
|
||||
const class protection &protection() const;
|
||||
style protection(const xlnt::protection &new_protection, bool applied = true);
|
||||
bool protection_applied() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool hidden() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
style hidden(bool value);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<bool> custom() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
style custom(bool value);
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional<std::size_t> builtin_id() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
style builtin_id(std::size_t builtin_id);
|
||||
|
||||
// Formatting components
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
class alignment &alignment();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const class alignment &alignment() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
style alignment(const xlnt::alignment &new_alignment, bool applied = true);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool alignment_applied() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
class border &border();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const class border &border() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
style border(const xlnt::border &new_border, bool applied = true);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool border_applied() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
class fill &fill();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const class fill &fill() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
style fill(const xlnt::fill &new_fill, bool applied = true);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool fill_applied() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
class font &font();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const class font &font() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
style font(const xlnt::font &new_font, bool applied = true);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool font_applied() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
class number_format &number_format();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const class number_format &number_format() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
style number_format(const xlnt::number_format &new_number_format, bool applied = true);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool number_format_applied() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
class protection &protection();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const class protection &protection() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
style protection(const xlnt::protection &new_protection, bool applied = true);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool protection_applied() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator==(const style &other) const;
|
||||
|
||||
private:
|
||||
friend struct detail::stylesheet;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
style(detail::style_impl *d);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
detail::style_impl *d_;
|
||||
};
|
||||
|
||||
|
|
|
@ -47,6 +47,9 @@ struct XLNT_API date
|
|||
/// </summary>
|
||||
static date from_number(int days_since_base_year, calendar base_date);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
date(int year_, int month_, int day_);
|
||||
|
||||
/// <summary>
|
||||
|
@ -54,15 +57,29 @@ struct XLNT_API date
|
|||
/// </summary>
|
||||
int to_number(calendar base_date) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
int weekday() const;
|
||||
|
||||
/// <summary>
|
||||
/// Return true if this date is equal to comparand.
|
||||
/// </summary>
|
||||
bool operator==(const date &comparand) const;
|
||||
|
||||
int weekday() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
int year;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
int month;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
int day;
|
||||
};
|
||||
|
||||
|
|
|
@ -55,21 +55,69 @@ struct XLNT_API datetime
|
|||
/// </summary>
|
||||
static datetime from_number(long double number, calendar base_date);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
datetime(const date &d, const time &t);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
datetime(int year_, int month_, int day_, int hour_ = 0, int minute_ = 0, int second_ = 0, int microsecond_ = 0);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string to_string() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
long double to_number(calendar base_date) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator==(const datetime &comparand) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
int weekday() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
int year;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
int month;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
int day;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
int hour;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
int minute;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
int second;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
int microsecond;
|
||||
};
|
||||
|
||||
|
|
|
@ -37,13 +37,30 @@ namespace xlnt {
|
|||
class XLNT_API exception : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
exception(const std::string &message);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
exception(const exception &) = default;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
virtual ~exception();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_message(const std::string &message);
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string message_;
|
||||
};
|
||||
|
||||
|
@ -53,8 +70,19 @@ private:
|
|||
class XLNT_API invalid_parameter : public exception
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
invalid_parameter();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
invalid_parameter(const invalid_parameter &) = default;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
virtual ~invalid_parameter();
|
||||
};
|
||||
|
||||
|
@ -64,8 +92,19 @@ public:
|
|||
class XLNT_API invalid_sheet_title : public exception
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
invalid_sheet_title(const std::string &title);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
invalid_sheet_title(const invalid_sheet_title &) = default;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
virtual ~invalid_sheet_title();
|
||||
};
|
||||
|
||||
|
@ -75,7 +114,14 @@ public:
|
|||
class XLNT_API missing_number_format : public exception
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
missing_number_format();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
virtual ~missing_number_format();
|
||||
};
|
||||
|
||||
|
@ -85,8 +131,19 @@ public:
|
|||
class XLNT_API invalid_file : public exception
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
invalid_file(const std::string &filename);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
invalid_file(const invalid_file &) = default;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
virtual ~invalid_file();
|
||||
};
|
||||
|
||||
|
@ -97,8 +154,19 @@ public:
|
|||
class XLNT_API illegal_character : public exception
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
illegal_character(char c);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
illegal_character(const illegal_character &) = default;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
virtual ~illegal_character();
|
||||
};
|
||||
|
||||
|
@ -108,8 +176,19 @@ public:
|
|||
class XLNT_API invalid_data_type : public exception
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
invalid_data_type();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
invalid_data_type(const invalid_data_type &) = default;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
virtual ~invalid_data_type();
|
||||
};
|
||||
|
||||
|
@ -119,9 +198,20 @@ public:
|
|||
class XLNT_API invalid_column_string_index : public exception
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
invalid_column_string_index();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
invalid_column_string_index(const invalid_column_string_index &) = default;
|
||||
~invalid_column_string_index();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
virtual ~invalid_column_string_index();
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
@ -130,10 +220,25 @@ public:
|
|||
class XLNT_API invalid_cell_reference : public exception
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
invalid_cell_reference(column_t column, row_t row);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
invalid_cell_reference(const std::string &reference_string);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
invalid_cell_reference(const invalid_cell_reference &) = default;
|
||||
~invalid_cell_reference();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
virtual ~invalid_cell_reference();
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
@ -142,8 +247,19 @@ public:
|
|||
class XLNT_API invalid_attribute : public exception
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
invalid_attribute();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
invalid_attribute(const invalid_attribute &) = default;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
virtual ~invalid_attribute();
|
||||
};
|
||||
|
||||
|
@ -153,8 +269,19 @@ public:
|
|||
class XLNT_API key_not_found : public exception
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
key_not_found();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
key_not_found(const key_not_found &) = default;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
virtual ~key_not_found();
|
||||
};
|
||||
|
||||
|
@ -164,8 +291,19 @@ public:
|
|||
class XLNT_API no_visible_worksheets : public exception
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
no_visible_worksheets();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
no_visible_worksheets(const no_visible_worksheets &) = default;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
virtual ~no_visible_worksheets();
|
||||
};
|
||||
|
||||
|
@ -175,7 +313,14 @@ public:
|
|||
class XLNT_API unhandled_switch_case : public exception
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
unhandled_switch_case();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
virtual ~unhandled_switch_case();
|
||||
};
|
||||
|
||||
|
@ -185,8 +330,19 @@ public:
|
|||
class XLNT_API unsupported : public exception
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
unsupported(const std::string &message);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
unsupported(const unsupported &) = default;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
virtual ~unsupported();
|
||||
};
|
||||
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
// Copyright 2005-2014 Daniel James.
|
||||
// Boost Software License - Version 1.0 - August 17th, 2003
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// Based on Peter Dimov's proposal
|
||||
// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf
|
||||
// issue 6.18.
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include <xlnt/xlnt_config.hpp>
|
||||
|
||||
namespace xlnt {
|
||||
|
||||
// TODO: Can this be in source->detail, or must it be in a header?
|
||||
/// <summary>
|
||||
/// Return a value by combining the hashed value of v (using std::hash) with seed.
|
||||
/// </summary>
|
||||
template <class T>
|
||||
inline void XLNT_API hash_combine(std::size_t &seed, const T &v)
|
||||
{
|
||||
std::hash<T> hasher;
|
||||
seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
}
|
||||
|
||||
} // namespace xlnt
|
|
@ -5,54 +5,89 @@
|
|||
|
||||
namespace xlnt {
|
||||
|
||||
/// <summary>
|
||||
/// Many settings in xlnt are allowed to not have a value set. This class
|
||||
/// encapsulates a value which may or may not be set. Memory is allocated
|
||||
/// within the optional class.
|
||||
/// </summary>
|
||||
template<typename T>
|
||||
class XLNT_API optional
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional() : has_value_(false), value_(T())
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
optional(const T &value) : has_value_(true), value_(value)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
operator bool() const
|
||||
{
|
||||
return is_set();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool is_set() const
|
||||
{
|
||||
return has_value_;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set(const T &value)
|
||||
{
|
||||
has_value_ = true;
|
||||
value_ = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
T &operator*()
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const T &operator*() const
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
T *operator->()
|
||||
{
|
||||
return &get();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const T *operator->() const
|
||||
{
|
||||
return &get();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
T &get()
|
||||
{
|
||||
if (!has_value_)
|
||||
|
@ -63,6 +98,9 @@ public:
|
|||
return value_;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const T &get() const
|
||||
{
|
||||
if (!has_value_)
|
||||
|
@ -73,12 +111,18 @@ public:
|
|||
return value_;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void clear()
|
||||
{
|
||||
has_value_ = false;
|
||||
value_ = T();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator==(const optional<T> &other) const
|
||||
{
|
||||
return has_value_ == other.has_value_
|
||||
|
@ -87,7 +131,14 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_value_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
T value_;
|
||||
};
|
||||
|
||||
|
|
|
@ -154,7 +154,10 @@ public:
|
|||
/// Append the provided part to this path and return the result.
|
||||
/// </summary>
|
||||
path append(const path &to_append) const;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if left path is equal to right path.
|
||||
/// </summary>
|
||||
friend XLNT_API bool operator==(const path &left, const path &right);
|
||||
|
||||
private:
|
||||
|
|
|
@ -47,15 +47,44 @@ struct XLNT_API time
|
|||
/// </summary>
|
||||
static time from_number(long double number);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
explicit time(int hour_ = 0, int minute_ = 0, int second_ = 0, int microsecond_ = 0);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
explicit time(const std::string &time_string);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
long double to_number() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator==(const time &comparand) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
int hour;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
int minute;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
int second;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
int microsecond;
|
||||
};
|
||||
|
||||
|
|
|
@ -34,18 +34,49 @@ namespace xlnt {
|
|||
/// </summary>
|
||||
struct XLNT_API timedelta
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static timedelta from_number(long double number);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
timedelta();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
timedelta(int days_, int hours_, int minutes_, int seconds_, int microseconds_);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
long double to_number() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
int days;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
int hours;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
int minutes;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
int seconds;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
int microseconds;
|
||||
};
|
||||
|
||||
|
|
|
@ -20,12 +20,11 @@
|
|||
//
|
||||
// @license: http://www.opensource.org/licenses/mit-license.php
|
||||
// @author: see AUTHORS file
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <xlnt/xlnt_config.hpp> // for XLNT_API
|
||||
|
||||
#include <xlnt/xlnt_config.hpp>
|
||||
|
||||
namespace xlnt {
|
||||
|
@ -33,14 +32,35 @@ namespace xlnt {
|
|||
class XLNT_API utf8string
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static utf8string from_utf8(const std::string &s);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static utf8string from_latin1(const std::string &s);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static utf8string from_utf16(const std::vector<std::uint16_t> &s);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static utf8string from_utf32(const std::vector<std::uint32_t> &s);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool is_valid() const;
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::vector<std::uint8_t> bytes_;
|
||||
};
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
//
|
||||
// @license: http://www.opensource.org/licenses/mit-license.php
|
||||
// @author: see AUTHORS file
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
|
@ -33,23 +34,64 @@ namespace xlnt {
|
|||
class workbook;
|
||||
class worksheet;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
class XLNT_API const_worksheet_iterator : public std::iterator<std::bidirectional_iterator_tag, const worksheet, std::ptrdiff_t, const worksheet*, const worksheet>
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_worksheet_iterator(const workbook &wb, std::size_t index);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_worksheet_iterator(const const_worksheet_iterator &);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_worksheet_iterator &operator=(const const_worksheet_iterator &);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const worksheet operator*();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator==(const const_worksheet_iterator &comparand) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator!=(const const_worksheet_iterator &comparand) const
|
||||
{
|
||||
return !(*this == comparand);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_worksheet_iterator operator++(int);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_worksheet_iterator &operator++();
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const workbook &wb_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t index_;
|
||||
};
|
||||
|
||||
|
|
|
@ -35,13 +35,34 @@ namespace xlnt {
|
|||
class XLNT_API document_security
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
document_security();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool lock_revision;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool lock_structure;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool lock_windows;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string revision_password;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string workbook_password;
|
||||
};
|
||||
|
||||
|
|
|
@ -43,19 +43,50 @@ std::vector<std::pair<std::string, std::string>> XLNT_API split_named_range(cons
|
|||
class XLNT_API named_range
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
using target = std::pair<worksheet, range_reference>;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
named_range();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
named_range(const named_range &other);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
named_range(const std::string &name, const std::vector<target> &targets);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string get_name() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const std::vector<target> &get_targets() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
named_range &operator=(const named_range &other);
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string name_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::vector<target> targets_;
|
||||
};
|
||||
|
||||
|
|
|
@ -35,6 +35,9 @@
|
|||
|
||||
namespace xlnt {
|
||||
|
||||
enum class calendar;
|
||||
enum class relationship_type;
|
||||
|
||||
class alignment;
|
||||
class border;
|
||||
class cell;
|
||||
|
@ -65,14 +68,13 @@ class zip_file;
|
|||
|
||||
struct datetime;
|
||||
|
||||
enum class calendar;
|
||||
enum class relationship_type;
|
||||
|
||||
namespace detail {
|
||||
|
||||
struct stylesheet;
|
||||
struct workbook_impl;
|
||||
class xlsx_consumer;
|
||||
class xlsx_producer;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/// <summary>
|
||||
|
@ -81,9 +83,24 @@ class xlsx_producer;
|
|||
class XLNT_API workbook
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
using iterator = worksheet_iterator;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
using const_iterator = const_worksheet_iterator;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
using reverse_iterator = std::reverse_iterator<iterator>;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
||||
|
||||
/// <summary>
|
||||
|
@ -91,12 +108,24 @@ public:
|
|||
/// </summary>
|
||||
friend void swap(workbook &left, workbook &right);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static workbook minimal();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static workbook empty_excel();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static workbook empty_libre_office();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static workbook empty_numbers();
|
||||
|
||||
// constructors
|
||||
|
@ -305,151 +334,485 @@ public:
|
|||
/// </summary>
|
||||
void set_application(const std::string &application);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
calendar get_base_date() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_base_date(calendar base_date);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string get_creator() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_creator(const std::string &creator);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string get_last_modified_by() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_last_modified_by(const std::string &last_modified_by);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
datetime get_created() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_created(const datetime &when);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
datetime get_modified() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_modified(const datetime &when);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
int get_doc_security() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_doc_security(int doc_security);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool get_scale_crop() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_scale_crop(bool scale_crop);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string get_company() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_company(const std::string &company);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool links_up_to_date() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_links_up_to_date(bool links_up_to_date);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool is_shared_doc() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_shared_doc(bool shared_doc);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool hyperlinks_changed() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_hyperlinks_changed(bool hyperlinks_changed);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string get_app_version() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_app_version(const std::string &version);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string get_title() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_title(const std::string &title);
|
||||
|
||||
// named ranges
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::vector<named_range> get_named_ranges() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void create_named_range(const std::string &name, worksheet worksheet, const range_reference &reference);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void create_named_range(const std::string &name, worksheet worksheet, const std::string &reference_string);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_named_range(const std::string &name) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range get_named_range(const std::string &name);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void remove_named_range(const std::string &name);
|
||||
|
||||
// serialization
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void save(std::vector<std::uint8_t> &data) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void save(const std::string &filename) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void save(const xlnt::path &filename) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void save(std::ostream &stream) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void save(const std::string &filename, const std::string &password);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void save(const xlnt::path &filename, const std::string &password);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void save(std::ostream &stream, const std::string &password);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void save(const std::vector<std::uint8_t> &data, const std::string &password);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void load(const std::vector<std::uint8_t> &data);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void load(const std::string &filename);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void load(const xlnt::path &filename);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void load(std::istream &stream);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void load(const std::string &filename, const std::string &password);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void load(const xlnt::path &filename, const std::string &password);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void load(std::istream &stream, const std::string &password);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void load(const std::vector<std::uint8_t> &data, const std::string &password);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void save(const std::wstring &filename);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void save(const std::wstring &filename, const std::string &password);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void load(const std::wstring &filename);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void load(const std::wstring &filename, const std::string &password);
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_view() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
workbook_view get_view() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_view(const workbook_view &view);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_code_name() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string get_code_name() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_code_name(const std::string &code_name);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool x15_enabled() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void enable_x15();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void disable_x15();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_absolute_path() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
path get_absolute_path() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_absolute_path(const path &absolute_path);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void clear_absolute_path();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_properties() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_file_version() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string get_app_name() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t get_last_edited() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t get_lowest_edited() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t get_rup_build() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_arch_id() const;
|
||||
|
||||
// calculation
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_calculation_properties() const;
|
||||
|
||||
// theme
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_theme() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const theme &get_theme() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_theme(const theme &value);
|
||||
|
||||
// formats
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
format get_format(std::size_t format_index);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const format get_format(std::size_t format_index) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
format create_format(bool default_format = false);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void clear_formats();
|
||||
|
||||
// styles
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_style(const std::string &name) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
class style style(const std::string &name);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const class style style(const std::string &name) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
class style create_style(const std::string &name);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void clear_styles();
|
||||
|
||||
// manifest
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
manifest &get_manifest();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const manifest &get_manifest() const;
|
||||
|
||||
// shared strings
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void add_shared_string(const formatted_text &shared, bool allow_duplicates=false);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::vector<formatted_text> &get_shared_strings();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const std::vector<formatted_text> &get_shared_strings() const;
|
||||
|
||||
// thumbnail
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_thumbnail(const std::vector<std::uint8_t> &thumbnail,
|
||||
const std::string &extension, const std::string &content_type);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const std::vector<std::uint8_t> &get_thumbnail() const;
|
||||
|
||||
// operators
|
||||
|
@ -487,22 +850,49 @@ private:
|
|||
friend class detail::xlsx_consumer;
|
||||
friend class detail::xlsx_producer;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
workbook(detail::workbook_impl *impl);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
detail::workbook_impl &impl();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const detail::workbook_impl &impl() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void register_app_properties_in_manifest();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void register_core_properties_in_manifest();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void register_shared_string_table_in_manifest();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void register_stylesheet_in_manifest();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void register_theme_in_manifest();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void register_comments_in_manifest(worksheet ws);
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -35,19 +35,69 @@ namespace xlnt {
|
|||
class XLNT_API workbook_view
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool auto_filter_date_grouping = false;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool minimized = false;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool show_horizontal_scroll = false;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool show_sheet_tabs = false;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool show_vertical_scroll = false;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool visible = true;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t active_tab = 0;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t first_sheet = 0;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t tab_ratio = 500;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t window_width = 28800;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t window_height = 17460;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t x_window = 0;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t y_window = 460;
|
||||
};
|
||||
|
||||
|
|
|
@ -33,23 +33,64 @@ namespace xlnt {
|
|||
class workbook;
|
||||
class worksheet;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
class XLNT_API worksheet_iterator : public std::iterator<std::bidirectional_iterator_tag, worksheet, std::ptrdiff_t, worksheet*, worksheet>
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
worksheet_iterator(workbook &wb, std::size_t index);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
worksheet_iterator(const worksheet_iterator &);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
worksheet_iterator &operator=(const worksheet_iterator &);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
worksheet operator*();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator==(const worksheet_iterator &comparand) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator!=(const worksheet_iterator &comparand) const
|
||||
{
|
||||
return !(*this == comparand);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
worksheet_iterator operator++(int);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
worksheet_iterator &operator++();
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
workbook &wb_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t index_;
|
||||
};
|
||||
|
||||
|
|
|
@ -33,40 +33,92 @@
|
|||
|
||||
namespace xlnt {
|
||||
|
||||
enum class major_order;
|
||||
|
||||
class cell;
|
||||
class cell_reference;
|
||||
class range_reference;
|
||||
enum class major_order;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
class XLNT_API cell_iterator : public std::iterator<std::bidirectional_iterator_tag, cell, std::ptrdiff_t, cell *, cell>
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_iterator(worksheet ws, const cell_reference &start_cell, const range_reference &limits);
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_iterator(worksheet ws, const cell_reference &start_cell, const range_reference &limits, major_order order);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_iterator(const cell_iterator &other);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell operator*();
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_iterator &operator=(const cell_iterator &) = default;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator==(const cell_iterator &other) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator!=(const cell_iterator &other) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_iterator &operator--();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_iterator operator--(int);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_iterator &operator++();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_iterator operator++(int);
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
worksheet ws_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_reference current_cell_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range_reference range_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
major_order order_;
|
||||
};
|
||||
|
||||
|
|
|
@ -46,54 +46,155 @@ class range_reference;
|
|||
class XLNT_API cell_vector
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
using iterator = cell_iterator;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
using const_iterator = const_cell_iterator;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
using reverse_iterator = std::reverse_iterator<iterator>;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_vector(worksheet ws, const range_reference &ref, major_order order = major_order::row);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t num_cells() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell front();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const cell front() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell back();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const cell back() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell operator[](std::size_t column_index);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const cell operator[](std::size_t column_index) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell get_cell(std::size_t column_index);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const cell get_cell(std::size_t column_index) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t length() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
iterator begin();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
iterator end();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_iterator begin() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_iterator cbegin() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_iterator end() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_iterator cend() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
reverse_iterator rbegin();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
reverse_iterator rend();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_reverse_iterator rbegin() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_reverse_iterator rend() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_reverse_iterator crbegin() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_reverse_iterator crend() const;
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
worksheet ws_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range_reference ref_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
major_order order_;
|
||||
};
|
||||
|
||||
|
|
|
@ -34,8 +34,19 @@ namespace xlnt {
|
|||
class XLNT_API column_properties
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
long double width;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t style;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool custom;
|
||||
};
|
||||
|
||||
|
|
|
@ -33,40 +33,92 @@
|
|||
|
||||
namespace xlnt {
|
||||
|
||||
enum class major_order;
|
||||
|
||||
class cell;
|
||||
class cell_reference;
|
||||
class range_reference;
|
||||
enum class major_order;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
class XLNT_API const_cell_iterator : public std::iterator<std::bidirectional_iterator_tag, const cell, std::ptrdiff_t, const cell*, const cell>
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_cell_iterator(worksheet ws, const cell_reference &start_cell);
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_cell_iterator(worksheet ws, const cell_reference &start_cell, major_order order);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_cell_iterator(const const_cell_iterator &other);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_cell_iterator &operator=(const const_cell_iterator &) = default;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const cell operator*() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator==(const const_cell_iterator &other) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator!=(const const_cell_iterator &other) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_cell_iterator &operator--();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_cell_iterator operator--(int);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_cell_iterator &operator++();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_cell_iterator operator++(int);
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
worksheet ws_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_reference current_cell_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range_reference range_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
major_order order_;
|
||||
};
|
||||
|
||||
|
|
|
@ -45,31 +45,76 @@ struct worksheet_impl;
|
|||
class XLNT_API const_range_iterator : public std::iterator<std::bidirectional_iterator_tag, const cell_vector, std::ptrdiff_t, const cell_vector*, const cell_vector>
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_range_iterator(
|
||||
const worksheet &ws, const range_reference &start_cell, major_order order = major_order::row);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_range_iterator(const const_range_iterator &other);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const cell_vector operator*() const;
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_range_iterator &operator=(const const_range_iterator &) = default;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator==(const const_range_iterator &other) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator!=(const const_range_iterator &other) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_range_iterator &operator--();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_range_iterator operator--(int);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_range_iterator &operator++();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_range_iterator operator++(int);
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
detail::worksheet_impl *ws_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_reference current_cell_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range_reference range_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
major_order order_;
|
||||
};
|
||||
|
||||
|
|
|
@ -36,23 +36,60 @@ namespace xlnt {
|
|||
class XLNT_API footer
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
footer();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_text(const std::string &text);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_font_name(const std::string &font_name);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_font_size(std::size_t font_size);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_font_color(const std::string &font_color);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool is_default() const;
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool default_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string text_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string font_name_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t font_size_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string font_color_;
|
||||
};
|
||||
|
||||
|
|
|
@ -36,23 +36,60 @@ namespace xlnt {
|
|||
class XLNT_API header
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
header();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_text(const std::string &text);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_font_name(const std::string &font_name);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_font_size(std::size_t font_size);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_font_color(const std::string &font_color);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool is_default() const;
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool default_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string text_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string font_name_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t font_size_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string font_color_;
|
||||
};
|
||||
|
||||
|
|
|
@ -38,22 +38,65 @@ namespace xlnt {
|
|||
class XLNT_API header_footer
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
header_footer();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
header &get_left_header();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
header &get_center_header();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
header &get_right_header();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
footer &get_left_footer();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
footer &get_center_footer();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
footer &get_right_footer();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool is_default_header() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool is_default_footer() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool is_default() const;
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
header left_header_, right_header_, center_header_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
footer left_footer_, right_footer_, center_footer_;
|
||||
};
|
||||
|
||||
|
|
|
@ -33,32 +33,100 @@ namespace xlnt {
|
|||
class XLNT_API page_margins
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
page_margins();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
double get_top() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_top(double top);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
double get_left() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_left(double left);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
double get_bottom() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_bottom(double bottom);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
double get_right() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_right(double right);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
double get_header() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_header(double header);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
double get_footer() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_footer(double footer);
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
double top_ = 1;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
double left_ = 0.75;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
double bottom_ = 1;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
double right_ = 0.75;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
double header_ = 0.5;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
double footer_ = 0.5;
|
||||
};
|
||||
|
||||
|
|
|
@ -37,58 +37,160 @@ namespace xlnt {
|
|||
struct XLNT_API page_setup
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
page_setup();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
page_break get_break() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_break(page_break b);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
sheet_state get_sheet_state() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_sheet_state(sheet_state sheet_state);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
paper_size get_paper_size() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_paper_size(paper_size paper_size);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
orientation get_orientation() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_orientation(orientation orientation);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool fit_to_page() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_fit_to_page(bool fit_to_page);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool fit_to_height() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_fit_to_height(bool fit_to_height);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool fit_to_width() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_fit_to_width(bool fit_to_width);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_horizontal_centered(bool horizontal_centered);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool get_horizontal_centered() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_vertical_centered(bool vertical_centered);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool get_vertical_centered() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_scale(double scale);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
double get_scale() const;
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
page_break break_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
sheet_state sheet_state_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
paper_size paper_size_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
orientation orientation_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool fit_to_page_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool fit_to_height_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool fit_to_width_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool horizontal_centered_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool vertical_centered_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
double scale_;
|
||||
};
|
||||
|
||||
|
|
|
@ -55,10 +55,29 @@ enum class XLNT_API pane_corner
|
|||
class XLNT_API pane
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_reference top_left_cell;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
pane_state state;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
pane_corner active_pane;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
row_t y_split;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
column_t x_split;
|
||||
};
|
||||
|
||||
|
|
|
@ -46,61 +46,175 @@ class range_iterator;
|
|||
class XLNT_API range
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
using iterator = range_iterator;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
using const_iterator = const_range_iterator;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
using reverse_iterator = std::reverse_iterator<iterator>;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range(worksheet ws, const range_reference &reference, major_order order = major_order::row, bool skip_null = false);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
~range();
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range(const range &) = default;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_vector operator[](std::size_t vector_index);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const cell_vector operator[](std::size_t vector_index) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator==(const range &comparand) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator!=(const range &comparand) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_vector get_vector(std::size_t vector_index);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const cell_vector get_vector(std::size_t vector_index) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell get_cell(const cell_reference &ref);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const cell get_cell(const cell_reference &ref) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range_reference get_reference() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t length() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool contains(const cell_reference &ref);
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
iterator begin();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
iterator end();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_iterator begin() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_iterator end() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_iterator cbegin() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_iterator cend() const;
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
reverse_iterator rbegin();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
reverse_iterator rend();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_reverse_iterator rbegin() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_reverse_iterator rend() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_reverse_iterator crbegin() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_reverse_iterator crend() const;
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
worksheet ws_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range_reference ref_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
major_order order_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool skip_null_;
|
||||
};
|
||||
|
||||
|
|
|
@ -41,30 +41,75 @@ class cell_vector;
|
|||
class XLNT_API range_iterator : public std::iterator<std::bidirectional_iterator_tag, cell_vector, std::ptrdiff_t, cell_vector*, cell_vector>
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range_iterator(worksheet &ws, const range_reference &start_cell, const range_reference &limits, major_order order = major_order::row);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range_iterator(const range_iterator &other);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_vector operator*() const;
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range_iterator &operator=(const range_iterator &) = default;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator==(const range_iterator &other) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator!=(const range_iterator &other) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range_iterator &operator--();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range_iterator operator--(int);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range_iterator &operator++();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range_iterator operator++(int);
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
worksheet ws_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_reference current_cell_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range_reference range_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
major_order order_;
|
||||
};
|
||||
|
||||
|
|
|
@ -39,53 +39,140 @@ public:
|
|||
/// </summary>
|
||||
static range_reference make_absolute(const range_reference &relative_reference);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range_reference();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
explicit range_reference(const std::string &range_string);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
explicit range_reference(const char *range_string);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
explicit range_reference(const std::pair<cell_reference, cell_reference> &reference_pair);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range_reference(const cell_reference &start, const cell_reference &end);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range_reference(column_t column_index_start, row_t row_index_start, column_t column_index_end, row_t row_index_end);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool is_single_cell() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t get_width() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t get_height() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_reference get_top_left() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_reference get_bottom_right() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_reference &get_top_left();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_reference &get_bottom_right();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range_reference make_offset(int column_offset, int row_offset) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string to_string() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator==(const range_reference &comparand) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator==(const std::string &reference_string) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator==(const char *reference_string) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator!=(const range_reference &comparand) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator!=(const std::string &reference_string) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator!=(const char *reference_string) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
XLNT_API friend bool operator==(const std::string &reference_string, const range_reference &ref);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
XLNT_API friend bool operator==(const char *reference_string, const range_reference &ref);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
XLNT_API friend bool operator!=(const std::string &reference_string, const range_reference &ref);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
XLNT_API friend bool operator!=(const char *reference_string, const range_reference &ref);
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_reference top_left_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_reference bottom_right_;
|
||||
};
|
||||
|
||||
|
|
|
@ -33,10 +33,29 @@ namespace xlnt {
|
|||
class XLNT_API row_properties
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
long double height;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool visible;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
int outline_level;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool collapsed;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
int style_index;
|
||||
};
|
||||
|
||||
|
|
|
@ -35,16 +35,50 @@ namespace xlnt {
|
|||
class XLNT_API selection
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_active_cell() const { return has_active_cell_; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_reference get_active_cell() const { return active_cell_; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range_reference get_sqref() const { return sqref_; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
pane_corner get_pane() const { return pane_; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_pane(pane_corner corner) { pane_ = corner; }
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_active_cell_ = false;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_reference active_cell_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range_reference sqref_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
pane_corner pane_;
|
||||
};
|
||||
|
||||
|
|
|
@ -35,12 +35,25 @@ namespace xlnt {
|
|||
class XLNT_API sheet_protection
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static std::string hash_password(const std::string &password);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_password(const std::string &password);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string get_hashed_password() const;
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string hashed_password_;
|
||||
};
|
||||
|
||||
|
|
|
@ -36,13 +36,35 @@ namespace xlnt {
|
|||
class XLNT_API sheet_view
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
pane &get_pane() { return pane_; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const pane &get_pane() const { return pane_; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::vector<selection> &get_selections() { return selections_; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const std::vector<selection> &get_selections() const { return selections_; }
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
pane pane_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::vector<selection> selections_;
|
||||
};
|
||||
|
||||
|
|
|
@ -55,9 +55,12 @@ class workbook;
|
|||
struct date;
|
||||
|
||||
namespace detail {
|
||||
struct worksheet_impl;
|
||||
|
||||
class xlsx_consumer;
|
||||
class xlsx_producer;
|
||||
|
||||
struct worksheet_impl;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -67,191 +70,678 @@ class xlsx_producer;
|
|||
class XLNT_API worksheet
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
using iterator = range_iterator;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
using const_iterator = const_range_iterator;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
using reverse_iterator = std::reverse_iterator<iterator>;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
worksheet();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
worksheet(const worksheet &rhs);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string to_string() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
workbook &get_workbook();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const workbook &get_workbook() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void garbage_collect();
|
||||
|
||||
// identification
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t get_id() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_id(std::size_t id);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string get_title() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_title(const std::string &title);
|
||||
|
||||
// freeze panes
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_reference get_frozen_panes() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void freeze_panes(cell top_left_cell);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void freeze_panes(const std::string &top_left_coordinate);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void unfreeze_panes();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_frozen_panes() const;
|
||||
|
||||
// container
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell get_cell(column_t column, row_t row);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const cell get_cell(column_t column, row_t row) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell get_cell(const cell_reference &reference);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const cell get_cell(const cell_reference &reference) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_cell(const cell_reference &reference) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range get_range(const std::string &reference_string);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range get_range(const range_reference &reference);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const range get_range(const std::string &reference_string) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const range get_range(const range_reference &reference) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range rows() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range rows(const std::string &range_string) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range rows(int row_offset, int column_offset) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range rows(const std::string &range_string, int row_offset, int column_offset) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range columns() const;
|
||||
|
||||
// properties
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
column_properties &get_column_properties(column_t column);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const column_properties &get_column_properties(column_t column) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_column_properties(column_t column) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void add_column_properties(column_t column, const column_properties &props);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
row_properties &get_row_properties(row_t row);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const row_properties &get_row_properties(row_t row) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_row_properties(row_t row) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void add_row_properties(row_t row, const row_properties &props);
|
||||
|
||||
// positioning
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_reference get_point_pos(int left, int top) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell_reference get_point_pos(const std::pair<int, int> &point) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string unique_sheet_name(const std::string &value) const;
|
||||
|
||||
// named range
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void create_named_range(const std::string &name, const std::string &reference_string);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void create_named_range(const std::string &name, const range_reference &reference);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_named_range(const std::string &name);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range get_named_range(const std::string &name);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void remove_named_range(const std::string &name);
|
||||
|
||||
// extents
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
row_t get_lowest_row() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
row_t get_highest_row() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
row_t get_next_row() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
column_t get_lowest_column() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
column_t get_highest_column() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range_reference calculate_dimension() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_dimension() const;
|
||||
|
||||
// cell merge
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void merge_cells(const std::string &reference_string);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void merge_cells(const range_reference &reference);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void merge_cells(column_t start_column, row_t start_row, column_t end_column, row_t end_row);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void unmerge_cells(const std::string &reference_string);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void unmerge_cells(const range_reference &reference);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void unmerge_cells(column_t start_column, row_t start_row, column_t end_column, row_t end_row);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::vector<range_reference> get_merged_ranges() const;
|
||||
|
||||
// append
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void append();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void append(const std::vector<std::string> &cells);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void append(const std::vector<int> &cells);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void append(const std::unordered_map<std::string, std::string> &cells);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void append(const std::unordered_map<int, std::string> &cells);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void append(const std::vector<int>::const_iterator begin, const std::vector<int>::const_iterator end);
|
||||
|
||||
// operators
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator==(const worksheet &other) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator!=(const worksheet &other) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator==(std::nullptr_t) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool operator!=(std::nullptr_t) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void operator=(const worksheet &other);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
cell operator[](const cell_reference &reference);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const cell operator[](const cell_reference &reference) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range operator[](const range_reference &reference);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const range operator[](const range_reference &reference) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range operator[](const std::string &range_string);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const range operator[](const std::string &range_string) const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range operator()(const cell_reference &top_left, const cell_reference &bottom_right);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const range operator()(const cell_reference &top_left, const cell_reference &bottom_right) const;
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool compare(const worksheet &other, bool reference) const;
|
||||
|
||||
// page
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_page_setup() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
page_setup get_page_setup() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_page_setup(const page_setup &setup);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_page_margins() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
page_margins get_page_margins() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_page_margins(const page_margins &margins);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_format_properties() const;
|
||||
|
||||
// auto filter
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range_reference get_auto_filter() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void auto_filter(const std::string &range_string);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void auto_filter(const xlnt::range &range);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void auto_filter(const range_reference &reference);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void unset_auto_filter();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_auto_filter() const;
|
||||
|
||||
// comments
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void increment_comments();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void decrement_comments();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::size_t get_comment_count() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void reserve(std::size_t n);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
header_footer &get_header_footer();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const header_footer &get_header_footer() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_parent(workbook &wb);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::vector<std::string> get_formula_attributes() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
sheet_state get_sheet_state() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_sheet_state(sheet_state state);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
iterator begin();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
iterator end();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_iterator begin() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_iterator end() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_iterator cbegin() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const_iterator cend() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range iter_cells(bool skip_null);
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_print_title_rows(row_t first_row, row_t last_row);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_print_title_rows(row_t last_row);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_print_title_cols(column_t first_column, column_t last_column);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_print_title_cols(column_t last_column);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
std::string get_print_titles() const;
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void set_print_area(const std::string &print_area);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
range_reference get_print_area() const;
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool has_view() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
sheet_view get_view() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool x14ac_enabled() const;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void enable_x14ac();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void disable_x14ac();
|
||||
|
||||
private:
|
||||
friend class workbook;
|
||||
friend class cell;
|
||||
friend class range_iterator;
|
||||
friend class const_range_iterator;
|
||||
friend class range_iterator;
|
||||
friend class workbook;
|
||||
friend class detail::xlsx_consumer;
|
||||
friend class detail::xlsx_producer;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void register_comments_in_manifest();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
worksheet(detail::worksheet_impl *d);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
detail::worksheet_impl *d_;
|
||||
};
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
|
||||
// styles
|
||||
#include <xlnt/styles/alignment.hpp>
|
||||
#include <xlnt/styles/base_format.hpp>
|
||||
#include <xlnt/styles/border.hpp>
|
||||
#include <xlnt/styles/border_style.hpp>
|
||||
#include <xlnt/styles/color.hpp>
|
||||
|
@ -51,7 +50,6 @@
|
|||
#include <xlnt/styles/horizontal_alignment.hpp>
|
||||
#include <xlnt/styles/number_format.hpp>
|
||||
#include <xlnt/styles/protection.hpp>
|
||||
#include <xlnt/styles/side.hpp>
|
||||
#include <xlnt/styles/style.hpp>
|
||||
#include <xlnt/styles/vertical_alignment.hpp>
|
||||
|
||||
|
|
|
@ -20,12 +20,9 @@
|
|||
//
|
||||
// @license: http://www.opensource.org/licenses/mit-license.php
|
||||
// @author: see AUTHORS file
|
||||
|
||||
#pragma once
|
||||
|
||||
// Change these values for programs using this library.
|
||||
|
||||
namespace xlnt {
|
||||
|
||||
#ifndef XLNT_API
|
||||
#if !defined(XLNT_STATIC) && defined(_MSC_VER)
|
||||
#ifdef XLNT_EXPORT
|
||||
|
@ -40,5 +37,3 @@ namespace xlnt {
|
|||
#define XLNT_API
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // namespace xlnt
|
||||
|
|
|
@ -21,16 +21,16 @@
|
|||
//
|
||||
// @license: http://www.opensource.org/licenses/mit-license.php
|
||||
// @author: see AUTHORS file
|
||||
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include <detail/number_formatter.hpp>
|
||||
#include <xlnt/styles/number_format.hpp>
|
||||
#include <xlnt/utils/datetime.hpp>
|
||||
#include <xlnt/utils/exceptions.hpp>
|
||||
#include <xlnt/utils/hash_combine.hpp>
|
||||
#include <xlnt/styles/number_format.hpp>
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
//
|
||||
// @license: http://www.opensource.org/licenses/mit-license.php
|
||||
// @author: see AUTHORS file
|
||||
|
||||
#include <xlnt/styles/protection.hpp>
|
||||
#include <xlnt/utils/hash_combine.hpp>
|
||||
|
||||
namespace xlnt {
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user