xlnt
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
xlnt::workbook Class Reference

workbook is the container for all other parts of the document. More...

#include <workbook.hpp>

Public Types

using iterator = worksheet_iterator
 typedef for the iterator used for iterating through this workbook (non-const) in a range-based for loop. More...
 
using const_iterator = const_worksheet_iterator
 typedef for the iterator used for iterating through this workbook (const) in a range-based for loop. More...
 
using reverse_iterator = std::reverse_iterator< iterator >
 typedef for the iterator used for iterating through this workbook (non-const) in a range-based for loop in reverse order using std::make_reverse_iterator. More...
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 typedef for the iterator used for iterating through this workbook (const) in a range-based for loop in reverse order using std::make_reverse_iterator. More...
 

Public Member Functions

 workbook ()
 Default constructor. Constructs a workbook containing a single empty worksheet using workbook::empty(). More...
 
 workbook (const xlnt::path &file)
 load the xlsx file at path More...
 
 workbook (const xlnt::path &file, const std::string &password)
 load the encrpyted xlsx file at path More...
 
 workbook (std::istream &data)
 construct the workbook from any data stream where the data is the binary form of a workbook More...
 
 workbook (std::istream &data, const std::string &password)
 construct the workbook from any data stream where the data is the binary form of an encrypted workbook More...
 
 workbook (workbook &&other)
 Move constructor. Constructs a workbook from existing workbook, other. More...
 
 workbook (const workbook &other)
 Copy constructor. Constructs this workbook from existing workbook, other. More...
 
 ~workbook ()
 Destroys this workbook, deallocating all internal storage space. Any pimpl wrapper classes (e.g. cell) pointing into this workbook will be invalid after this is executed. More...
 
worksheet create_sheet ()
 Creates and returns a sheet after the last sheet in this workbook. More...
 
worksheet create_sheet (std::size_t index)
 Creates and returns a sheet at the specified index. More...
 
worksheet create_sheet_with_rel (const std::string &title, const relationship &rel)
 TODO: This should be private... More...
 
worksheet copy_sheet (worksheet worksheet)
 Creates and returns a new sheet after the last sheet initializing it with all of the data from the provided worksheet. More...
 
worksheet copy_sheet (worksheet worksheet, std::size_t index)
 Creates and returns a new sheet at the specified index initializing it with all of the data from the provided worksheet. More...
 
worksheet active_sheet ()
 Returns the worksheet that is determined to be active. An active sheet is that which is initially shown by the spreadsheet editor. More...
 
void active_sheet (std::size_t index)
 Sets the worksheet that is determined to be active. An active sheet is that which is initially shown by the spreadsheet editor. More...
 
worksheet sheet_by_title (const std::string &title)
 Returns the worksheet with the given name. This may throw an exception if the sheet isn't found. Use workbook::contains(const std::string &) to make sure the sheet exists before calling this method. More...
 
const worksheet sheet_by_title (const std::string &title) const
 Returns the worksheet with the given name. This may throw an exception if the sheet isn't found. Use workbook::contains(const std::string &) to make sure the sheet exists before calling this method. More...
 
worksheet sheet_by_index (std::size_t index)
 Returns the worksheet at the given index. This will throw an exception if index is greater than or equal to the number of sheets in this workbook. More...
 
const worksheet sheet_by_index (std::size_t index) const
 Returns the worksheet at the given index. This will throw an exception if index is greater than or equal to the number of sheets in this workbook. More...
 
worksheet sheet_by_id (std::size_t id)
 Returns the worksheet with a sheetId of id. Sheet IDs are arbitrary numbers that uniquely identify a sheet. Most users won't need this. More...
 
const worksheet sheet_by_id (std::size_t id) const
 Returns the worksheet with a sheetId of id. Sheet IDs are arbitrary numbers that uniquely identify a sheet. Most users won't need this. More...
 
bool sheet_hidden_by_index (std::size_t index) const
 Returns the hidden identifier of the worksheet at the given index. This will throw an exception if index is greater than or equal to the number of sheets in this workbook. More...
 
bool contains (const std::string &title) const
 Returns true if this workbook contains a sheet with the given title. More...
 
std::size_t index (worksheet worksheet)
 Returns the index of the given worksheet. The worksheet must be owned by this workbook. More...
 
void remove_sheet (worksheet worksheet)
 Removes the given worksheet from this workbook. More...
 
void clear ()
 Sets the contents of this workbook to be equivalent to that of a workbook returned by workbook::empty(). More...
 
iterator begin ()
 Returns an iterator to the first worksheet in this workbook. More...
 
