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

A worksheet is a 2D array of cells starting with cell A1 in the top-left corner and extending indefinitely down and right as needed. More...

#include <worksheet.hpp>

Public Types

using iterator = range_iterator
 Iterate over a non-const worksheet with an iterator of this type. More...
 
using const_iterator = const_range_iterator
 Iterate over a non-const worksheet with an iterator of this type. More...
 
using reverse_iterator = std::reverse_iterator< iterator >
 Iterate in reverse over a non-const worksheet with an iterator of this type. More...
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 Iterate in reverse order over a const worksheet with an iterator of this type. More...
 

Public Member Functions

 worksheet ()
 Construct a null worksheet. No methods should be called on such a worksheet. More...
 
 worksheet (const worksheet &rhs)
 Copy constructor. This worksheet will point to the same memory as rhs's worksheet. More...
 
class workbookworkbook ()
 Returns a reference to the workbook this worksheet is owned by. More...
 
const class workbookworkbook () const
 Returns a reference to the workbook this worksheet is owned by. More...
 
void garbage_collect ()
 Deletes data held in the worksheet that does not affect the internal data or display. For example, unreference styles and empty cells will be removed. More...
 
std::size_t id () const
 Returns the unique numeric identifier of this worksheet. This will sometimes but not necessarily be the index of the worksheet in the workbook. More...
 
void id (std::size_t id)
 Set the unique numeric identifier. The id defaults to the lowest unused id in the workbook so this should not be called without a good reason. More...
 
std::string title () const
 Returns the title of this sheet. More...
 
void title (const std::string &title)
 Sets the title of this sheet. More...
 
cell_reference frozen_panes () const
 Returns the top left corner of the region above and to the left of which panes are frozen. More...
 
void freeze_panes (cell top_left_cell)
 Freeze panes above and to the left of top_left_cell. More...
 
void freeze_panes (const cell_reference &top_left_coordinate)
 Freeze panes above and to the left of top_left_coordinate. More...
 
void unfreeze_panes ()
 Remove frozen panes. The data in those panes will be unaffected–this affects only the view. More...
 
bool has_frozen_panes () const
 Returns true if this sheet has a frozen row, frozen column, or both. More...
 
bool has_cell (const cell_reference &reference) const
 Returns true if this sheet has an initialized cell at the given reference. More...
 
class cell cell (const cell_reference &reference)
 Returns the cell at the given reference. If the cell doesn't exist, it will be initialized to null before being returned. More...
 
const class cell cell (const cell_reference &reference) const
 Returns the cell at the given reference. If the cell doesn't exist, an invalid_parameter exception will be thrown. More...
 
class cell cell (column_t column, row_t row)
 Returns the cell at the given column and row. If the cell doesn't exist, it will be initialized to null before being returned. More...
 
const class cell cell (column_t column, row_t row) const
 Returns the cell at the given column and row. If the cell doesn't exist, an invalid_parameter exception will be thrown. More...
 
class range range (const std::string &reference_string)
 Returns the range defined by reference string. If reference string is the name of a previously-defined named range in the sheet, it will be returned. More...
 
const class range range (const std::string &reference_string) const
 Returns the range defined by reference string. If reference string is the name of a previously-defined named range in the sheet, it will be returned. More...
 
class range range (const range_reference &reference)
 Returns the range defined by reference. More...
 
const class range range (const range_reference &reference) const
 Returns the range defined by reference. More...
 
class range rows (bool skip_null=true)
 Returns a range encompassing all cells in this sheet which will be iterated upon in row-major order. If skip_null is true (default), the range does not contain empty rows/columns at its boundaries and empty rows and cells will be skipped during iteration of the range. More...
 
const class range rows (bool skip_null=true) const
 Returns a range encompassing all cells in this sheet which will be iterated upon in row-major order. If skip_null is true (default), the range does not contain empty rows/columns at its boundaries and empty rows and cells will be skipped during iteration of the range. More...
 
class range columns (bool skip_null=true)
 Returns a range ecompassing all cells in this sheet which will be iterated upon in column-major order. If skip_null is true (default), the range does not contain empty rows/columns at its boundaries and empty columns and cells will be skipped during iteration of the range. More...
 
const class range columns (bool skip_null=true) const
 Returns a range ecompassing all cells in this sheet which will be iterated upon in column-major order. If skip_null is true (default), the range does not contain empty rows/columns at its boundaries and empty columns and cells will be skipped during iteration of the range. More...
 
