OpenXLSX 1.9.1
Loading...
Searching...
No Matches
OpenXLSX::XLTableCollection Class Reference

The XLTableCollection class manages multiple tables within a worksheet. More...

#include <XLTables.hpp>

Public Member Functions

 XLTableCollection ()=default
 Constructor.
 
 XLTableCollection (XMLNode node, XLWorksheet *worksheet)
 Constructor.
 
size_t count () const
 Get the number of tables in the collection.
 
XLTable operator[] (size_t index) const
 Get a table by its 0-based index.
 
XLTable table (std::string_view name) const
 Get a table by its name.
 
XLTable add (std::string_view name, std::string_view range)
 Add a new table to the worksheet.
 
XLTable add (std::string_view name, const XLCellRange &range)
 Add a new table using a typed cell range.
 
bool valid () const
 Check if the collection is valid.
 

Friends

class XLWorksheet
 

Detailed Description

The XLTableCollection class manages multiple tables within a worksheet.

Constructor & Destructor Documentation

◆ XLTableCollection() [1/2]

OpenXLSX::XLTableCollection::XLTableCollection ( )
default

Constructor.

◆ XLTableCollection() [2/2]

OpenXLSX::XLTableCollection::XLTableCollection ( XMLNode  node,
XLWorksheet worksheet 
)
explicit

Constructor.

Parameters
nodeThe worksheet XML node.
worksheetThe parent worksheet.

Member Function Documentation

◆ add() [1/2]

XLTable OpenXLSX::XLTableCollection::add ( std::string_view  name,
const XLCellRange range 
)

Add a new table using a typed cell range.

Parameters
nameThe table name.
rangeThe XLCellRange object.
Returns
The newly created XLTable object.

◆ add() [2/2]

XLTable OpenXLSX::XLTableCollection::add ( std::string_view  name,
std::string_view  range 
)

Add a new table to the worksheet.

Parameters
nameThe table name.
rangeThe cell range for the table (e.g. "A1:C5").
Returns
The newly created XLTable object.

◆ count()

size_t OpenXLSX::XLTableCollection::count ( ) const

Get the number of tables in the collection.

◆ operator[]()

XLTable OpenXLSX::XLTableCollection::operator[] ( size_t  index) const

Get a table by its 0-based index.

◆ table()

XLTable OpenXLSX::XLTableCollection::table ( std::string_view  name) const

Get a table by its name.

◆ valid()

bool OpenXLSX::XLTableCollection::valid ( ) const

Check if the collection is valid.

Friends And Related Symbol Documentation

◆ XLWorksheet

friend class XLWorksheet
friend

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