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

The XLTable class represents a single Excel table (.xml file). More...

#include <XLTables.hpp>

Inheritance diagram for OpenXLSX::XLTable:
OpenXLSX::XLXmlFile

Public Member Functions

 XLTable ()
 Constructor.
 
 XLTable (XLXmlData *xmlData)
 The constructor.
 
 XLTable (const XLTable &other)=default
 The copy constructor.
 
 XLTable (XLTable &&other) noexcept=default
 Move constructor.
 
 ~XLTable ()=default
 The destructor.
 
XLTableoperator= (const XLTable &)=default
 Assignment operator.
 
XLTableoperator= (XLTable &&other) noexcept=default
 Move assignment operator.
 
uint32_t id () const
 Get the name of the table.
 
std::string name () const
 Get the name of the table.
 
void setName (std::string_view name)
 Set the name of the table.
 
std::string displayName () const
 Get the display name of the table.
 
void setDisplayName (std::string_view name)
 Set the display name of the table.
 
std::string rangeReference () const
 Get the range reference of the table (e.g., "A1:C10")
 
void setRangeReference (std::string_view ref)
 Set the range reference of the table.
 
std::string styleName () const
 Get the table style name.
 
void setStyleName (std::string_view styleName)
 Set the table style name.
 
std::string comment () const
 Get the table comment.
 
void setComment (std::string_view comment)
 Set the table comment.
 
uint32_t headerRowDxfId () const
 Get the differential formatting ID for the header row.
 
void setHeaderRowDxfId (uint32_t id)
 Set the differential formatting ID for the header row.
 
uint32_t dataDxfId () const
 Get the differential formatting ID for the data rows.
 
void setDataDxfId (uint32_t id)
 Set the differential formatting ID for the data rows.
 
bool published () const
 Check if the table is published.
 
void setPublished (bool published)
 Set whether the table is published.
 
bool showRowStripes () const
 Check if row stripes are shown.
 
void setShowRowStripes (bool show)
 Set whether row stripes are shown.
 
bool showHeaderRow () const
 Check if the header row is shown.
 
void setShowHeaderRow (bool show)
 Set whether the header row is shown.
 
bool showTotalsRow () const
 Check if the totals row is shown.
 
void setShowTotalsRow (bool show)
 Set whether the totals row is shown.
 
bool showColumnStripes () const
 Check if column stripes are shown.
 
void setShowColumnStripes (bool show)
 Set whether column stripes are shown.
 
bool showFirstColumn () const
 Check if the first column is highlighted.
 
void setShowFirstColumn (bool show)
 Set whether the first column is highlighted.
 
bool showLastColumn () const
 Check if the last column is highlighted.
 
void setShowLastColumn (bool show)
 Set whether the last column is highlighted.
 
XLTableColumn appendColumn (std::string_view name)
 Append a new column to the table.
 
XLTableColumn column (std::string_view name) const
 Get a column by its name.
 
XLTableColumn column (uint32_t id) const
 Get a column by its 1-based ID.
 
XLAutoFilter autoFilter () const
 Get the auto filter object for the table.
 
void resizeToFitData (const XLWorksheet &worksheet)
 Automatically resizes the table to fit the contiguous data in the worksheet.
 
void createColumnsFromRange (const XLWorksheet &worksheet)
 Automatically initializes the columns of the table from the header row of the specified worksheet range.
 
void print (std::basic_ostream< char > &ostr) const
 Print the XML contents of this XLTable instance using the underlying XMLNode print function.
 
- Public Member Functions inherited from OpenXLSX::XLXmlFile
 XLXmlFile ()=default
 Default constructor.
 
std::string xmlData (XLXmlSavingDeclaration savingDeclaration=XLXmlSavingDeclaration{}) const
 Method for getting the XML data represented by the object.
 
 XLXmlFile (XLXmlData *xmlData)
 Constructor. Creates an object based on the xmlData input.
 
 XLXmlFile (const XLXmlFile &other)=default
 Copy constructor. Default implementation used.
 
 XLXmlFile (XLXmlFile &&other) noexcept=default
 Move constructor. Default implementation used.
 
 ~XLXmlFile ()=default
 Destructor. Default implementation used.
 
bool valid () const
 check whether class is linked to a valid XML file
 
XLXmlFileoperator= (const XLXmlFile &other)=default
 The copy assignment operator. The default implementation has been used.
 