iterator end ()
 Returns an iterator to the worksheet following the last worksheet of the workbook. This worksheet acts as a placeholder; attempting to access it will cause an exception to be thrown. More...
 
const_iterator begin () const
 Returns a const iterator to the first worksheet in this workbook. More...
 
const_iterator end () const
 Returns a const iterator to the worksheet following the last worksheet of the workbook. This worksheet acts as a placeholder; attempting to access it will cause an exception to be thrown. More...
 
const_iterator cbegin () const
 Returns an iterator to the first worksheet in this workbook. More...
 
const_iterator cend () const
 Returns a const iterator to the worksheet following the last worksheet of the workbook. This worksheet acts as a placeholder; attempting to access it will cause an exception to be thrown. More...
 
void apply_to_cells (std::function< void(cell)> f)
 Applies the function "f" to every non-empty cell in every worksheet in this workbook. More...
 
std::vector< std::string > sheet_titles () const
 Returns a temporary vector containing the titles of each sheet in the order of the sheets in the workbook. More...
 
std::size_t sheet_count () const
 Returns the number of sheets in this workbook. More...
 
bool has_core_property (xlnt::core_property type) const
 Returns true if the workbook has the core property with the given name. More...
 
std::vector< xlnt::core_propertycore_properties () const
 Returns a vector of the type of each core property that is set to a particular value in this workbook. More...
 
variant core_property (xlnt::core_property type) const
 Returns the value of the given core property. More...
 
void core_property (xlnt::core_property type, const variant &value)
 Sets the given core property to the provided value. More...
 
bool has_extended_property (xlnt::extended_property type) const
 Returns true if the workbook has the extended property with the given name. More...
 
std::vector< xlnt::extended_propertyextended_properties () const
 Returns a vector of the type of each extended property that is set to a particular value in this workbook. More...
 
variant extended_property (xlnt::extended_property type) const
 Returns the value of the given extended property. More...
 
void extended_property (xlnt::extended_property type, const variant &value)
 Sets the given extended property to the provided value. More...
 
bool has_custom_property (const std::string &property_name) const
 Returns true if the workbook has the custom property with the given name. More...
 
std::vector< std::string > custom_properties () const
 Returns a vector of the name of each custom property that is set to a particular value in this workbook. More...
 
variant custom_property (const std::string &property_name) const
 Returns the value of the given custom property. More...
 
void custom_property (const std::string &property_name, const variant &value)
 Creates a new custom property in this workbook and sets it to the provided value. More...
 
calendar base_date () const
 Returns the base date used by this workbook. This will generally be windows_1900 except on Apple based systems when it will default to mac_1904 unless otherwise set via void workbook::base_date(calendar base_date). More...
 
void base_date (calendar base_date)
 Sets the base date style of this workbook. This is the date and time that a numeric value of 0 represents. More...
 
bool has_title () const
 Returns true if this workbook has had its title set. More...
 
std::string title () const
 Returns the title of this workbook. More...
 
void title (const std::string &title)
 Sets the title of this workbook to title. More...
 
void abs_path (const std::string &path)
 Sets the absolute path of this workbook to path. More...
 
void arch_id_flags (const std::size_t flags)
 Sets the ArchID flags of this workbook to flags. More...
 
std::vector< xlnt::named_rangenamed_ranges () const
 Returns a vector of the named ranges in this workbook. More...
 
void create_named_range (const std::string &name, worksheet worksheet, const range_reference &reference)
 Creates a new names range. More...
 
void create_named_range (const std::string &name, worksheet worksheet, const std::string &reference_string)
 Creates a new names range. More...
 
bool has_named_range (const std::string &name) const
 Returns true if a named range of the given name exists in the workbook. More...
 
class range named_range (const std::string &name)
 Returns the named range with the given name. More...
 
void remove_named_range (const std::string &name)
 Deletes the named range with the given name. More...
 
void save (std::vector< std::uint8_t > &data) const
 Serializes the workbook into an XLSX file and saves the bytes into byte vector data. More...
 
void save (std::vector< std::uint8_t > &data, const std::string &password) const
 Serializes the workbook into an XLSX file encrypted with the given password and saves the bytes into byte vector data. More...
 
void save (const std::string &filename) const
 Serializes the workbook into an XLSX file and saves the data into a file named filename. More...
 
void save (const std::string &filename, const std::string &password) const
 Serializes the workbook into an XLSX file encrypted with the given password and loads the bytes into a file named filename. More...
 
void save (const xlnt::path &filename) const
 Serializes the workbook into an XLSX file and saves the data into a file named filename. More...
 
void save (const xlnt::path &filename, const std::string &password) const
 Serializes the workbook into an XLSX file encrypted with the given password and loads the bytes into a file named filename. More...
 
