Skip to content

ws.styles

WorksheetStyles

Sub-API for named cell style operations on a worksheet.

3 methods

applyStyle

Promise<void>
applyStyle(address: string, styleName: string): Promise<void>;
ParameterTypeRequired
addressstringrequired
styleNamestringrequired

Apply a named style to a cell. Resolves the style name to its format definition and applies all format properties to the target cell. @param address - A1-style cell address @param styleName - Name of the style to apply (e.g., "Normal", "Heading 1") @throws KernelError if style name is not found

applyStyleToRange

Promise<void>
applyStyleToRange(range: string | CellRange, styleName: string): Promise<void>;
ParameterTypeRequired
rangestring | CellRangerequired
styleNamestringrequired

Apply a named style to a range. @param range - A1-style range string (e.g. "A1:C3") @param styleName - Name of the style to apply @throws KernelError if style name is not found

getStyle

Promise<string | null>
getStyle(address: string): Promise<string | null>;
ParameterTypeRequired
addressstringrequired

Get the name of the named style that matches a cell's format (best-effort). Since Mog copies format values rather than storing a style reference, this performs a reverse lookup by comparing the cell's current format against all known style formats. @param address - A1-style cell address @returns Style name if a matching style is found, null otherwise