|
OpenXLSX 1.9.1
|
An implementation class encapsulating the properties and behaviours of a spreadsheet cell. More...
#include <XLCell.hpp>
Public Member Functions | |
| XLCell () | |
| Default constructor. Constructs a null object. | |
| XLCell (const XMLNode &cellNode, const XLSharedStrings &sharedStrings, XLWorksheet *wks=nullptr) | |
| Constructs an XLCell mapped to an XML node. | |
| XLCell (const XLCell &other) | |
| Copy constructor. | |
| XLCell (XLCell &&other) noexcept | |
| Move constructor. | |
| virtual | ~XLCell () |
| Destructor. | |
| virtual XLCell & | operator= (const XLCell &other) |
| Copy assignment operator. | |
| virtual XLCell & | operator= (XLCell &&other) noexcept |
| Move assignment operator. | |
| void | copyFrom (XLCell const &other) |
| Copy contents of a cell, value & formula. | |
| bool | empty () const |
| test if cell object has no (valid) content | |
| operator bool () const | |
| opposite of empty() | |
| void | clear (uint32_t keep) |
| clear all cell content and attributes except for the cell reference (attribute r) | |
| XLCellValueProxy & | value () |
| Retrieves the mutable value proxy for the cell. | |
| const XLCellValueProxy & | value () const |
| Retrieves the read-only value proxy for the cell. | |
| XLCellReference | cellReference () const |
| get the XLCellReference object for the cell. | |
| XLCell | offset (uint16_t rowOffset, uint16_t colOffset) const |
| get the XLCell object from the current cell offset | |
| bool | hasFormula () const |
| test if cell has a formula (XML) node, even if it is an empty string | |
| XLFormulaProxy & | formula () |
| Retrieves the mutable formula proxy for the cell. | |
| const XLFormulaProxy & | formula () const |
| Retrieves the read-only formula proxy for the cell. | |
| std::string | getString () const |
| XLStyleIndex | cellFormat () const |
| Get the array index of xl/styles.xml:<styleSheet>:<cellXfs> for the style used in this cell. This value is stored in the s attribute of a cell like so: s="2". | |
| XLCell & | setCellFormat (XLStyleIndex cellFormatIndex) |
| Set the cell style (attribute s) with a reference to the array index of xl/styles.xml:<styleSheet>:<cellXfs> | |
| XLCell & | setStyle (const XLStyle &style) |
| Apply a high-level XLStyle to this cell. Automatically creates or reuses the required underlying XML structures in xl/styles.xml. | |
| XLThreadedComment | addComment (std::string_view text, std::string_view author="") |
| Add a modern threaded comment (Excel 365) to this cell fluently. | |
| XLCell & | addNote (std::string_view text, std::string_view author="") |
| Add a legacy yellow note to this cell fluently. | |
| void | print (std::basic_ostream< char > &ostr) const |
| Print the XML contents of the XLCell using the underlying XMLNode print function. | |
Friends | |
| class | XLCellIterator |
| class | XLCellValueProxy |
| class | XLFormulaProxy |
| class | XLRowDataIterator |
| bool | operator== (const XLCell &lhs, const XLCell &rhs) |
| bool | operator!= (const XLCell &lhs, const XLCell &rhs) |
An implementation class encapsulating the properties and behaviours of a spreadsheet cell.
| XLCell::XLCell | ( | ) |
Default constructor. Constructs a null object.
| XLCell::XLCell | ( | const XMLNode & | cellNode, |
| const XLSharedStrings & | sharedStrings, | ||
| XLWorksheet * | wks = nullptr |
||
| ) |
Constructs an XLCell mapped to an XML node.
| cellNode | The underlying XML node representing the cell. |
| sharedStrings | Reference to the workbook's shared strings table. |
| wks | Pointer to the parent worksheet for fluent API support. |
This constructor creates a XLCell object based on the cell XMLNode input parameter, and is intended for use when the corresponding cell XMLNode already exist. If a cell XMLNode does not exist (i.e., the cell is empty), use the relevant constructor to create an XLCell from a XLCellReference parameter.
| XLCell::XLCell | ( | const XLCell & | other | ) |
Copy constructor.
| other | The XLCell object to be copied. |
|
noexcept |
Move constructor.
| other | The XLCell object to be moved |
|
virtualdefault |
Destructor.
| XLThreadedComment XLCell::addComment | ( | std::string_view | text, |
| std::string_view | author = "" |
||
| ) |
Add a modern threaded comment (Excel 365) to this cell fluently.
| XLCell & XLCell::addNote | ( | std::string_view | text, |
| std::string_view | author = "" |
||
| ) |
| size_t XLCell::cellFormat | ( | ) | const |
Get the array index of xl/styles.xml:<styleSheet>:<cellXfs> for the style used in this cell. This value is stored in the s attribute of a cell like so: s="2".
| XLCellReference XLCell::cellReference | ( | ) | const |
get the XLCellReference object for the cell.
| void XLCell::clear | ( | uint32_t | keep | ) |
clear all cell content and attributes except for the cell reference (attribute r)
| keep | do not clear cell properties whose flags are set in keep (XLKeepCellStyle, XLKeepCellType, XLKeepCellValue, XLKeepCellFormula), flags can be combined with bitwise OR |
| void XLCell::copyFrom | ( | XLCell const & | other | ) |
Copy contents of a cell, value & formula.
| other | The XLCell object from which to copy |
| bool XLCell::empty | ( | ) | const |
test if cell object has no (valid) content
| XLFormulaProxy & XLCell::formula | ( | ) |
Retrieves the mutable formula proxy for the cell.
| const XLFormulaProxy & XLCell::formula | ( | ) | const |
Retrieves the read-only formula proxy for the cell.
|
inline |
| bool XLCell::hasFormula | ( | ) | const |
test if cell has a formula (XML) node, even if it is an empty string
| XLCell XLCell::offset | ( | uint16_t | rowOffset, |
| uint16_t | colOffset | ||
| ) | const |
|
explicit |
opposite of empty()
Copy assignment operator.
| other | The XLCell object to be copy assigned |
Reimplemented in OpenXLSX::XLCellAssignable.
Move assignment operator.
| other | The XLCell object to be move assigned |
Reimplemented in OpenXLSX::XLCellAssignable.
| void XLCell::print | ( | std::basic_ostream< char > & | ostr | ) | const |
Print the XML contents of the XLCell using the underlying XMLNode print function.
| XLCell & XLCell::setCellFormat | ( | XLStyleIndex | cellFormatIndex | ) |
Set the cell style (attribute s) with a reference to the array index of xl/styles.xml:<styleSheet>:<cellXfs>
| cellFormatIndex | The style to set, corresponding to the nidex of XLStyles::cellStyles() |
set the s attribute of the cell node, pointing to an xl/styles.xml cellXfs index the attribute will be created if not existant, function will fail if attribute creation fails
Apply a high-level XLStyle to this cell. Automatically creates or reuses the required underlying XML structures in xl/styles.xml.
| style | The requested high-level style |
| XLCellValueProxy & XLCell::value | ( | ) |
Retrieves the mutable value proxy for the cell.
| const XLCellValueProxy & XLCell::value | ( | ) | const |
Retrieves the read-only value proxy for the cell.
|
friend |
|
friend |
|
friend |
|
friend |