1. Overview
GS‑Base supports a variety of built‑in numeric styles, each with its own configurable options. These styles control how numbers, dates, times, percentages, fractions, and scientific values are displayed.
You can use the following standard numeric styles and their options:
Default
- No specific formatting.
- Numbers with more than 15 digits are displayed in exponential scientific format.
General
- decimal places (0 to 14)
- leading zeros (0 to 14)
- thousand separator
- how negative numbers are rendered
- display factor (displayed numbers are divided by 1000 to that power)
Currency
- currency symbol position
- currency symbol
- how negative numbers are rendered
- display factor (displayed numbers are divided by 1000 to that power)
Accounting
- currency symbol
Date
- date pattern
- fixed or system‑dependent year/month/day order
Time
- time/period pattern
Date/Time
- date pattern
- time pattern
- fixed or system‑dependent year/month/day order
- date/time order
Percent
- decimal places (0 to 14)
Fraction
- either a fixed denominator value (1 to 9,223,372,036,854,775,807)
- or a fixed number of denominator digits (1 to 19)
Scientific
- decimal places (0 to 14)
- a fixed exponent value
2. User‑Defined Numeric Formats
You can define your own numeric formats by entering a custom style pattern in the Style dialog. Custom formats can be saved as new user styles for reuse.
To understand user‑defined formats, it helps to see how standard formats are constructed. For example, the accounting format is:
_(\$* #,##0.00_);"($"* #,##0.00\);_(\$* \-??_);_(@_)
A fraction format with a fixed denominator of 4 can be defined as:
?\ ?/\4
3. Conditional Formatting with Colors
User‑defined formats allow you to specify font colors for numbers that meet certain conditions. For example:
[green]#.#;[red]\-#.#;[blue]#.#;[gray]@
This displays:
- positive numbers in green
- negative numbers in red
- zero values in blue
- text labels in gray
Another example:
[red][<10]#0.00;[yellow][<=50]#0.0;[green][<400]##0;[magenta][>=400]#00
This displays:
- numbers < 10 in red
- numbers ≤ 50 in yellow
- numbers < 400 in green
- numbers ≥ 400 in magenta
Color values may be expressed as RGB values. For example:
[red][<10]#0.00 is equivalent to [#FF0000][<10]#0.00
You may also use one of the following predefined color names:
| black | [#000000] | maroon | [#800000] |
| green | [#008000] | olive | [#808000] |
| navy | [#000080] | purple | [#800080] |
| teal | [#008080] | gray | [#808080] |
| silver | [#C0C0C0] | red | [#FF0000] |
| lime | [#00FF00] | yellow; | [#FFFF00] |
| blue | [#0000FF] | fuchsia | [#FF00FF] |
| aqua | [#00FFFF] | white | [#FFFFFF] |