XLXmlFileoperator= (XLXmlFile &&other) noexcept=default
 The move assignment operator. The default implementation has been used.
 
XLDocumentparentDoc ()
 This function provides access to the parent XLDocument object.
 
const XLDocumentparentDoc () const
 This function provides access to the parent XLDocument object.
 
XMLDocumentxmlDocument ()
 This function provides access to the underlying XMLDocument object.
 
const XMLDocumentxmlDocument () const
 This function provides access to the underlying XMLDocument object.
 
std::string getXmlPath () const
 Retrieve the path of the XML data in the .xlsx zip archive via m_xmlData->getXmlPath.
 

Friends

class XLTableCollection
 
class XLWorksheet
 

Additional Inherited Members

- Protected Member Functions inherited from OpenXLSX::XLXmlFile
void setXmlData (std::string_view xmlData)
 Provide the XML data represented by the object.
 
std::string relationshipID () const
 This function returns the relationship ID (the ID used in the XLRelationships objects) for the object.
 
- Protected Attributes inherited from OpenXLSX::XLXmlFile
XLXmlDatam_xmlData {nullptr}
 

Detailed Description

The XLTable class represents a single Excel table (.xml file).

Constructor & Destructor Documentation

◆ XLTable() [1/4]

OpenXLSX::XLTable::XLTable ( )
inline

Constructor.

◆ XLTable() [2/4]

OpenXLSX::XLTable::XLTable ( XLXmlData xmlData)

The constructor.

Parameters
xmlDatathe source XML of the table file

◆ XLTable() [3/4]

OpenXLSX::XLTable::XLTable ( const XLTable other)
default

The copy constructor.

Parameters
otherThe object to be copied.

◆ XLTable() [4/4]

OpenXLSX::XLTable::XLTable ( XLTable &&  other)
defaultnoexcept

Move constructor.

◆ ~XLTable()

OpenXLSX::XLTable::~XLTable ( )
default

The destructor.

Member Function Documentation

◆ appendColumn()

XLTableColumn OpenXLSX::XLTable::appendColumn ( std::string_view  name)

Append a new column to the table.

Parameters
nameThe column name
Returns
The appended XLTableColumn

◆ autoFilter()

XLAutoFilter OpenXLSX::XLTable::autoFilter ( ) const

Get the auto filter object for the table.

Returns
XLAutoFilter The auto filter object.

◆ column() [1/2]

XLTableColumn OpenXLSX::XLTable::column ( std::string_view  name) const

Get a column by its name.

Parameters
nameThe name of the column
Returns
The XLTableColumn object

◆ column() [2/2]

XLTableColumn OpenXLSX::XLTable::column ( uint32_t  id) const

Get a column by its 1-based ID.

Parameters
idThe 1-based ID of the column
Returns
The XLTableColumn object

◆ comment()

std::string OpenXLSX::XLTable::comment ( ) const

Get the table comment.

Returns
The comment string.

◆ createColumnsFromRange()

void OpenXLSX::XLTable::createColumnsFromRange ( const XLWorksheet worksheet)

Automatically initializes the columns of the table from the header row of the specified worksheet range.

Parameters
worksheetThe parent worksheet.

◆ dataDxfId()

uint32_t OpenXLSX::XLTable::dataDxfId ( ) const

Get the differential formatting ID for the data rows.

Returns
The DxfId, or 0 if not set.

◆ displayName()

std::string OpenXLSX::XLTable::displayName ( ) const

Get the display name of the table.

Returns
std::string The display name

◆ headerRowDxfId()

uint32_t OpenXLSX::XLTable::headerRowDxfId ( ) const

Get the differential formatting ID for the header row.

Returns
The DxfId, or 0 if not set.

◆ id()

uint32_t OpenXLSX::XLTable::id ( ) const

Get the name of the table.

Returns
std::string The table name

◆ name()

std::string OpenXLSX::XLTable::name ( ) const

Get the name of the table.

Returns
std::string The table name

◆ operator=() [1/2]

XLTable & OpenXLSX::XLTable::operator= ( const XLTable )
default

Assignment operator.

◆ operator=() [2/2]

XLTable & OpenXLSX::XLTable::operator= ( XLTable &&  other)
defaultnoexcept

Move assignment operator.

◆ print()

void OpenXLSX::XLTable::print ( std::basic_ostream< char > &  ostr) const

Print the XML contents of this XLTable instance using the underlying XMLNode print function.