void clear_cell (const cell_reference &ref)
 Clears memory used by the given cell. More...
 
void clear_row (row_t row)
 Clears memory used by all cells in the given row. More...
 
void insert_rows (row_t row, std::uint32_t amount)
 Insert empty rows before the given row index More...
 
void insert_columns (column_t column, std::uint32_t amount)
 Insert empty columns before the given column index More...
 
void delete_rows (row_t row, std::uint32_t amount)
 Delete rows before the given row index More...
 
void delete_columns (column_t column, std::uint32_t amount)
 Delete columns before the given column index More...
 
xlnt::column_propertiescolumn_properties (column_t column)
 Returns the column properties for the given column. More...
 
const xlnt::column_propertiescolumn_properties (column_t column) const
 Returns the column properties for the given column. More...
 
bool has_column_properties (column_t column) const
 Returns true if column properties have been set for the given column. More...
 
void add_column_properties (column_t column, const class column_properties &props)
 Sets column properties for the given column to props. More...
 
double column_width (column_t column) const
 Calculates the width of the given column. This will be the default column width if a custom width is not set on this column's column_properties. More...
 
xlnt::row_propertiesrow_properties (row_t row)
 Returns the row properties for the given row. More...
 
const xlnt::row_propertiesrow_properties (row_t row) const
 Returns the row properties for the given row. More...
 
bool has_row_properties (row_t row) const
 Returns true if row properties have been set for the given row. More...
 
void add_row_properties (row_t row, const class row_properties &props)
 Sets row properties for the given row to props. More...
 
double row_height (row_t row) const
 Calculate the height of the given row. This will be the default row height if a custom height is not set on this row's row_properties. More...
 
cell_reference point_pos (int left, int top) const
 Returns a reference to the cell at the given point coordinates. More...
 
void create_named_range (const std::string &name, const std::string &reference_string)
 Creates a new named range with the given name encompassing the string representing a range. More...
 
void create_named_range (const std::string &name, const range_reference &reference)
 Creates a new named range with the given name encompassing the given range reference. More...
 
bool has_named_range (const std::string &name) const
 Returns true if this worksheet contains a named range with the given name. More...
 
class range named_range (const std::string &name)
 Returns the named range with the given name. Throws key_not_found exception if the named range doesn't exist. More...
 
const class range named_range (const std::string &name) const
 Returns the named range with the given name. Throws key_not_found exception if the named range doesn't exist. More...
 
void remove_named_range (const std::string &name)
 Removes a named range with the given name. More...
 
row_t lowest_row () const
 Returns the row of the first non-empty cell in the worksheet. More...
 
row_t lowest_row_or_props () const
 Returns the row of the first non-empty cell or lowest row with properties in the worksheet. More...
 
row_t highest_row () const
 Returns the row of the last non-empty cell in the worksheet. More...
 
row_t highest_row_or_props () const
 Returns the row of the last non-empty cell or highest row with properties in the worksheet. More...
 
row_t next_row () const
 Returns the row directly below the last non-empty cell in the worksheet. More...
 
column_t lowest_column () const
 Returns the column of the first non-empty cell in the worksheet. More...
 
column_t lowest_column_or_props () const
 Returns the column of the first non-empty cell or lowest column with properties in the worksheet. More...
 
column_t highest_column () const
 Returns the column of the last non-empty cell in the worksheet. More...
 
column_t highest_column_or_props () const
 Returns the column of the last non-empty cell or highest column with properties in the worksheet. More...
 
range_reference calculate_dimension (bool skip_null=true, bool skip_row_props=false) const
 Returns a range_reference pointing to the full range of cells in the worksheet. If skip_null is true (default), empty cells (For example if the first row or column is empty) will not be included in upper left bound of range. If skip_row_props is false (default), rows with only properties being defined will be returned too. More...
 
void merge_cells (const std::string &reference_string)
 Merges the cells within the range represented by the given string. More...
 
void merge_cells (const range_reference &reference)
 Merges the cells within the given range. More...
 
void unmerge_cells (const std::string &reference_string)
 Removes the merging of the cells in the range represented by the given string. More...
 
void unmerge_cells (const range_reference &reference)
 Removes the merging of the cells in the given range. More...
 
std::vector< range_referencemerged_ranges () const
 Returns a vector of references of all merged ranges in the worksheet. More...
 
bool operator== (const worksheet &other) const
 Returns true if this worksheet refers to the same worksheet as other. More...
 
