import type { Alignment } from './alignment'; import type { Border } from './borders'; import type { Fill } from './fills'; import type { Font } from './fonts'; import type { Protection } from './protection'; /** * One entry in the cellXfs / cellStyleXfs pool. Represents the union of * indexes-into-other-pools that a cell or named style points at. * * Mirrors openpyxl's CellStyle (styles/cell_style.py). The TS port keeps it as * a plain readonly object — no class, no methods. The Stylesheet `addCellXf` * allocates the index; cells store only that. */ export interface CellXf { readonly fontId: number; readonly fillId: number; readonly borderId: number; readonly numFmtId: number; /** Index into cellStyleXfs — only set for direct-cell xfs that point at a NamedStyle. */ readonly xfId?: number; readonly alignment?: Alignment; readonly protection?: Protection; readonly applyFont?: boolean; readonly applyFill?: boolean; readonly applyBorder?: boolean; readonly applyNumberFormat?: boolean; readonly applyAlignment?: boolean; readonly applyProtection?: boolean; readonly pivotButton?: boolean; readonly quotePrefix?: boolean; } export interface Stylesheet { fonts: Font[]; fills: Fill[]; borders: Border[]; /** numFmtId → format code (custom IDs only; built-ins implicit). */ numFmts: Map; cellXfs: CellXf[]; cellStyleXfs: CellXf[]; /** Named styles (Excel's "Cell Styles" gallery; populated by addNamedStyle). */ namedStyles?: Array; _fontIdByKey: Map; _fillIdByKey: Map; _borderIdByKey: Map; _xfIdByKey: Map; _styleXfIdByKey: Map; _numFmtIdByCode: Map; _namedStyleByName?: Map; } /** * Build a fresh Stylesheet pre-populated with Excel's required default entries. * Mirrors openpyxl's empty Stylesheet: fonts: [DEFAULT_FONT] (index 0) fills: * [DEFAULT_EMPTY_FILL, * DEFAULT_GRAY_FILL] (indices 0, 1 — required) * borders: [DEFAULT_BORDER] (index 0) cellXfs: empty (indices allocated on * demand) */ export declare function makeStylesheet(): Stylesheet; /** Add a Font to the pool, returning its 0-based index. Idempotent. */ export declare function addFont(ss: Stylesheet, font: Font): number; /** Add a Fill to the pool, returning its 0-based index. Idempotent. */ export declare function addFill(ss: Stylesheet, fill: Fill): number; /** Add a Border to the pool, returning its 0-based index. Idempotent. */ export declare function addBorder(ss: Stylesheet, border: Border): number; /** * Resolve a number-format string to its numFmtId. * - Built-in codes return their canonical OOXML ID. * - Otherwise the custom code is registered (and allocated an ID * ≥ {@link BUILTIN_FORMATS_MAX_SIZE}). Idempotent. */ export declare function addNumFmt(ss: Stylesheet, formatCode: string): number; /** Add a CellXf to the cellXfs pool, returning its 0-based index. Idempotent. */ export declare function addCellXf(ss: Stylesheet, xf: CellXf): number; /** Add a CellXf to the cellStyleXfs pool. Idempotent. */ export declare function addCellStyleXf(ss: Stylesheet, xf: CellXf): number; /** Returns the currently registered numFmt entries (built-ins are implicit and not included). */ export declare function getCustomNumFmts(ss: Stylesheet): ReadonlyArray<{ id: number; code: string; }>; /** Read-only snapshot of every Font entry in the pool, indexed by id. */ export declare function listFonts(ss: Stylesheet): ReadonlyArray; /** Read-only snapshot of every Fill entry in the pool, indexed by id. */ export declare function listFills(ss: Stylesheet): ReadonlyArray; /** Read-only snapshot of every Border entry in the pool, indexed by id. */ export declare function listBorders(ss: Stylesheet): ReadonlyArray; /** Read-only snapshot of every CellXf entry in the cellXfs pool. */ export declare function listCellXfs(ss: Stylesheet): ReadonlyArray; /** Read-only snapshot of every CellStyleXf entry (named-style xfs). */ export declare function listCellStyleXfs(ss: Stylesheet): ReadonlyArray; /** * Convenience: build the default `cellXfs[0]` Excel emits — points at the * workbook's font 0 / fill 0 / border 0 / numFmtId 0 (General). */ export declare function defaultCellXf(): CellXf;