xlnt
|
Describes the number formatting applied to text and numbers within a certain cell. More...
#include <number_format.hpp>
Public Member Functions | |
number_format () | |
Constructs a default number_format equivalent to "General" More... | |
number_format (std::size_t builtin_id) | |
Constructs a number format equivalent to that returned from number_format::from_builtin_id(builtin_id). More... | |
number_format (const std::string &code) | |
Constructs a number format from a code string. If the string matches a builtin ID, its ID will also be set to match the builtin ID. More... | |
number_format (const std::string &code, std::size_t custom_id) | |
Constructs a number format from a code string and custom ID. Custom ID should generally be >= 164. More... | |
void | format_string (const std::string &format_code) |
Sets the format code of this number format to format_code. More... | |
void | format_string (const std::string &format_code, std::size_t custom_id) |
Sets the format code of this number format to format_code and the ID to custom_id. More... | |
std::string | format_string () const |
Returns the format code this number format uses. More... | |
bool | has_id () const |
Returns true if this number format has an ID. More... | |
void | id (std::size_t id) |
Sets the ID of this number format to id. More... | |
std::size_t | id () const |
Returns the ID of this format. More... | |
std::string | format (const std::string &text) const |
Returns text formatted according to this number format's format code. More... | |
std::string | format (double number, calendar base_date) const |
Returns number formatted according to this number format's format code with the given base date. More... | |
bool | is_date_format () const |
Returns true if this format code returns a number formatted as a date. More... | |
bool | operator== (const number_format &other) const |
Returns true if this format is equivalent to other. More... | |
bool | operator!= (const number_format &other) const |
Returns true if this format is not equivalent to other. More... | |
Static Public Member Functions | |
static const number_format | general () |
Number format "General" More... | |
static const number_format | text () |
Number format "@" More... | |
static const number_format | number () |
Number format "0" More... | |
static const number_format | number_00 () |
Number format "00" More... | |
static const number_format | number_comma_separated1 () |
Number format "#,##0.00" More... | |
static const number_format | percentage () |
Number format "0%" More... | |
static const number_format | percentage_00 () |
Number format "0.00%" More... | |
static const number_format | date_yyyymmdd2 () |
Number format "yyyy-mm-dd" More... | |
static const number_format | date_yymmdd () |
Number format "yy-mm-dd" More... | |
static const number_format | date_ddmmyyyy () |
Number format "dd/mm/yy" More... | |
static const number_format | date_dmyslash () |
Number format "d/m/yy" More... | |
static const number_format | date_dmyminus () |
Number format "d-m-yy" More... | |
static const number_format | date_dmminus () |
Number format "d-m" More... | |
static const number_format | date_myminus () |
Number format "m-yy" More... | |
static const number_format | date_xlsx14 () |
Number format "mm-dd-yy" More... | |
static const number_format | date_xlsx15 () |
Number format "d-mmm-yy" More... | |
static const number_format | date_xlsx16 () |
Number format "d-mmm" More... | |
static const number_format | date_xlsx17 () |
Number format "mmm-yy" More... | |
static const number_format | date_xlsx22 () |
Number format "m/d/yy h:mm" More... | |
static const number_format | date_datetime () |
Number format "yyyy-mm-dd h:mm:ss" More... | |
static const number_format | date_time1 () |
Number format "h:mm AM/PM" More... | |
static const number_format | date_time2 () |
Number format "h:mm:ss AM/PM" More... | |
static const number_format | date_time3 () |
Number format "h:mm" More... | |
static const number_format | date_time4 () |
Number format "h:mm:ss" More... | |
static const number_format | date_time5 () |
Number format "mm:ss" More... | |
static const number_format | date_time6 () |
Number format "h:mm:ss" More... | |
static bool | is_builtin_format (std::size_t builtin_id) |
Returns true if the given format ID corresponds to a known builtin format. More... | |
static const number_format & | from_builtin_id (std::size_t builtin_id) |
Returns the format with the given ID. Thows an invalid_parameter exception if builtin_id is not a valid ID. More... | |
Describes the number formatting applied to text and numbers within a certain cell.
xlnt::number_format::number_format | ( | ) |
Constructs a default number_format equivalent to "General"
xlnt::number_format::number_format | ( | std::size_t | builtin_id | ) |
Constructs a number format equivalent to that returned from number_format::from_builtin_id(builtin_id).
xlnt::number_format::number_format | ( | const std::string & | code | ) |
Constructs a number format from a code string. If the string matches a builtin ID, its ID will also be set to match the builtin ID.
xlnt::number_format::number_format | ( | const std::string & | code, |
std::size_t | custom_id | ||
) |
Constructs a number format from a code string and custom ID. Custom ID should generally be >= 164.
|
static |
Number format "yyyy-mm-dd h:mm:ss"
|
static |
Number format "dd/mm/yy"
|
static |
Number format "d-m"
|
static |
Number format "d-m-yy"
|
static |
Number format "d/m/yy"
|
static |
Number format "m-yy"
|
static |
Number format "h:mm AM/PM"
|
static |
Number format "h:mm:ss AM/PM"
|
static |
Number format "h:mm"
|
static |
Number format "h:mm:ss"
|
static |
Number format "mm:ss"
|
static |
Number format "h:mm:ss"
|
static |
Number format "mm-dd-yy"
|
static |
Number format "d-mmm-yy"
|
static |
Number format "d-mmm"
|
static |
Number format "mmm-yy"
|
static |
Number format "m/d/yy h:mm"
|
static |
Number format "yy-mm-dd"
|
static |
Number format "yyyy-mm-dd"
std::string xlnt::number_format::format | ( | const std::string & | text | ) | const |
Returns text formatted according to this number format's format code.
std::string xlnt::number_format::format | ( | double | number, |
calendar | base_date | ||
) | const |
Returns number formatted according to this number format's format code with the given base date.
void xlnt::number_format::format_string | ( | const std::string & | format_code | ) |
Sets the format code of this number format to format_code.
void xlnt::number_format::format_string | ( | const std::string & | format_code, |
std::size_t | custom_id | ||
) |
Sets the format code of this number format to format_code and the ID to custom_id.
std::string xlnt::number_format::format_string | ( | ) | const |
Returns the format code this number format uses.
|
static |
Returns the format with the given ID. Thows an invalid_parameter exception if builtin_id is not a valid ID.
|
static |
Number format "General"
bool xlnt::number_format::has_id | ( | ) | const |
Returns true if this number format has an ID.
void xlnt::number_format::id | ( | std::size_t | id | ) |
Sets the ID of this number format to id.
std::size_t xlnt::number_format::id | ( | ) | const |
Returns the ID of this format.
|
static |
Returns true if the given format ID corresponds to a known builtin format.
bool xlnt::number_format::is_date_format | ( | ) | const |
Returns true if this format code returns a number formatted as a date.
|
static |
Number format "0"
|
static |
Number format "00"
|
static |
Number format "#,##0.00"
bool xlnt::number_format::operator!= | ( | const number_format & | other | ) | const |
Returns true if this format is not equivalent to other.
bool xlnt::number_format::operator== | ( | const number_format & | other | ) | const |
Returns true if this format is equivalent to other.
|
static |
Number format "0%"
|
static |
Number format "0.00%"
|
static |
Number format "@"