bool operator!= (const worksheet &other) const
 Returns true if this worksheet doesn't refer to the same worksheet as other. More...
 
bool operator== (std::nullptr_t) const
 Returns true if this worksheet is null. More...
 
bool operator!= (std::nullptr_t) const
 Returns true if this worksheet is not null. More...
 
void operator= (const worksheet &other)
 Sets the internal pointer of this worksheet object to point to other. More...
 
class cell operator[] (const cell_reference &reference)
 Convenience method for worksheet::cell method. More...
 
const class cell operator[] (const cell_reference &reference) const
 Convenience method for worksheet::cell method. More...
 
bool compare (const worksheet &other, bool reference) const
 Returns true if this worksheet is equal to other. If reference is true, the comparison will only check that both worksheets point to the same sheet in the same workbook. More...
 
bool has_page_setup () const
 Returns true if this worksheet has a page setup. More...
 
xlnt::page_setup page_setup () const
 Returns the page setup for this sheet. More...
 
void page_setup (const struct page_setup &setup)
 Sets the page setup for this sheet to setup. More...
 
bool has_page_margins () const
 Returns true if this page has margins. More...
 
xlnt::page_margins page_margins () const
 Returns the margins of this sheet. More...
 
void page_margins (const class page_margins &margins)
 Sets the margins of this sheet to margins. More...
 
range_reference auto_filter () const
 Returns the current auto-filter of this sheet. More...
 
void auto_filter (const std::string &range_string)
 Sets the auto-filter of this sheet to the range defined by range_string. More...
 
void auto_filter (const xlnt::range &range)
 Sets the auto-filter of this sheet to the given range. More...
 
void auto_filter (const range_reference &reference)
 Sets the auto-filter of this sheet to the range defined by reference. More...
 
void clear_auto_filter ()
 Clear the auto-filter from this sheet. More...
 
bool has_auto_filter () const
 Returns true if this sheet has an auto-filter set. More...
 
void reserve (std::size_t n)
 Reserve n rows. This can be optionally called before adding many rows to improve performance. More...
 
bool has_phonetic_properties () const
 Returns true if this sheet has phonetic properties More...
 
const phonetic_prphonetic_properties () const
 Returns the phonetic properties of this sheet. More...
 
void phonetic_properties (const phonetic_pr &phonetic_props)
 Sets the phonetic properties of this sheet to phonetic_props More...
 
bool has_header_footer () const
 Returns true if this sheet has a header/footer. More...
 
class header_footer header_footer () const
 Returns the header/footer of this sheet. More...
 
void header_footer (const class header_footer &new_header_footer)
 Sets the header/footer of this sheet to new_header_footer. More...
 
xlnt::sheet_state sheet_state () const
 Returns the sheet state of this sheet. More...
 
void sheet_state (xlnt::sheet_state state)
 Sets the sheet state of this sheet. More...
 
iterator begin ()
 Returns an iterator to the first row in this sheet. More...
 
iterator end ()
 Returns an iterator one past the last row in this sheet. More...
 
const_iterator begin () const
 Return a constant iterator to the first row in this sheet. More...
 
const_iterator end () const
 Returns a constant iterator to one past the last row in this sheet. More...
 
const_iterator cbegin () const
 Return a constant iterator to the first row in this sheet. More...
 
const_iterator cend () const
 Returns a constant iterator to one past the last row in this sheet. More...
 
void print_title_rows (row_t start, row_t end)
 Sets rows to repeat at top during printing. More...
 
optional< std::pair< row_t, row_t > > print_title_rows () const
 Get rows to repeat at top during printing. More...
 
void print_title_cols (column_t start, column_t end)
 Sets columns to repeat at left during printing. More...
 
optional< std::pair< column_t, column_t > > print_title_cols () const
 Get columns to repeat at left during printing. More...
 
bool has_print_titles () const
 Returns true if the sheet has print titles defined. More...
 
void clear_print_titles ()
 Remove all print titles. More...
 
void print_area (const std::string &print_area)
 Sets the print area of this sheet to print_area. More...
 
void clear_print_area ()
 Clear the print area of this sheet. More...
 
range_reference print_area () const
 Returns the print area defined for this sheet. More...
 
bool has_print_area () const
 Returns true if the print area is defined for this sheet. More...
 
bool has_view () const
 Returns true if this sheet has any number of views defined. More...
 
sheet_viewview (std::size_t index=0) const
 Returns the view at the given index. More...
 