void save (std::ostream &stream) const
 Serializes the workbook into an XLSX file and saves the data into stream. More...
 
void save (std::ostream &stream, const std::string &password) const
 Serializes the workbook into an XLSX file encrypted with the given password and loads the bytes into the given stream. More...
 
void load (const std::vector< std::uint8_t > &data)
 Interprets byte vector data as an XLSX file and sets the content of this workbook to match that file. More...
 
void load (const std::vector< std::uint8_t > &data, const std::string &password)
 Interprets byte vector data as an XLSX file encrypted with the given password and sets the content of this workbook to match that file. More...
 
void load (const std::string &filename)
 Interprets file with the given filename as an XLSX file and sets the content of this workbook to match that file. More...
 
void load (const std::string &filename, const std::string &password)
 Interprets file with the given filename as an XLSX file encrypted with the given password and sets the content of this workbook to match that file. More...
 
void load (const xlnt::path &filename)
 Interprets file with the given filename as an XLSX file and sets the content of this workbook to match that file. More...
 
void load (const xlnt::path &filename, const std::string &password)
 Interprets file with the given filename as an XLSX file encrypted with the given password and sets the content of this workbook to match that file. More...
 
void load (std::istream &stream)
 Interprets data in stream as an XLSX file and sets the content of this workbook to match that file. More...
 
void load (std::istream &stream, const std::string &password)
 Interprets data in stream as an XLSX file encrypted with the given password and sets the content of this workbook to match that file. More...
 
bool has_view () const
 Returns true if this workbook has a view. More...
 
workbook_view view () const
 Returns the view. More...
 
void view (const workbook_view &view)
 Sets the view to view. More...
 
bool has_code_name () const
 Returns true if a code name has been set for this workbook. More...
 
std::string code_name () const
 Returns the code name that was set for this workbook. More...
 
void code_name (const std::string &code_name)
 Sets the code name of this workbook to code_name. More...
 
bool has_file_version () const
 Returns true if this workbook has a file version. More...
 
std::string app_name () const
 Returns the AppName workbook file property. More...
 
std::size_t last_edited () const
 Returns the LastEdited workbook file property. More...
 
std::size_t lowest_edited () const
 Returns the LowestEdited workbook file property. More...
 
std::size_t rup_build () const
 Returns the RupBuild workbook file property. More...
 
bool has_theme () const
 Returns true if this workbook has a theme defined. More...
 
const xlnt::themetheme () const
 Returns a const reference to this workbook's theme. More...
 
void theme (const class theme &value)
 Sets the theme to value. More...
 
xlnt::format format (std::size_t format_index)
 Returns the cell format at the given index. The index is the position of the format in xl/styles.xml. More...
 
const xlnt::format format (std::size_t format_index) const
 Returns the cell format at the given index. The index is the position of the format in xl/styles.xml. More...
 
xlnt::format create_format (bool default_format=false)
 Creates a new format and returns it. More...
 
void clear_formats ()
 Clear all cell-level formatting and formats from the styelsheet. This leaves all other styling in place (e.g. named styles). More...
 
bool has_style (const std::string &name) const
 Returns true if this workbook has a style with a name of name. More...
 
class style style (const std::string &name)
 Returns the named style with the given name. More...
 
const class style style (const std::string &name) const
 Returns the named style with the given name. More...
 
class style create_style (const std::string &name)
 Creates a new style and returns it. More...
 
class style create_builtin_style (std::size_t builtin_id)
 Creates a new style and returns it. More...
 
void clear_styles ()
 Clear all named styles from cells and remove the styles from from the styelsheet. This leaves all other styling in place (e.g. cell formats). More...
 
void default_slicer_style (const std::string &value)
 Sets the default slicer style to the given value. More...
 
std::string default_slicer_style () const
 Returns the default slicer style. More...
 
void enable_known_fonts ()
 Enables knownFonts in stylesheet. More...
 
void disable_known_fonts ()
 Disables knownFonts in stylesheet. More...
 
bool known_fonts_enabled () const
 Returns true if knownFonts are enabled in the stylesheet. More...
 
class manifestmanifest ()
 Returns a reference to the workbook's internal manifest. More...
 
const class manifestmanifest () const
 Returns a reference to the workbook's internal manifest. More...
 
std::size_t add_shared_string (const rich_text &shared, bool allow_duplicates=false)
 Append a shared string to the shared string collection in this workbook. This should not generally be called unless you know what you're doing. If allow_duplicates is false and the string is already in the collection, it will not be added. Returns the index of the added string. More...
 
const rich_textshared_strings (std::size_t index) const
 Returns a reference to the shared string related to the specified index More...
 
