Formatting and Number Display
Formatting changes how a cell looks while it preserves the typed value the cell holds. Format cells in the Home ribbon of the editor or in code through a worksheet-bound range. Number formats decide how stored numbers, currencies, percentages and dates are displayed, without changing the numbers themselves.
Format a Range in Code
The following code formats the column headings of the first worksheet and displays two columns of amounts as US dollars. editor is the Spreadsheet of the browser editor:
const sheet = editor.workbook.sheets.at(0);
sheet.range('A1:F1').format({
font: { family: 'Liberation Sans', size: 11, bold: true },
fill: '#163b63', textColor: '#ffffff', wrapText: true
});
sheet.range('E2:F25').format({
numberFormat: { type: 'currency', currency: 'USD', decimals: 2 }
});
The code works as follows:
Range.formatapplies aFormatpatch to the whole range.- The first call formats the headings in
A1:F1:fontsets Liberation Sans in size 11 and bold,fillthe background#163b63,textColorwhite text andwrapTextwraps the text in the cells. - The second call sets
numberFormatforE2:F25: the typecurrency, the currencyUSDand two decimal places.
Unspecified properties retain the existing formatting. Use the documented null reset values where supported: an omitted value and an explicit reset are different operations. The Format reference lists the grouped font, alignment and number options.
Format a Selection in the UI
Select the range.
Open Format Cells from a launcher of the Home ribbon or from the context menu of the cell. The Number section previews the first cell with the draft display format:

For sales totals, choose Currency, the appropriate symbol and the displayed decimal places.
Open the other sections for alignment, font, borders, fill and protection.
Choose OK to apply the draft. Cancel leaves the cells as they were.
Format Cells Dialog explains each section with screenshots.
Choose a Number Format
General, numeric, currency and accounting, percentage, date and time, scientific, fraction and supported custom format codes control the display. For example, a stored 0.15 displayed as a percentage becomes 15%, and the number remains 0.15. Increasing the decimal places does not restore precision that was never stored.
- Custom codes. Use
numberFormat.codefor an explicit Excel-style code. - Locales. Use
numberFormat.localefor a specific display locale. - Dates. Date serials need the date system of the workbook,
Workbook.dateSystem. A German date display such asdd.mm.yyyyis a format choice, not an instruction to parse arbitrary localized text as a date.
Use Styles, Themes and Rich Text
- Named cell styles provide reusable formatting.
- Workbook theme colors provide coordinated choices.
- Tables have separate native table styles.
- Rich text applies formatting to runs within one cell, with
Cell.setRichText. Preserve the run boundaries when you change only part of the content.
Edit a Cell Style
Open Home → Cell Styles and choose New Cell Style…, or open an existing style for modification. The Cell Style dialog shares the six sections and persistent preview of Format Cells. Enter a meaningful Name, enable the formatting categories the style should include and configure those categories. Opening one section closes the previous one without resizing the dialog.

The shared preview combines alignment, text orientation, font and fill. In Border, use the left-side line style, color and presets and click edges in that preview to edit the style's borders. In Fill, choose Pattern Style, Pattern Color and Background Color. Enable Apply Fill to include the background and pattern in the saved style; gallery previews show the pattern.
Choose Save Style to keep the definition or Cancel to discard the draft. Included categories determine what the style supplies; a disabled category is not a request to clear that formatting from every cell. The existing reset and delete commands remain available where they apply to the selected style.
Deploy Fonts Before AutoFit and Export
Use deployed fonts and await initialization before AutoFit or export. Font metrics affect column widths, wrapping, row heights and pagination.
A supported browser display face is not necessarily sufficient for PDF embedding. Custom Fonts covers the fonts of the browser editor and of the backend.
How Conditional Formatting Relates to the Base Style
Review conditional formatting separately from the base style. Calculated rules can change the effective displayed appearance without overwriting the underlying base style.
Pattern Fills
Apply hatch fills using fillPattern and a background fillColor. Set fillPattern to null to return to a solid fill. Patterns are editable through the cell and range formatting APIs and through the Fill section of Format Cells and Cell Style. They render as clipped vector marks in PDF and round-trip through XLSX, ODS and TXWB. Changing a pattern does not change cell values.
const sheet = editor.workbook.sheets.at(0);
sheet.cell('B3').setText('Planned activity');
sheet.cell('B3').format({ fillColor: '#ffffff', fillPattern: { type: 'lightUp', color: '#735773' } });
Next Steps
- Format Cells Dialog: go through each section of the dialog with screenshots.
- Conditional Formatting and Cell Styles: add rules that change the appearance with the data and create reusable named styles.
- Custom Fonts: deploy licensed fonts for the browser editor and the backend.
- Dates and Locales: keep the stored date, the date system, the format code and the locale apart.