void add_view (const sheet_view &new_view)
 Adds new_view to the set of available views for this sheet. More...
 
void active_cell (const cell_reference &ref)
 Set the active cell on the default worksheet view to the given reference. More...
 
bool has_active_cell () const
 Returns true if the worksheet has a view and the view has an active cell. More...
 
cell_reference active_cell () const
 Returns the active cell on the default worksheet view. More...
 
void clear_page_breaks ()
 Remove all manual column and row page breaks (represented as dashed blue lines in the page view in Excel). More...
 
const std::vector< row_t > & page_break_rows () const
 Returns vector where each element represents a row which will break a page below it. More...
 
void page_break_at_row (row_t row)
 Add a page break at the given row. More...
 
const std::vector< column_t > & page_break_columns () const
 Returns vector where each element represents a column which will break a page to the right. More...
 
void page_break_at_column (column_t column)
 Add a page break at the given column. More...
 
xlnt::conditional_format conditional_format (const range_reference &ref, const condition &when)
 Creates a conditional format for the given range with the given condition. More...
 
xlnt::path path () const
 Returns the path of this worksheet in the containing package. More...
 
relationship referring_relationship () const
 Returns the relationship from the parent workbook to this worksheet. More...
 
sheet_format_properties format_properties () const
 Returns the current formatting properties. More...
 
void format_properties (const sheet_format_properties &properties)
 Sets the format properties to the given properties. More...
 
bool has_drawing () const
 Returns true if this worksheet has a page setup. More...
 
bool is_empty () const
 Returns true if this worksheet is empty. A worksheet is considered empty if it doesn't have any cells. More...
 

Friends

class cell
 
class const_range_iterator
 
class range_iterator
 
class workbook
 
class detail::xlsx_consumer
 
class detail::xlsx_producer
 

Detailed Description

A worksheet is a 2D array of cells starting with cell A1 in the top-left corner and extending indefinitely down and right as needed.

Member Typedef Documentation

◆ const_iterator

Iterate over a non-const worksheet with an iterator of this type.

◆ const_reverse_iterator

Iterate in reverse order over a const worksheet with an iterator of this type.

◆ iterator

Iterate over a non-const worksheet with an iterator of this type.

◆ reverse_iterator

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

Iterate in reverse over a non-const worksheet with an iterator of this type.

Constructor & Destructor Documentation

◆ worksheet() [1/2]

xlnt::worksheet::worksheet ( )

Construct a null worksheet. No methods should be called on such a worksheet.

◆ worksheet() [2/2]

xlnt::worksheet::worksheet ( const worksheet rhs)

Copy constructor. This worksheet will point to the same memory as rhs's worksheet.

Member Function Documentation

◆ active_cell() [1/2]

void xlnt::worksheet::active_cell ( const cell_reference ref)

Set the active cell on the default worksheet view to the given reference.

◆ active_cell() [2/2]

cell_reference xlnt::worksheet::active_cell ( ) const

Returns the active cell on the default worksheet view.

◆ add_column_properties()

void xlnt::worksheet::add_column_properties ( column_t  column,
const class column_properties props 
)

Sets column properties for the given column to props.

◆ add_row_properties()

void xlnt::worksheet::add_row_properties ( row_t  row,
const class row_properties props 
)

Sets row properties for the given row to props.

◆ add_view()

void xlnt::worksheet::add_view ( const sheet_view new_view)

Adds new_view to the set of available views for this sheet.

◆ auto_filter() [1/4]

range_reference xlnt::worksheet::auto_filter ( ) const

Returns the current auto-filter of this sheet.

◆ auto_filter() [2/4]

void xlnt::worksheet::auto_filter ( const std::string &  range_string)

Sets the auto-filter of this sheet to the range defined by range_string.

◆ auto_filter() [3/4]

void xlnt::worksheet::auto_filter ( const xlnt::range range)

Sets the auto-filter of this sheet to the given range.

◆ auto_filter() [4/4]

void xlnt::worksheet::auto_filter ( const range_reference reference)

Sets the auto-filter of this sheet to the range defined by reference.

◆ begin() [1/2]

iterator xlnt::worksheet::begin ( )

Returns an iterator to the first row in this sheet.

◆ begin() [2/2]

const_iterator xlnt::worksheet::begin ( ) const

Return a constant iterator to the first row in this sheet.

◆ calculate_dimension()

range_reference xlnt::worksheet::calculate_dimension ( bool  skip_null = true,
bool  skip_row_props = false 
) const

