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

An encapsulation of a cell format item. More...

#include <XLStyles.hpp>

Public Member Functions

 XLCellFormat ()
 
 XLCellFormat (const XMLNode &node, bool permitXfId)
 Constructor. New items should only be created through an XLStyles object.
 
 XLCellFormat (const XLCellFormat &other)
 Copy Constructor.
 
 XLCellFormat (XLCellFormat &&other) noexcept=default
 Move Constructor.
 
 ~XLCellFormat ()
 
XLCellFormatoperator= (const XLCellFormat &other)
 Copy assignment operator.
 
XLCellFormatoperator= (XLCellFormat &&other) noexcept=default
 Move assignment operator.
 
uint32_t numberFormatId () const
 Get the number format id.
 
XLStyleIndex fontIndex () const
 Get the font index.
 
XLStyleIndex fillIndex () const
 Get the fill index.
 
XLStyleIndex borderIndex () const
 Get the border index.
 
XLStyleIndex xfId () const
 Get the id of a referred <xf> entry.
 
bool applyNumberFormat () const
 Report whether number format is applied.
 
bool applyFont () const
 Report whether font is applied.
 
bool applyFill () const
 Report whether fill is applied.
 
bool applyBorder () const
 Report whether border is applied.
 
bool applyAlignment () const
 Report whether alignment is applied.
 
bool applyProtection () const
 Report whether protection is applied.
 
bool quotePrefix () const
 Report whether quotePrefix is enabled.
 
bool pivotButton () const
 Report whether pivot button is applied.
 
bool locked () const
 Report whether protection locked is applied.
 
bool hidden () const
 Report whether protection hidden is applied.
 
XLAlignment alignment (bool createIfMissing=false) const
 Return a reference to applicable alignment.
 
XLUnsupportedElement extLst () const
 Unsupported getter.
 
XLCellFormatsetNumberFormatId (uint32_t newNumFmtId)
 Setter functions for style parameters.
 
XLCellFormatsetFontIndex (XLStyleIndex newFontIndex)
 
XLCellFormatsetFillIndex (XLStyleIndex newFillIndex)
 
XLCellFormatsetBorderIndex (XLStyleIndex newBorderIndex)
 
XLCellFormatsetXfId (XLStyleIndex newXfId)
 
XLCellFormatsetApplyNumberFormat (bool set=true)
 
XLCellFormatsetApplyFont (bool set=true)
 
XLCellFormatsetApplyFill (bool set=true)
 
XLCellFormatsetApplyBorder (bool set=true)
 
XLCellFormatsetApplyAlignment (bool set=true)
 
XLCellFormatsetApplyProtection (bool set=true)
 
XLCellFormatsetQuotePrefix (bool set=true)
 
XLCellFormatsetPivotButton (bool set=true)
 
XLCellFormatsetLocked (bool set=true)
 
XLCellFormatsetHidden (bool set=true)
 
XLCellFormatsetExtLst (XLUnsupportedElement const &newExtLst)
 Unsupported setter.
 
std::string summary () const
 Return a string summary of the cell format properties.
 

Friends

class XLCellFormats
 

Detailed Description

An encapsulation of a cell format item.

Constructor & Destructor Documentation

◆ XLCellFormat() [1/4]

XLCellFormat::XLCellFormat ( )

◆ XLCellFormat() [2/4]

XLCellFormat::XLCellFormat ( const XMLNode node,
bool  permitXfId 
)
explicit

Constructor. New items should only be created through an XLStyles object.

Parameters
nodeAn XMLNode object with the xf XMLNode. If no input is provided, a null node is used.
permitXfIdtrue (XLPermitXfID) -> getter xfId and setter setXfId are enabled, otherwise will throw XLException if invoked

◆ XLCellFormat() [3/4]

XLCellFormat::XLCellFormat ( const XLCellFormat other)

Copy Constructor.

Parameters
otherObject to be copied.

◆ XLCellFormat() [4/4]

OpenXLSX::XLCellFormat::XLCellFormat ( XLCellFormat &&  other)
defaultnoexcept

Move Constructor.

Parameters
otherObject to be moved.

◆ ~XLCellFormat()

XLCellFormat::~XLCellFormat ( )
default

Member Function Documentation

◆ alignment()

XLAlignment XLCellFormat::alignment ( bool  createIfMissing = false) const

Return a reference to applicable alignment.

Parameters
createIfMissingtriggers creation of alignment node - should be used with setter functions of XLAlignment
Returns
An XLAlignment object reference

◆ applyAlignment()

bool XLCellFormat::applyAlignment ( ) const

Report whether alignment is applied.

Returns
true for a setting enabled, or false if disabled

◆ applyBorder()

bool XLCellFormat::applyBorder ( ) const

Report whether border is applied.

Returns
true for a setting enabled, or false if disabled

◆ applyFill()

bool XLCellFormat::applyFill ( ) const

Report whether fill is applied.

Returns
true for a setting enabled, or false if disabled

◆ applyFont()

bool XLCellFormat::applyFont ( ) const

Report whether font is applied.

Returns
true for a setting enabled, or false if disabled

◆ applyNumberFormat()

bool XLCellFormat::applyNumberFormat ( ) const

Report whether number format is applied.

Returns
true for a setting enabled, or false if disabled