std::vector< rich_text > & shared_strings ()
 Returns a reference to the shared strings being used by cells in this workbook. More...
 
const std::vector< rich_text > & shared_strings () const
 Returns a reference to the shared strings being used by cells in this workbook. More...
 
void thumbnail (const std::vector< std::uint8_t > &thumbnail, const std::string &extension, const std::string &content_type)
 Sets the workbook's thumbnail to the given vector of bytes, thumbnail, with the given extension (e.g. jpg) and content_type (e.g. image/jpeg). More...
 
const std::vector< std::uint8_t > & thumbnail () const
 Returns a vector of bytes representing the workbook's thumbnail. More...
 
const std::unordered_map< std::string, std::vector< std::uint8_t > > & binaries () const
 Returns stored binary data. More...
 
bool has_calculation_properties () const
 Returns true if this workbook has any calculation properties set. More...
 
class calculation_properties calculation_properties () const
 Returns the calculation properties used in this workbook. More...
 
void calculation_properties (const class calculation_properties &props)
 Sets the calculation properties of this workbook to props. More...
 
workbookoperator= (workbook other)
 Set the contents of this workbook to be equal to those of "other". Other is passed as value to allow for copy-swap idiom. More...
 
worksheet operator[] (const std::string &name)
 Return the worksheet with a title of "name". More...
 
worksheet operator[] (std::size_t index)
 Return the worksheet at "index". More...
 
bool operator== (const workbook &rhs) const
 Return true if this workbook internal implementation points to the same memory as rhs's. More...
 
bool operator!= (const workbook &rhs) const
 Return true if this workbook internal implementation doesn't point to the same memory as rhs's. More...
 

Static Public Member Functions

static workbook empty ()
 Constructs and returns an empty workbook similar to a default. Excel workbook More...
 

Friends

class streaming_workbook_reader
 
class worksheet
 
class detail::xlsx_consumer
 
class detail::xlsx_producer
 

Detailed Description

workbook is the container for all other parts of the document.

Member Typedef Documentation

◆ const_iterator

typedef for the iterator used for iterating through this workbook (const) in a range-based for loop.

◆ const_reverse_iterator

typedef for the iterator used for iterating through this workbook (const) in a range-based for loop in reverse order using std::make_reverse_iterator.

◆ iterator

typedef for the iterator used for iterating through this workbook (non-const) in a range-based for loop.

◆ reverse_iterator

using xlnt::workbook::reverse_iterator = std::reverse_iterator<iterator>

typedef for the iterator used for iterating through this workbook (non-const) in a range-based for loop in reverse order using std::make_reverse_iterator.

Constructor & Destructor Documentation

◆ workbook() [1/7]

xlnt::workbook::workbook ( )

Default constructor. Constructs a workbook containing a single empty worksheet using workbook::empty().

◆ workbook() [2/7]

xlnt::workbook::workbook ( const xlnt::path file)

load the xlsx file at path

◆ workbook() [3/7]

xlnt::workbook::workbook ( const xlnt::path file,
const std::string &  password 
)

load the encrpyted xlsx file at path

◆ workbook() [4/7]

xlnt::workbook::workbook ( std::istream &  data)

construct the workbook from any data stream where the data is the binary form of a workbook

◆ workbook() [5/7]

xlnt::workbook::workbook ( std::istream &  data,
const std::string &  password 
)

construct the workbook from any data stream where the data is the binary form of an encrypted workbook

◆ workbook() [6/7]

xlnt::workbook::workbook ( workbook &&  other)

Move constructor. Constructs a workbook from existing workbook, other.

◆ workbook() [7/7]

xlnt::workbook::workbook ( const workbook other)

Copy constructor. Constructs this workbook from existing workbook, other.

◆ ~workbook()

xlnt::workbook::~workbook ( )

Destroys this workbook, deallocating all internal storage space. Any pimpl wrapper classes (e.g. cell) pointing into this workbook will be invalid after this is executed.

Member Function Documentation

◆ abs_path()

void xlnt::workbook::abs_path ( const std::string &  path)

Sets the absolute path of this workbook to path.

◆ active_sheet() [1/2]

worksheet xlnt::workbook::active_sheet ( )

Returns the worksheet that is determined to be active. An active sheet is that which is initially shown by the spreadsheet editor.

◆ active_sheet() [2/2]

void xlnt::workbook::active_sheet ( std::size_t  index)

Sets the worksheet that is determined to be active. An active sheet is that which is initially shown by the spreadsheet editor.

◆ add_shared_string()

std::size_t xlnt::workbook::add_shared_string ( const rich_text shared,
bool  allow_duplicates = false 
)