Returns a range_reference pointing to the full range of cells in the worksheet. If skip_null is true (default), empty cells (For example if the first row or column is empty) will not be included in upper left bound of range. If skip_row_props is false (default), rows with only properties being defined will be returned too.

◆ cbegin()

const_iterator xlnt::worksheet::cbegin ( ) const

Return a constant iterator to the first row in this sheet.

◆ cell() [1/4]

const class cell xlnt::worksheet::cell ( column_t  column,
row_t  row 
) const

Returns the cell at the given column and row. If the cell doesn't exist, an invalid_parameter exception will be thrown.

◆ cell() [2/4]

class cell xlnt::worksheet::cell ( column_t  column,
row_t  row 
)

Returns the cell at the given column and row. If the cell doesn't exist, it will be initialized to null before being returned.

◆ cell() [3/4]

class cell xlnt::worksheet::cell ( const cell_reference reference)

Returns the cell at the given reference. If the cell doesn't exist, it will be initialized to null before being returned.

◆ cell() [4/4]

const class cell xlnt::worksheet::cell ( const cell_reference reference) const

Returns the cell at the given reference. If the cell doesn't exist, an invalid_parameter exception will be thrown.

◆ cend()

const_iterator xlnt::worksheet::cend ( ) const

Returns a constant iterator to one past the last row in this sheet.

◆ clear_auto_filter()

void xlnt::worksheet::clear_auto_filter ( )

Clear the auto-filter from this sheet.

◆ clear_cell()

void xlnt::worksheet::clear_cell ( const cell_reference ref)

Clears memory used by the given cell.

◆ clear_page_breaks()

void xlnt::worksheet::clear_page_breaks ( )

Remove all manual column and row page breaks (represented as dashed blue lines in the page view in Excel).

◆ clear_print_area()

void xlnt::worksheet::clear_print_area ( )

Clear the print area of this sheet.

◆ clear_print_titles()

void xlnt::worksheet::clear_print_titles ( )

Remove all print titles.

◆ clear_row()

void xlnt::worksheet::clear_row ( row_t  row)

Clears memory used by all cells in the given row.

◆ column_properties() [1/2]

xlnt::column_properties& xlnt::worksheet::column_properties ( column_t  column)

Returns the column properties for the given column.

◆ column_properties() [2/2]

const xlnt::column_properties& xlnt::worksheet::column_properties ( column_t  column) const

Returns the column properties for the given column.

◆ column_width()

double xlnt::worksheet::column_width ( column_t  column) const

Calculates the width of the given column. This will be the default column width if a custom width is not set on this column's column_properties.

◆ columns() [1/2]

const class range xlnt::worksheet::columns ( bool  skip_null = true) const

Returns a range ecompassing all cells in this sheet which will be iterated upon in column-major order. If skip_null is true (default), the range does not contain empty rows/columns at its boundaries and empty columns and cells will be skipped during iteration of the range.

◆ columns() [2/2]

class range xlnt::worksheet::columns ( bool  skip_null = true)

Returns a range ecompassing all cells in this sheet which will be iterated upon in column-major order. If skip_null is true (default), the range does not contain empty rows/columns at its boundaries and empty columns and cells will be skipped during iteration of the range.

◆ compare()

bool xlnt::worksheet::compare ( const worksheet other,
bool  reference 
) const

Returns true if this worksheet is equal to other. If reference is true, the comparison will only check that both worksheets point to the same sheet in the same workbook.

◆ conditional_format()

xlnt::conditional_format xlnt::worksheet::conditional_format ( const range_reference ref,
const condition when 
)

Creates a conditional format for the given range with the given condition.

◆ create_named_range() [1/2]

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

Creates a new named range with the given name encompassing the string representing a range.

◆ create_named_range() [2/2]

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

Creates a new named range with the given name encompassing the given range reference.

◆ delete_columns()

void xlnt::worksheet::delete_columns ( column_t  column,
std::uint32_t  amount 
)

Delete columns before the given column index

◆ delete_rows()

void xlnt::worksheet::delete_rows ( row_t  row,
std::uint32_t  amount 
)

Delete rows before the given row index

◆ end() [1/2]

iterator xlnt::worksheet::end ( )

Returns an iterator one past the last row in this sheet.

◆ end() [2/2]

const_iterator xlnt::worksheet::end ( ) const

Returns a constant iterator to one past the last row in this sheet.

◆ format_properties() [1/2]

