An encapsulation of the XLSX number formats (numFmts).
More...
#include <XLStyles_NumberFormats.hpp>
|
| static std::optional< uint32_t > | standardNumberFormatId (std::string_view formatCode) noexcept |
| | Map a standard ECMA-376 number format code to its built-in ID (0-49).
|
| static std::string_view | standardFormatCode (uint32_t id) noexcept |
| | Get the standard format code for a built-in ID (0-49).
|
An encapsulation of the XLSX number formats (numFmts).
◆ XLNumberFormats() [1/4]
| XLNumberFormats::XLNumberFormats |
( |
| ) |
|
◆ XLNumberFormats() [2/4]
| XLNumberFormats::XLNumberFormats |
( |
const XMLNode & | node | ) |
|
|
explicit |
Constructor. New items should only be created through an XLStyles object.
- Parameters
-
| node | An XMLNode object with the styles item. If no input is provided, a null node is used. |
◆ XLNumberFormats() [3/4]
| XLNumberFormats::XLNumberFormats |
( |
const XLNumberFormats & | other | ) |
|
Copy Constructor.
- Parameters
-
| other | Object to be copied. |
◆ XLNumberFormats() [4/4]
| XLNumberFormats::XLNumberFormats |
( |
XLNumberFormats && | other | ) |
|
Move Constructor.
- Parameters
-
◆ ~XLNumberFormats()
| XLNumberFormats::~XLNumberFormats |
( |
| ) |
|
◆ count()
| size_t XLNumberFormats::count |
( |
| ) |
const |
Get the count of number formats.
- Returns
- The amount of entries in the number formats
◆ create()
Append a new XLNumberFormat, based on copyFrom, and return its index in numFmts node.
- Parameters
-
| copyFrom | Can provide an XLNumberFormat to use as template for the new style |
| styleEntriesPrefix | Prefix the newly created cell style XMLNode with this pugi::node_pcdata text |
- Returns
- The index of the new style as used by operator[]
◆ createNumberFormat()
| uint32_t XLNumberFormats::createNumberFormat |
( |
std::string_view | formatCode | ) |
|
Create a new custom number format with a unique ID.
- Parameters
-
| formatCode | The explicit format code string |
- Returns
- The unique number format ID (numFmtId)
◆ getFreeNumberFormatId()
| uint32_t XLNumberFormats::getFreeNumberFormatId |
( |
| ) |
const |
Get a free (unused) number format ID, skipping reserved IDs (0-163).
- Returns
- A free ID starting from 164.
◆ numberFormatById()
| XLNumberFormat XLNumberFormats::numberFormatById |
( |
uint32_t | numberFormatId | ) |
const |
Get the number format identified by numberFormatId.
- Parameters
-
| numberFormatId | a numFmtId reference to a number format |
- Returns
- An XLNumberFormat object
- Exceptions
-
| XLException | if no match for numberFormatId is found within m_numberFormats |
◆ numberFormatByIndex()
Get the number format identified by index.
- Parameters
-
- Returns
- An XLNumberFormat object
- Exceptions
-
◆ numberFormatIdFromIndex()
| uint32_t XLNumberFormats::numberFormatIdFromIndex |
( |
XLStyleIndex | index | ) |
const |
Get the numFmtId from the number format identified by index.
- Parameters
-
- Returns
- the uint32_t numFmtId corresponding to index
- Exceptions
-
◆ operator=() [1/2]
Copy assignment operator.
- Parameters
-
| other | Right hand side of assignment operation. |
- Returns
- A reference to the lhs object.
◆ operator=() [2/2]
Move assignment operator.
- Parameters
-
| other | Right hand side of assignment operation. |
- Returns
- A reference to lhs object.
◆ operator[]()
Operator overload: allow [] as shortcut access to numberFormatByIndex.
◆ standardFormatCode()
| std::string_view XLNumberFormats::standardFormatCode |
( |
uint32_t | id | ) |
|
|
staticnoexcept |
Get the standard format code for a built-in ID (0-49).
- Returns
- Format code string view, or empty if custom/unknown.
◆ standardNumberFormatId()
| std::optional< uint32_t > XLNumberFormats::standardNumberFormatId |
( |
std::string_view | formatCode | ) |
|
|
staticnoexcept |
Map a standard ECMA-376 number format code to its built-in ID (0-49).
- Returns
- Standard ID if matched, std::nullopt otherwise.
The documentation for this class was generated from the following files: