Expand description
GridCraft number formats: Excel format codes (#,##0.00;[Red](#,##0.00), dates, fractions,
scientific…), the General display format and the TEXT() worksheet function. en-US only.
Structs§
- Formatted
- A formatted value ready to paint.
- Number
Format - A parsed number format code. Cheap to clone.
Enums§
- Format
Color - Colour from a
[Red]or[ColorN]section tag. - Format
Kind - Best guess at the ribbon’s number-format category.
Constants§
- MAX_
FORMAT_ CODE_ CHARS - Longest number format code, in characters (not bytes), that is parsed: Excel’s own limit.
A longer code is invalid:
NumberFormat::parsereturns a General format (the cell shows its value unformatted; the stored code is kept as is) andTEXTreturns#VALUE!. The cap also bounds every allocation that scales with the number of placeholders in a code.
Functions§
- builtin_
format - Built-in format code for an id (0..=49, en-US), e.g. 14 => “m/d/yyyy”. Locale-specific ids
(23–36) and unknown ids return
None. - builtin_
id - Id of a built-in format code. Matching ignores case and backslash escapes.
- format_
general_ fit - General format squeezed into
max_charscharacters. Excel shows fewer decimals, then scientific notation, then “####” when a column is narrow;Nonemeans the caller paints “####”. - format_
value - Formats a cell value for display.
- text_
function - The
TEXT()worksheet function: formats a value with a format code. Numeric text is converted to a number first; other text and booleans (asTRUE/FALSE) go through the text section, or are returned as is.