sheet_format_properties xlnt::worksheet::format_properties ( ) const

Returns the current formatting properties.

◆ format_properties() [2/2]

void xlnt::worksheet::format_properties ( const sheet_format_properties properties)

Sets the format properties to the given properties.

◆ freeze_panes() [1/2]

void xlnt::worksheet::freeze_panes ( cell  top_left_cell)

Freeze panes above and to the left of top_left_cell.

◆ freeze_panes() [2/2]

void xlnt::worksheet::freeze_panes ( const cell_reference top_left_coordinate)

Freeze panes above and to the left of top_left_coordinate.

◆ frozen_panes()

cell_reference xlnt::worksheet::frozen_panes ( ) const

Returns the top left corner of the region above and to the left of which panes are frozen.

◆ garbage_collect()

void xlnt::worksheet::garbage_collect ( )

Deletes data held in the worksheet that does not affect the internal data or display. For example, unreference styles and empty cells will be removed.

◆ has_active_cell()

bool xlnt::worksheet::has_active_cell ( ) const

Returns true if the worksheet has a view and the view has an active cell.

◆ has_auto_filter()

bool xlnt::worksheet::has_auto_filter ( ) const

Returns true if this sheet has an auto-filter set.

◆ has_cell()

bool xlnt::worksheet::has_cell ( const cell_reference reference) const

Returns true if this sheet has an initialized cell at the given reference.

◆ has_column_properties()

bool xlnt::worksheet::has_column_properties ( column_t  column) const

Returns true if column properties have been set for the given column.

◆ has_drawing()

bool xlnt::worksheet::has_drawing ( ) const

Returns true if this worksheet has a page setup.

◆ has_frozen_panes()

bool xlnt::worksheet::has_frozen_panes ( ) const

Returns true if this sheet has a frozen row, frozen column, or both.

◆ has_header_footer()

bool xlnt::worksheet::has_header_footer ( ) const

Returns true if this sheet has a header/footer.

◆ has_named_range()

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

Returns true if this worksheet contains a named range with the given name.

◆ has_page_margins()

bool xlnt::worksheet::has_page_margins ( ) const

Returns true if this page has margins.

◆ has_page_setup()

bool xlnt::worksheet::has_page_setup ( ) const

Returns true if this worksheet has a page setup.

◆ has_phonetic_properties()

bool xlnt::worksheet::has_phonetic_properties ( ) const

Returns true if this sheet has phonetic properties

◆ has_print_area()

bool xlnt::worksheet::has_print_area ( ) const

Returns true if the print area is defined for this sheet.

◆ has_print_titles()

bool xlnt::worksheet::has_print_titles ( ) const

Returns true if the sheet has print titles defined.

◆ has_row_properties()

bool xlnt::worksheet::has_row_properties ( row_t  row) const

Returns true if row properties have been set for the given row.

◆ has_view()

bool xlnt::worksheet::has_view ( ) const

Returns true if this sheet has any number of views defined.

◆ header_footer() [1/2]

class header_footer xlnt::worksheet::header_footer ( ) const

Returns the header/footer of this sheet.

◆ header_footer() [2/2]

void xlnt::worksheet::header_footer ( const class header_footer new_header_footer)

Sets the header/footer of this sheet to new_header_footer.

◆ highest_column()

column_t xlnt::worksheet::highest_column ( ) const

Returns the column of the last non-empty cell in the worksheet.

◆ highest_column_or_props()

column_t xlnt::worksheet::highest_column_or_props ( ) const

Returns the column of the last non-empty cell or highest column with properties in the worksheet.

◆ highest_row()

row_t xlnt::worksheet::highest_row ( ) const

Returns the row of the last non-empty cell in the worksheet.

◆ highest_row_or_props()

row_t xlnt::worksheet::highest_row_or_props ( ) const

Returns the row of the last non-empty cell or highest row with properties in the worksheet.

◆ id() [1/2]

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

Returns the unique numeric identifier of this worksheet. This will sometimes but not necessarily be the index of the worksheet in the workbook.

◆ id() [2/2]

void xlnt::worksheet::id ( std::size_t  id)

Set the unique numeric identifier. The id defaults to the lowest unused id in the workbook so this should not be called without a good reason.

◆ insert_columns()

void xlnt::worksheet::insert_columns ( column_t  column,
std::uint32_t  amount 
)

Insert empty columns before the given column index

◆ insert_rows()

void xlnt::worksheet::insert_rows ( row_t  row,
std::uint32_t  amount 
)