Append a shared string to the shared string collection in this workbook. This should not generally be called unless you know what you're doing. If allow_duplicates is false and the string is already in the collection, it will not be added. Returns the index of the added string.

◆ app_name()

std::string xlnt::workbook::app_name ( ) const

Returns the AppName workbook file property.

◆ apply_to_cells()

void xlnt::workbook::apply_to_cells ( std::function< void(cell)>  f)

Applies the function "f" to every non-empty cell in every worksheet in this workbook.

◆ arch_id_flags()

void xlnt::workbook::arch_id_flags ( const std::size_t  flags)

Sets the ArchID flags of this workbook to flags.

◆ base_date() [1/2]

calendar xlnt::workbook::base_date ( ) const

Returns the base date used by this workbook. This will generally be windows_1900 except on Apple based systems when it will default to mac_1904 unless otherwise set via void workbook::base_date(calendar base_date).

◆ base_date() [2/2]

void xlnt::workbook::base_date ( calendar  base_date)

Sets the base date style of this workbook. This is the date and time that a numeric value of 0 represents.

◆ begin() [1/2]

iterator xlnt::workbook::begin ( )

Returns an iterator to the first worksheet in this workbook.

◆ begin() [2/2]

const_iterator xlnt::workbook::begin ( ) const

Returns a const iterator to the first worksheet in this workbook.

◆ binaries()

const std::unordered_map<std::string, std::vector<std::uint8_t> >& xlnt::workbook::binaries ( ) const

Returns stored binary data.

◆ calculation_properties() [1/2]

class calculation_properties xlnt::workbook::calculation_properties ( ) const

Returns the calculation properties used in this workbook.

◆ calculation_properties() [2/2]

void xlnt::workbook::calculation_properties ( const class calculation_properties props)

Sets the calculation properties of this workbook to props.

◆ cbegin()

const_iterator xlnt::workbook::cbegin ( ) const

Returns an iterator to the first worksheet in this workbook.

◆ cend()

const_iterator xlnt::workbook::cend ( ) const

Returns a const iterator to the worksheet following the last worksheet of the workbook. This worksheet acts as a placeholder; attempting to access it will cause an exception to be thrown.

◆ clear()

void xlnt::workbook::clear ( )

Sets the contents of this workbook to be equivalent to that of a workbook returned by workbook::empty().

◆ clear_formats()

void xlnt::workbook::clear_formats ( )

Clear all cell-level formatting and formats from the styelsheet. This leaves all other styling in place (e.g. named styles).

◆ clear_styles()

void xlnt::workbook::clear_styles ( )

Clear all named styles from cells and remove the styles from from the styelsheet. This leaves all other styling in place (e.g. cell formats).

◆ code_name() [1/2]

std::string xlnt::workbook::code_name ( ) const

Returns the code name that was set for this workbook.

◆ code_name() [2/2]

void xlnt::workbook::code_name ( const std::string &  code_name)

Sets the code name of this workbook to code_name.

◆ contains()

bool xlnt::workbook::contains ( const std::string &  title) const

Returns true if this workbook contains a sheet with the given title.

◆ copy_sheet() [1/2]

worksheet xlnt::workbook::copy_sheet ( worksheet  worksheet)

Creates and returns a new sheet after the last sheet initializing it with all of the data from the provided worksheet.

◆ copy_sheet() [2/2]

worksheet xlnt::workbook::copy_sheet ( worksheet  worksheet,
std::size_t  index 
)

Creates and returns a new sheet at the specified index initializing it with all of the data from the provided worksheet.

◆ core_properties()

std::vector<xlnt::core_property> xlnt::workbook::core_properties ( ) const

Returns a vector of the type of each core property that is set to a particular value in this workbook.

◆ core_property() [1/2]

variant xlnt::workbook::core_property ( xlnt::core_property  type) const

Returns the value of the given core property.

◆ core_property() [2/2]

void xlnt::workbook::core_property ( xlnt::core_property  type,
const variant value 
)

Sets the given core property to the provided value.

◆ create_builtin_style()

class style xlnt::workbook::create_builtin_style ( std::size_t  builtin_id)

Creates a new style and returns it.

◆ create_format()

xlnt::format xlnt::workbook::create_format ( bool  default_format = false)

Creates a new format and returns it.

◆ create_named_range() [1/2]

void xlnt::workbook::create_named_range ( const std::string &  name,
worksheet  worksheet,
const range_reference reference 
)

Creates a new names range.

◆ create_named_range() [2/2]

void xlnt::workbook::create_named_range ( const std::string &  name,
worksheet  worksheet,
const std::string &  reference_string 
)

Creates a new names range.

◆ create_sheet() [1/2]

worksheet xlnt::workbook::create_sheet ( )

