33 #include <unordered_map> 37 #include <xlnt/xlnt_config.hpp> 38 #include <xlnt/cell/rich_text.hpp> 49 class calculation_properties;
53 class const_worksheet_iterator;
59 class metadata_property;
66 class range_reference;
68 class streaming_workbook_reader;
70 class style_serializer;
75 class worksheet_iterator;
153 workbook(std::istream &data,
const std::string &password);
182 worksheet create_sheet(std::size_t index);
211 void active_sheet(std::size_t index);
218 worksheet sheet_by_title(
const std::string &title);
225 const worksheet sheet_by_title(
const std::string &title)
const;
231 worksheet sheet_by_index(std::size_t index);
237 const worksheet sheet_by_index(std::size_t index)
const;
249 const worksheet sheet_by_id(std::size_t
id)
const;
256 bool sheet_hidden_by_index(std::size_t index)
const;
261 bool contains(
const std::string &title)
const;
322 void apply_to_cells(std::function<
void(
cell)> f);
328 std::vector<std::string> sheet_titles()
const;
333 std::size_t sheet_count()
const;
346 std::vector<xlnt::core_property> core_properties()
const;
367 std::vector<xlnt::extended_property> extended_properties()
const;
382 bool has_custom_property(
const std::string &property_name)
const;
388 std::vector<std::string> custom_properties()
const;
393 variant custom_property(
const std::string &property_name)
const;
398 void custom_property(
const std::string &property_name,
const variant &value);
416 bool has_title()
const;
421 std::string title()
const;
426 void title(
const std::string &title);
431 void abs_path(
const std::string &
path);
436 void arch_id_flags(
const std::size_t flags);
443 std::vector<xlnt::named_range> named_ranges()
const;
453 void create_named_range(
const std::string &name,
worksheet worksheet,
const std::string &reference_string);
458 bool has_named_range(
const std::string &name)
const;
468 void remove_named_range(const std::string &name);
476 void save(std::vector<std::uint8_t> &data) const;
482 void save(std::vector<std::uint8_t> &data, const std::string &password) const;
488 void save(const std::string &filename) const;
494 void save(const std::string &filename, const std::string &password) const;
497 void save(const std::wstring &filename) const;
507 void save(const std::wstring &filename, const std::string &password) const;
514 void save(const xlnt::path &filename) const;
520 void save(const xlnt::path &filename, const std::string &password) const;
525 void save(std::ostream &stream) const;
531 void save(std::ostream &stream, const std::string &password) const;
537 void load(const std::vector<std::uint8_t> &data);
543 void load(const std::vector<std::uint8_t> &data, const std::string &password);
549 void load(const std::string &filename);
555 void load(const std::string &filename, const std::string &password);
558 void load(const std::wstring &filename);
568 void load(const std::wstring &filename, const std::string &password);
575 void load(const xlnt::path &filename);
581 void load(const xlnt::path &filename, const std::string &password);
587 void load(std::istream &stream);
593 void load(std::istream &stream, const std::string &password);
600 bool has_view() const;
610 void view(const workbook_view &view);
617 bool has_code_name() const;
622 std::string code_name() const;
627 void code_name(const std::string &code_name);
632 bool has_file_version() const;
637 std::string app_name() const;
642 std::size_t last_edited() const;
647 std::size_t lowest_edited() const;
652 std::size_t rup_build() const;
659 bool has_theme() const;
669 void
theme(const class theme &value);
688 xlnt::format create_format(bool default_format = false);
694 void clear_formats();
701 bool has_style(const std::string &name) const;
711 const class
style style(const std::string &name) const;
716 class
style create_style(const std::string &name);
721 class
style create_builtin_style(std::size_t builtin_id);
733 void default_slicer_style(const std::string &value);
738 std::string default_slicer_style() const;
743 void enable_known_fonts();
748 void disable_known_fonts();
753 bool known_fonts_enabled() const;
775 std::size_t add_shared_string(const rich_text &shared, bool allow_duplicates = false);
780 const
rich_text &shared_strings(std::size_t index) const;
786 std::vector<rich_text> &shared_strings();
792 const std::vector<rich_text> &shared_strings() const;
800 void thumbnail(const std::vector<std::uint8_t> &thumbnail,
801 const std::string &extension, const std::string &content_type);
806 const std::vector<std::uint8_t> &thumbnail() const;
811 const std::unordered_map<std::string, std::vector<std::uint8_t>>& binaries() const;
818 bool has_calculation_properties() const;
836 workbook &operator=(workbook other);
841 worksheet operator[](const std::string &name);
852 bool operator==(const workbook &rhs) const;
858 bool operator!=(const workbook &rhs) const;
863 friend class detail::xlsx_consumer;
864 friend class detail::xlsx_producer;
870 workbook(detail::workbook_impl *impl);
876 detail::workbook_impl &impl();
882 const detail::workbook_impl &impl() const;
889 void register_package_part(relationship_type type);
897 void register_workbook_part(relationship_type type);
905 void register_worksheet_part(worksheet ws, relationship_type type);
910 void garbage_collect_formulae();
915 void update_sheet_properties();
920 void swap(workbook &other);
925 void reorder_relationships();
930 std::unique_ptr<detail::workbook_impl> d_;
core_property
Every core property in a workbook must be one of these types.
Definition: metadata_property.hpp:34
A range is a 2D collection of cells with defined extens that can be iterated upon.
Definition: range.hpp:55
Represents an association between a source Package or part, and a target object which can be a part o...
Definition: relationship.hpp:103
Represents an object that can have variable type.
Definition: variant.hpp:40
Definition: cell_reference.hpp:262
A workbook can be opened in multiple windows with different views. This class represents a particular...
Definition: workbook_view.hpp:37
Enumerates the possible types a cell can be determined by it's current value.
Definition: cell.hpp:37
extended_property
Every extended property in a workbook must be one of these types.
Definition: metadata_property.hpp:56
std::reverse_iterator< iterator > reverse_iterator
typedef for the iterator used for iterating through this workbook (non-const) in a range-based for lo...
Definition: workbook.hpp:112
A worksheet is a 2D array of cells starting with cell A1 in the top-left corner and extending indefin...
Definition: worksheet.hpp:77
A theme is a combination of fonts, colors, and effects. This isn't really supported yet...
Definition: theme.hpp:35
Describes a unit of data in a worksheet at a specific coordinate and its associated properties...
Definition: cell.hpp:84
Encapsulates zero or more formatted text runs where a text run is a string of text with the same defi...
Definition: rich_text.hpp:41
An iterator which is used to iterate over the worksheets in a workbook.
Definition: worksheet_iterator.hpp:44
Encapsulates a path that points to location in a filesystem.
Definition: path.hpp:38
relationship_type
All package relationships must be one of these defined types.
Definition: relationship.hpp:54
Workbook file properties relating to calculations.
Definition: calculation_properties.hpp:34
An iterator which is used to iterate over the worksheets in a const workbook.
Definition: worksheet_iterator.hpp:154
A 2D range of cells in a worksheet that is referred to by name. ws->range("A1:B2") could be replaced ...
Definition: named_range.hpp:42
workbook is the container for all other parts of the document.
Definition: streaming_workbook_reader.hpp:55
The manifest keeps track of all files in the OOXML package and their type and relationships.
Definition: manifest.hpp:41
A range_reference describes a rectangular area of a worksheet with positive width and height defined ...
Definition: range_reference.hpp:36
Describes a style which has a name and can be applied to multiple individual formats. In Excel this is a "Cell Style".
Definition: style.hpp:56
std::reverse_iterator< const_iterator > const_reverse_iterator
typedef for the iterator used for iterating through this workbook (const) in a range-based for loop i...
Definition: workbook.hpp:119
workbook is the container for all other parts of the document.
Definition: workbook.hpp:92
calendar
An enumeration of possible base dates. Dates in Excel are stored as days since this base date...
Definition: calendar.hpp:35