Insert empty rows before the given row index

◆ is_empty()

bool xlnt::worksheet::is_empty ( ) const

Returns true if this worksheet is empty. A worksheet is considered empty if it doesn't have any cells.

◆ lowest_column()

column_t xlnt::worksheet::lowest_column ( ) const

Returns the column of the first non-empty cell in the worksheet.

◆ lowest_column_or_props()

column_t xlnt::worksheet::lowest_column_or_props ( ) const

Returns the column of the first non-empty cell or lowest column with properties in the worksheet.

◆ lowest_row()

row_t xlnt::worksheet::lowest_row ( ) const

Returns the row of the first non-empty cell in the worksheet.

◆ lowest_row_or_props()

row_t xlnt::worksheet::lowest_row_or_props ( ) const

Returns the row of the first non-empty cell or lowest row with properties in the worksheet.

◆ merge_cells() [1/2]

void xlnt::worksheet::merge_cells ( const std::string &  reference_string)

Merges the cells within the range represented by the given string.

◆ merge_cells() [2/2]

void xlnt::worksheet::merge_cells ( const range_reference reference)

Merges the cells within the given range.

◆ merged_ranges()

std::vector<range_reference> xlnt::worksheet::merged_ranges ( ) const

Returns a vector of references of all merged ranges in the worksheet.

◆ named_range() [1/2]

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

Returns the named range with the given name. Throws key_not_found exception if the named range doesn't exist.

◆ named_range() [2/2]

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

Returns the named range with the given name. Throws key_not_found exception if the named range doesn't exist.

◆ next_row()

row_t xlnt::worksheet::next_row ( ) const

Returns the row directly below the last non-empty cell in the worksheet.

◆ operator!=() [1/2]

bool xlnt::worksheet::operator!= ( const worksheet other) const

Returns true if this worksheet doesn't refer to the same worksheet as other.

◆ operator!=() [2/2]

bool xlnt::worksheet::operator!= ( std::nullptr_t  ) const

Returns true if this worksheet is not null.

◆ operator=()

void xlnt::worksheet::operator= ( const worksheet other)

Sets the internal pointer of this worksheet object to point to other.

◆ operator==() [1/2]

bool xlnt::worksheet::operator== ( const worksheet other) const

Returns true if this worksheet refers to the same worksheet as other.

◆ operator==() [2/2]

bool xlnt::worksheet::operator== ( std::nullptr_t  ) const

Returns true if this worksheet is null.

◆ operator[]() [1/2]

class cell xlnt::worksheet::operator[] ( const cell_reference reference)

Convenience method for worksheet::cell method.

◆ operator[]() [2/2]

const class cell xlnt::worksheet::operator[] ( const cell_reference reference) const

Convenience method for worksheet::cell method.

◆ page_break_at_column()

void xlnt::worksheet::page_break_at_column ( column_t  column)

Add a page break at the given column.

◆ page_break_at_row()

void xlnt::worksheet::page_break_at_row ( row_t  row)

Add a page break at the given row.

◆ page_break_columns()

const std::vector<column_t>& xlnt::worksheet::page_break_columns ( ) const

Returns vector where each element represents a column which will break a page to the right.

◆ page_break_rows()

const std::vector<row_t>& xlnt::worksheet::page_break_rows ( ) const

Returns vector where each element represents a row which will break a page below it.

◆ page_margins() [1/2]

xlnt::page_margins xlnt::worksheet::page_margins ( ) const

Returns the margins of this sheet.

◆ page_margins() [2/2]

void xlnt::worksheet::page_margins ( const class page_margins margins)

Sets the margins of this sheet to margins.

◆ page_setup() [1/2]

xlnt::page_setup xlnt::worksheet::page_setup ( ) const

Returns the page setup for this sheet.

◆ page_setup() [2/2]

void xlnt::worksheet::page_setup ( const struct page_setup setup)

Sets the page setup for this sheet to setup.

◆ path()

xlnt::path xlnt::worksheet::path ( ) const

Returns the path of this worksheet in the containing package.

◆ phonetic_properties() [1/2]

const phonetic_pr& xlnt::worksheet::phonetic_properties ( ) const

Returns the phonetic properties of this sheet.

◆ phonetic_properties() [2/2]

void xlnt::worksheet::phonetic_properties ( const phonetic_pr phonetic_props)

Sets the phonetic properties of this sheet to phonetic_props

◆ point_pos()

cell_reference xlnt::worksheet::point_pos ( int  left,
int  top 
) const