Creates and returns a sheet after the last sheet in this workbook.

◆ create_sheet() [2/2]

worksheet xlnt::workbook::create_sheet ( std::size_t  index)

Creates and returns a sheet at the specified index.

◆ create_sheet_with_rel()

worksheet xlnt::workbook::create_sheet_with_rel ( const std::string &  title,
const relationship rel 
)

TODO: This should be private...

◆ create_style()

class style xlnt::workbook::create_style ( const std::string &  name)

Creates a new style and returns it.

◆ custom_properties()

std::vector<std::string> xlnt::workbook::custom_properties ( ) const

Returns a vector of the name of each custom property that is set to a particular value in this workbook.

◆ custom_property() [1/2]

variant xlnt::workbook::custom_property ( const std::string &  property_name) const

Returns the value of the given custom property.

◆ custom_property() [2/2]

void xlnt::workbook::custom_property ( const std::string &  property_name,
const variant value 
)

Creates a new custom property in this workbook and sets it to the provided value.

◆ default_slicer_style() [1/2]

void xlnt::workbook::default_slicer_style ( const std::string &  value)

Sets the default slicer style to the given value.

◆ default_slicer_style() [2/2]

std::string xlnt::workbook::default_slicer_style ( ) const

Returns the default slicer style.

◆ disable_known_fonts()

void xlnt::workbook::disable_known_fonts ( )

Disables knownFonts in stylesheet.

◆ empty()

static workbook xlnt::workbook::empty ( )
static

Constructs and returns an empty workbook similar to a default. Excel workbook

◆ enable_known_fonts()

void xlnt::workbook::enable_known_fonts ( )

Enables knownFonts in stylesheet.

◆ end() [1/2]

iterator xlnt::workbook::end ( )

Returns an iterator to the worksheet following the last worksheet of the workbook. This worksheet acts as a placeholder; attempting to access it will cause an exception to be thrown.

◆ end() [2/2]

const_iterator xlnt::workbook::end ( ) const

Returns a const iterator to the worksheet following the last worksheet of the workbook. This worksheet acts as a placeholder; attempting to access it will cause an exception to be thrown.

◆ extended_properties()

std::vector<xlnt::extended_property> xlnt::workbook::extended_properties ( ) const

Returns a vector of the type of each extended property that is set to a particular value in this workbook.

◆ extended_property() [1/2]

variant xlnt::workbook::extended_property ( xlnt::extended_property  type) const

Returns the value of the given extended property.

◆ extended_property() [2/2]

void xlnt::workbook::extended_property ( xlnt::extended_property  type,
const variant value 
)

Sets the given extended property to the provided value.

◆ format() [1/2]

xlnt::format xlnt::workbook::format ( std::size_t  format_index)

Returns the cell format at the given index. The index is the position of the format in xl/styles.xml.

◆ format() [2/2]

const xlnt::format xlnt::workbook::format ( std::size_t  format_index) const

Returns the cell format at the given index. The index is the position of the format in xl/styles.xml.

◆ has_calculation_properties()

bool xlnt::workbook::has_calculation_properties ( ) const

Returns true if this workbook has any calculation properties set.

◆ has_code_name()

bool xlnt::workbook::has_code_name ( ) const

Returns true if a code name has been set for this workbook.

◆ has_core_property()

bool xlnt::workbook::has_core_property ( xlnt::core_property  type) const

Returns true if the workbook has the core property with the given name.

◆ has_custom_property()

bool xlnt::workbook::has_custom_property ( const std::string &  property_name) const

Returns true if the workbook has the custom property with the given name.

◆ has_extended_property()

bool xlnt::workbook::has_extended_property ( xlnt::extended_property  type) const

Returns true if the workbook has the extended property with the given name.

◆ has_file_version()

bool xlnt::workbook::has_file_version ( ) const

Returns true if this workbook has a file version.

◆ has_named_range()

bool xlnt::workbook::has_named_range ( const std::string &  name) const

Returns true if a named range of the given name exists in the workbook.

◆ has_style()

bool xlnt::workbook::has_style ( const std::string &  name) const

Returns true if this workbook has a style with a name of name.

◆ has_theme()

bool xlnt::workbook::has_theme ( ) const

Returns true if this workbook has a theme defined.

◆ has_title()

bool xlnt::workbook::has_title ( ) const

Returns true if this workbook has had its title set.

◆ has_view()

bool xlnt::workbook::has_view ( ) const

Returns true if this workbook has a view.

◆ index()

std::size_t xlnt::workbook::index ( worksheet  worksheet)

Returns the index of the given worksheet. The worksheet must be owned by this workbook.

◆ known_fonts_enabled()

