Number Formatting
Format numbers as currency, percentages, dates, and custom patterns — a reference of all supported format codes.
How it works
This demo is a living reference for ReoGrid's number format codes. Each row shows a raw value alongside multiple format codes and their rendered output.
- Currency formats: ¥#,##0 for Japanese yen, $#,##0.00 for US dollars, and locale-aware patterns
- Percentage formats: 0% for whole numbers, 0.00% for two decimal places
- Date formats: yyyy/mm/dd, mm/dd/yyyy, and Japanese era formats (令和, 平成, 昭和)
- Custom patterns: zero-padding, conditional coloring with [Red], text literals mixed with numbers
- All format codes follow the same Excel-compatible syntax — existing Excel format strings work as-is
Key APIs used
ws.setCellNumberFormat(row, col, formatCode) Apply a format code string (e.g. '¥#,##0', '0.00%', 'yyyy/mm/dd') to a cell
ws.range(ref).setNumberFormat(formatCode) Apply the same format code to all cells in a range
ws.cell(row, col).setValue(value) Set the raw numeric value that the format code will be applied to
Related Documentation
Related Demos
Cell Types Dashboard
Progress bars, star ratings, sparkline charts, checkboxes, and hyperlinks — all rendered inside spreadsheet cells.
Data Filter & Sort
Click column header dropdowns to filter and sort rows. Switch between 300, 1K, and 10K rows to test performance.
Cell Styles
Font styles, colors, backgrounds, text alignment, and border options — a showcase of the Cell Style API.