Returns a reference to the cell at the given point coordinates.

◆ print_area() [1/2]

void xlnt::worksheet::print_area ( const std::string &  print_area)

Sets the print area of this sheet to print_area.

◆ print_area() [2/2]

range_reference xlnt::worksheet::print_area ( ) const

Returns the print area defined for this sheet.

◆ print_title_cols() [1/2]

void xlnt::worksheet::print_title_cols ( column_t  start,
column_t  end 
)

Sets columns to repeat at left during printing.

◆ print_title_cols() [2/2]

optional<std::pair<column_t, column_t> > xlnt::worksheet::print_title_cols ( ) const

Get columns to repeat at left during printing.

◆ print_title_rows() [1/2]

void xlnt::worksheet::print_title_rows ( row_t  start,
row_t  end 
)

Sets rows to repeat at top during printing.

◆ print_title_rows() [2/2]

optional<std::pair<row_t, row_t> > xlnt::worksheet::print_title_rows ( ) const

Get rows to repeat at top during printing.

◆ range() [1/4]

const class range xlnt::worksheet::range ( const range_reference reference) const

Returns the range defined by reference.

◆ range() [2/4]

const class range xlnt::worksheet::range ( const std::string &  reference_string) const

Returns the range defined by reference string. If reference string is the name of a previously-defined named range in the sheet, it will be returned.

◆ range() [3/4]

class range xlnt::worksheet::range ( const std::string &  reference_string)

Returns the range defined by reference string. If reference string is the name of a previously-defined named range in the sheet, it will be returned.

◆ range() [4/4]

class range xlnt::worksheet::range ( const range_reference reference)

Returns the range defined by reference.

◆ referring_relationship()

relationship xlnt::worksheet::referring_relationship ( ) const

Returns the relationship from the parent workbook to this worksheet.

◆ remove_named_range()

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

Removes a named range with the given name.

◆ reserve()

void xlnt::worksheet::reserve ( std::size_t  n)

Reserve n rows. This can be optionally called before adding many rows to improve performance.

◆ row_height()

double xlnt::worksheet::row_height ( row_t  row) const

Calculate the height of the given row. This will be the default row height if a custom height is not set on this row's row_properties.

◆ row_properties() [1/2]

xlnt::row_properties& xlnt::worksheet::row_properties ( row_t  row)

Returns the row properties for the given row.

◆ row_properties() [2/2]

const xlnt::row_properties& xlnt::worksheet::row_properties ( row_t  row) const

Returns the row properties for the given row.

◆ rows() [1/2]

const class range xlnt::worksheet::rows ( bool  skip_null = true) const

Returns a range encompassing all cells in this sheet which will be iterated upon in row-major order. If skip_null is true (default), the range does not contain empty rows/columns at its boundaries and empty rows and cells will be skipped during iteration of the range.

◆ rows() [2/2]

class range xlnt::worksheet::rows ( bool  skip_null = true)

Returns a range encompassing all cells in this sheet which will be iterated upon in row-major order. If skip_null is true (default), the range does not contain empty rows/columns at its boundaries and empty rows and cells will be skipped during iteration of the range.

◆ sheet_state() [1/2]

xlnt::sheet_state xlnt::worksheet::sheet_state ( ) const

Returns the sheet state of this sheet.

◆ sheet_state() [2/2]

void xlnt::worksheet::sheet_state ( xlnt::sheet_state  state)

Sets the sheet state of this sheet.

◆ title() [1/2]

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

Returns the title of this sheet.

◆ title() [2/2]

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

Sets the title of this sheet.

◆ unfreeze_panes()

void xlnt::worksheet::unfreeze_panes ( )

Remove frozen panes. The data in those panes will be unaffected–this affects only the view.

◆ unmerge_cells() [1/2]

void xlnt::worksheet::unmerge_cells ( const std::string &  reference_string)

Removes the merging of the cells in the range represented by the given string.

◆ unmerge_cells() [2/2]

void xlnt::worksheet::unmerge_cells ( const range_reference reference)

Removes the merging of the cells in the given range.

◆ view()

sheet_view& xlnt::worksheet::view ( std::size_t  index = 0) const

Returns the view at the given index.

◆ workbook() [1/2]

class workbook& xlnt::worksheet::workbook ( )

Returns a reference to the workbook this worksheet is owned by.

◆ workbook() [2/2]

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

Returns a reference to the workbook this worksheet is owned by.


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