◆ applyProtection()

bool XLCellFormat::applyProtection ( ) const

Report whether protection is applied.

Returns
true for a setting enabled, or false if disabled

◆ borderIndex()

XLStyleIndex XLCellFormat::borderIndex ( ) const

Get the border index.

Returns
The index(!) of a border as defined in XLBorders

determines the borderIndex

Note
returns XLInvalidStyleIndex if attribute is not defined / set / empty

◆ extLst()

XLUnsupportedElement OpenXLSX::XLCellFormat::extLst ( ) const
inline

Unsupported getter.

◆ fillIndex()

XLStyleIndex XLCellFormat::fillIndex ( ) const

Get the fill index.

Returns
The index(!) of a fill as defined in XLFills

determines the fillIndex

Note
returns XLInvalidStyleIndex if attribute is not defined / set / empty

◆ fontIndex()

XLStyleIndex XLCellFormat::fontIndex ( ) const

Get the font index.

Returns
The index(!) of a font as defined in XLFonts

determines the fontIndex

Note
returns XLInvalidStyleIndex if attribute is not defined / set / empty

◆ hidden()

bool XLCellFormat::hidden ( ) const

Report whether protection hidden is applied.

Returns
true for a setting enabled, or false if disabled

◆ locked()

bool XLCellFormat::locked ( ) const

Report whether protection locked is applied.

Returns
true for a setting enabled, or false if disabled

◆ numberFormatId()

uint32_t XLCellFormat::numberFormatId ( ) const

Get the number format id.

Returns
The identifier of a number format, built-in (predefined by office) or defind in XLNumberFormats

determines the numberFormatId

Note
returns XLInvalidUInt32 if attribute is not defined / set / empty

◆ operator=() [1/2]

XLCellFormat & XLCellFormat::operator= ( const XLCellFormat other)

Copy assignment operator.

Parameters
otherRight hand side of assignment operation.
Returns
A reference to the lhs object.

◆ operator=() [2/2]

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

Move assignment operator.

Parameters
otherRight hand side of assignment operation.
Returns
A reference to lhs object.

◆ pivotButton()

bool XLCellFormat::pivotButton ( ) const

Report whether pivot button is applied.

Returns
true for a setting enabled, or false if disabled
Note
from documentation: A boolean value indicating whether the cell rendering includes a pivot table dropdown button.
Todo:
need to find a use case for this

◆ quotePrefix()

bool XLCellFormat::quotePrefix ( ) const

Report whether quotePrefix is enabled.

Returns
true for a setting enabled, or false if disabled
Note
from documentation: A boolean value indicating whether the text string in a cell should be prefixed by a single quote mark (e.g., 'text). In these cases, the quote is not stored in the Shared Strings Part.

◆ setApplyAlignment()

XLCellFormat & XLCellFormat::setApplyAlignment ( bool  set = true)

◆ setApplyBorder()

XLCellFormat & XLCellFormat::setApplyBorder ( bool  set = true)

◆ setApplyFill()

XLCellFormat & XLCellFormat::setApplyFill ( bool  set = true)

◆ setApplyFont()

XLCellFormat & XLCellFormat::setApplyFont ( bool  set = true)

◆ setApplyNumberFormat()

XLCellFormat & XLCellFormat::setApplyNumberFormat ( bool  set = true)

◆ setApplyProtection()

XLCellFormat & XLCellFormat::setApplyProtection ( bool  set = true)

◆ setBorderIndex()

XLCellFormat & XLCellFormat::setBorderIndex ( XLStyleIndex  newBorderIndex)

◆ setExtLst()

XLCellFormat & XLCellFormat::setExtLst ( XLUnsupportedElement const &  newExtLst)

Unsupported setter.

Unsupported setter function.

◆ setFillIndex()

XLCellFormat & XLCellFormat::setFillIndex ( XLStyleIndex  newFillIndex)

◆ setFontIndex()

XLCellFormat & XLCellFormat::setFontIndex ( XLStyleIndex  newFontIndex)

◆ setHidden()

XLCellFormat & XLCellFormat::setHidden ( bool  set = true)

◆ setLocked()

XLCellFormat & XLCellFormat::setLocked ( bool  set = true)

◆ setNumberFormatId()

XLCellFormat & XLCellFormat::setNumberFormatId ( uint32_t  newNumFmtId)

Setter functions for style parameters.

Parameters
valuethat shall be set
Returns
true for success, false for failure

◆ setPivotButton()

XLCellFormat & XLCellFormat::setPivotButton ( bool  set = true)

◆ setQuotePrefix()

XLCellFormat & XLCellFormat::setQuotePrefix ( bool  set = true)

◆ setXfId()

XLCellFormat & XLCellFormat::setXfId ( XLStyleIndex  newXfId)

◆ summary()

std::string XLCellFormat::summary ( ) const

Return a string summary of the cell format properties.

Returns
string with info about the cell format object

◆ xfId()

XLStyleIndex XLCellFormat::xfId ( ) const

Get the id of a referred <xf> entry.

Returns
The id referring to an index in cell style formats (cellStyleXfs)
Exceptions
XLExceptionwhen invoked from cellStyleFormats
Note
- only permitted for cellFormats

Friends And Related Symbol Documentation

◆ XLCellFormats

friend class XLCellFormats
friend

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