bool xlnt::workbook::known_fonts_enabled ( ) const

Returns true if knownFonts are enabled in the stylesheet.

◆ last_edited()

std::size_t xlnt::workbook::last_edited ( ) const

Returns the LastEdited workbook file property.

◆ load() [1/8]

void xlnt::workbook::load ( const std::vector< std::uint8_t > &  data)

Interprets byte vector data as an XLSX file and sets the content of this workbook to match that file.

◆ load() [2/8]

void xlnt::workbook::load ( const std::vector< std::uint8_t > &  data,
const std::string &  password 
)

Interprets byte vector data as an XLSX file encrypted with the given password and sets the content of this workbook to match that file.

◆ load() [3/8]

void xlnt::workbook::load ( const std::string &  filename)

Interprets file with the given filename as an XLSX file and sets the content of this workbook to match that file.

◆ load() [4/8]

void xlnt::workbook::load ( const std::string &  filename,
const std::string &  password 
)

Interprets file with the given filename as an XLSX file encrypted with the given password and sets the content of this workbook to match that file.

◆ load() [5/8]

void xlnt::workbook::load ( const xlnt::path filename)

Interprets file with the given filename as an XLSX file and sets the content of this workbook to match that file.

◆ load() [6/8]

void xlnt::workbook::load ( const xlnt::path filename,
const std::string &  password 
)

Interprets file with the given filename as an XLSX file encrypted with the given password and sets the content of this workbook to match that file.

◆ load() [7/8]

void xlnt::workbook::load ( std::istream &  stream)

Interprets data in stream as an XLSX file and sets the content of this workbook to match that file.

◆ load() [8/8]

void xlnt::workbook::load ( std::istream &  stream,
const std::string &  password 
)

Interprets data in stream as an XLSX file encrypted with the given password and sets the content of this workbook to match that file.

◆ lowest_edited()

std::size_t xlnt::workbook::lowest_edited ( ) const

Returns the LowestEdited workbook file property.

◆ manifest() [1/2]

class manifest& xlnt::workbook::manifest ( )

Returns a reference to the workbook's internal manifest.

◆ manifest() [2/2]

const class manifest& xlnt::workbook::manifest ( ) const

Returns a reference to the workbook's internal manifest.

◆ named_range()

class range xlnt::workbook::named_range ( const std::string &  name)

Returns the named range with the given name.

◆ named_ranges()

std::vector<xlnt::named_range> xlnt::workbook::named_ranges ( ) const

Returns a vector of the named ranges in this workbook.

◆ operator!=()

bool xlnt::workbook::operator!= ( const workbook rhs) const

Return true if this workbook internal implementation doesn't point to the same memory as rhs's.

◆ operator=()

workbook& xlnt::workbook::operator= ( workbook  other)

Set the contents of this workbook to be equal to those of "other". Other is passed as value to allow for copy-swap idiom.

◆ operator==()

bool xlnt::workbook::operator== ( const workbook rhs) const

Return true if this workbook internal implementation points to the same memory as rhs's.

◆ operator[]() [1/2]

worksheet xlnt::workbook::operator[] ( const std::string &  name)

Return the worksheet with a title of "name".

◆ operator[]() [2/2]

worksheet xlnt::workbook::operator[] ( std::size_t  index)

Return the worksheet at "index".

◆ remove_named_range()

void xlnt::workbook::remove_named_range ( const std::string &  name)

Deletes the named range with the given name.

◆ remove_sheet()

void xlnt::workbook::remove_sheet ( worksheet  worksheet)

Removes the given worksheet from this workbook.

◆ rup_build()

std::size_t xlnt::workbook::rup_build ( ) const

Returns the RupBuild workbook file property.

◆ save() [1/8]

void xlnt::workbook::save ( std::vector< std::uint8_t > &  data) const

Serializes the workbook into an XLSX file and saves the bytes into byte vector data.

◆ save() [2/8]

void xlnt::workbook::save ( std::vector< std::uint8_t > &  data,
const std::string &  password 
) const

Serializes the workbook into an XLSX file encrypted with the given password and saves the bytes into byte vector data.

◆ save() [3/8]

void xlnt::workbook::save ( const std::string &  filename) const

Serializes the workbook into an XLSX file and saves the data into a file named filename.

◆ save() [4/8]

void xlnt::workbook::save ( const std::string &  filename,
const std::string &  password 
) const

Serializes the workbook into an XLSX file encrypted with the given password and loads the bytes into a file named filename.

◆ save() [5/8]

void xlnt::workbook::save ( const xlnt::path filename) const

Serializes the workbook into an XLSX file and saves the data into a file named filename.

◆ save() [6/8]