◆ published()

bool OpenXLSX::XLTable::published ( ) const

Check if the table is published.

Returns
True if published.

◆ rangeReference()

std::string OpenXLSX::XLTable::rangeReference ( ) const

Get the range reference of the table (e.g., "A1:C10")

Returns
std::string The range reference

◆ resizeToFitData()

void OpenXLSX::XLTable::resizeToFitData ( const XLWorksheet worksheet)

Automatically resizes the table to fit the contiguous data in the worksheet.

Parameters
worksheetThe worksheet containing this table.

◆ setComment()

void OpenXLSX::XLTable::setComment ( std::string_view  comment)

Set the table comment.

Parameters
commentThe new comment string.

◆ setDataDxfId()

void OpenXLSX::XLTable::setDataDxfId ( uint32_t  id)

Set the differential formatting ID for the data rows.

Parameters
idThe DxfId.

◆ setDisplayName()

void OpenXLSX::XLTable::setDisplayName ( std::string_view  name)

Set the display name of the table.

Parameters
nameThe new display name

◆ setHeaderRowDxfId()

void OpenXLSX::XLTable::setHeaderRowDxfId ( uint32_t  id)

Set the differential formatting ID for the header row.

Parameters
idThe DxfId.

◆ setName()

void OpenXLSX::XLTable::setName ( std::string_view  name)

Set the name of the table.

Parameters
nameThe new table name (must not contain spaces)

◆ setPublished()

void OpenXLSX::XLTable::setPublished ( bool  published)

Set whether the table is published.

Parameters
publishedTrue if published.

◆ setRangeReference()

void OpenXLSX::XLTable::setRangeReference ( std::string_view  ref)

Set the range reference of the table.

Parameters
refThe new range reference (e.g., "A1:C10")

◆ setShowColumnStripes()

void OpenXLSX::XLTable::setShowColumnStripes ( bool  show)

Set whether column stripes are shown.

Parameters
showTrue to show column stripes

◆ setShowFirstColumn()

void OpenXLSX::XLTable::setShowFirstColumn ( bool  show)

Set whether the first column is highlighted.

Parameters
showTrue to highlight the first column

◆ setShowHeaderRow()

void OpenXLSX::XLTable::setShowHeaderRow ( bool  show)

Set whether the header row is shown.

Parameters
showTrue to show the header row

◆ setShowLastColumn()

void OpenXLSX::XLTable::setShowLastColumn ( bool  show)

Set whether the last column is highlighted.

Parameters
showTrue to highlight the last column

◆ setShowRowStripes()

void OpenXLSX::XLTable::setShowRowStripes ( bool  show)

Set whether row stripes are shown.

Parameters
showTrue to show row stripes

◆ setShowTotalsRow()

void OpenXLSX::XLTable::setShowTotalsRow ( bool  show)

Set whether the totals row is shown.

Parameters
showTrue to show the totals row

◆ setStyleName()

void OpenXLSX::XLTable::setStyleName ( std::string_view  styleName)

Set the table style name.

Parameters
styleNameThe new style name (e.g., "TableStyleMedium2")

◆ showColumnStripes()

bool OpenXLSX::XLTable::showColumnStripes ( ) const

Check if column stripes are shown.

Returns
bool True if column stripes are shown

◆ showFirstColumn()

bool OpenXLSX::XLTable::showFirstColumn ( ) const

Check if the first column is highlighted.

Returns
bool True if the first column is highlighted

◆ showHeaderRow()

bool OpenXLSX::XLTable::showHeaderRow ( ) const

Check if the header row is shown.

Returns
bool True if the header row is shown

◆ showLastColumn()

bool OpenXLSX::XLTable::showLastColumn ( ) const

Check if the last column is highlighted.

Returns
bool True if the last column is highlighted

◆ showRowStripes()

bool OpenXLSX::XLTable::showRowStripes ( ) const

Check if row stripes are shown.

Returns
bool True if row stripes are shown

◆ showTotalsRow()

bool OpenXLSX::XLTable::showTotalsRow ( ) const

Check if the totals row is shown.

Returns
bool True if the totals row is shown

◆ styleName()

std::string OpenXLSX::XLTable::styleName ( ) const

Get the table style name.

Returns
std::string The style name

Friends And Related Symbol Documentation

◆ XLTableCollection

friend class XLTableCollection
friend

◆ XLWorksheet

friend class XLWorksheet
friend

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