void xlnt::workbook::save ( const xlnt::path filename,
const std::string &  password 
) const

Serializes the workbook into an XLSX file encrypted with the given password and loads the bytes into a file named filename.

◆ save() [7/8]

void xlnt::workbook::save ( std::ostream &  stream) const

Serializes the workbook into an XLSX file and saves the data into stream.

◆ save() [8/8]

void xlnt::workbook::save ( std::ostream &  stream,
const std::string &  password 
) const

Serializes the workbook into an XLSX file encrypted with the given password and loads the bytes into the given stream.

◆ shared_strings() [1/3]

const rich_text& xlnt::workbook::shared_strings ( std::size_t  index) const

Returns a reference to the shared string related to the specified index

◆ shared_strings() [2/3]

std::vector<rich_text>& xlnt::workbook::shared_strings ( )

Returns a reference to the shared strings being used by cells in this workbook.

◆ shared_strings() [3/3]

const std::vector<rich_text>& xlnt::workbook::shared_strings ( ) const

Returns a reference to the shared strings being used by cells in this workbook.

◆ sheet_by_id() [1/2]

worksheet xlnt::workbook::sheet_by_id ( std::size_t  id)

Returns the worksheet with a sheetId of id. Sheet IDs are arbitrary numbers that uniquely identify a sheet. Most users won't need this.

◆ sheet_by_id() [2/2]

const worksheet xlnt::workbook::sheet_by_id ( std::size_t  id) const

Returns the worksheet with a sheetId of id. Sheet IDs are arbitrary numbers that uniquely identify a sheet. Most users won't need this.

◆ sheet_by_index() [1/2]

worksheet xlnt::workbook::sheet_by_index ( std::size_t  index)

Returns the worksheet at the given index. This will throw an exception if index is greater than or equal to the number of sheets in this workbook.

◆ sheet_by_index() [2/2]

const worksheet xlnt::workbook::sheet_by_index ( std::size_t  index) const

Returns the worksheet at the given index. This will throw an exception if index is greater than or equal to the number of sheets in this workbook.

◆ sheet_by_title() [1/2]

worksheet xlnt::workbook::sheet_by_title ( const std::string &  title)

Returns the worksheet with the given name. This may throw an exception if the sheet isn't found. Use workbook::contains(const std::string &) to make sure the sheet exists before calling this method.

◆ sheet_by_title() [2/2]

const worksheet xlnt::workbook::sheet_by_title ( const std::string &  title) const

Returns the worksheet with the given name. This may throw an exception if the sheet isn't found. Use workbook::contains(const std::string &) to make sure the sheet exists before calling this method.

◆ sheet_count()

std::size_t xlnt::workbook::sheet_count ( ) const

Returns the number of sheets in this workbook.

◆ sheet_hidden_by_index()

bool xlnt::workbook::sheet_hidden_by_index ( std::size_t  index) const

Returns the hidden identifier of the worksheet at the given index. This will throw an exception if index is greater than or equal to the number of sheets in this workbook.

◆ sheet_titles()

std::vector<std::string> xlnt::workbook::sheet_titles ( ) const

Returns a temporary vector containing the titles of each sheet in the order of the sheets in the workbook.

◆ style() [1/2]

class style xlnt::workbook::style ( const std::string &  name)

Returns the named style with the given name.

◆ style() [2/2]

const class style xlnt::workbook::style ( const std::string &  name) const

Returns the named style with the given name.

◆ theme() [1/2]

const xlnt::theme& xlnt::workbook::theme ( ) const

Returns a const reference to this workbook's theme.

◆ theme() [2/2]

void xlnt::workbook::theme ( const class theme value)

Sets the theme to value.

◆ thumbnail() [1/2]

void xlnt::workbook::thumbnail ( const std::vector< std::uint8_t > &  thumbnail,
const std::string &  extension,
const std::string &  content_type 
)

Sets the workbook's thumbnail to the given vector of bytes, thumbnail, with the given extension (e.g. jpg) and content_type (e.g. image/jpeg).

◆ thumbnail() [2/2]

const std::vector<std::uint8_t>& xlnt::workbook::thumbnail ( ) const

Returns a vector of bytes representing the workbook's thumbnail.

◆ title() [1/2]

std::string xlnt::workbook::title ( ) const

Returns the title of this workbook.

◆ title() [2/2]

void xlnt::workbook::title ( const std::string &  title)

Sets the title of this workbook to title.

◆ view() [1/2]

workbook_view xlnt::workbook::view ( ) const

Returns the view.

◆ view() [2/2]

void xlnt::workbook::view ( const workbook_view view)

Sets the view to view.


The documentation for this class was generated from the following file: