import type { OneOrMany, ValElement, XsdBoolean } from "./util.js"; import type { Color } from "./sheetProperties.js"; import type { ExtensionList } from "./misc.js"; import type { ST_BorderStyle, ST_HorizontalAlignment, ST_VerticalAlignment, ST_PatternType, ST_UnderlineValues, ST_FontScheme, ST_GradientType, } from "./enums.js"; // --- Number Formats --- export interface NumFmt { $attributes?: { numFmtId: number; formatCode: string; }; } export interface NumFmts { $attributes?: { count?: number; }; numFmt: OneOrMany; } // --- Fonts --- export interface Font { name?: ValElement; charset?: ValElement; family?: ValElement; b?: ValElement | Record; i?: ValElement | Record; strike?: ValElement | Record; outline?: ValElement | Record; shadow?: ValElement | Record; condense?: ValElement | Record; extend?: ValElement | Record; color?: Color; sz?: ValElement; u?: ValElement | Record; vertAlign?: ValElement<"superscript" | "subscript" | "baseline">; scheme?: ValElement; } export interface Fonts { $attributes?: { count?: number; }; font: OneOrMany; } // --- Fills --- export interface PatternFill { $attributes?: { patternType?: ST_PatternType; }; fgColor?: Color; bgColor?: Color; } export interface GradientStop { $attributes?: { position: number; }; color: Color; } export interface GradientFill { $attributes?: { type?: ST_GradientType; degree?: number; left?: number; right?: number; top?: number; bottom?: number; }; stop: OneOrMany; } export interface Fill { patternFill?: PatternFill; gradientFill?: GradientFill; } export interface Fills { $attributes?: { count?: number; }; fill: OneOrMany; } // --- Borders --- export interface BorderEdge { $attributes?: { style?: ST_BorderStyle; }; color?: Color; } export interface Border { $attributes?: { diagonalUp?: XsdBoolean; diagonalDown?: XsdBoolean; outline?: XsdBoolean; }; left?: BorderEdge; right?: BorderEdge; top?: BorderEdge; bottom?: BorderEdge; diagonal?: BorderEdge; vertical?: BorderEdge; horizontal?: BorderEdge; } export interface Borders { $attributes?: { count?: number; }; border: OneOrMany; } // --- Alignment & Protection --- export interface Alignment { $attributes?: { horizontal?: ST_HorizontalAlignment; vertical?: ST_VerticalAlignment; textRotation?: number; wrapText?: XsdBoolean; indent?: number; relativeIndent?: number; justifyLastLine?: XsdBoolean; shrinkToFit?: XsdBoolean; readingOrder?: number; }; } export interface CellProtection { $attributes?: { locked?: XsdBoolean; hidden?: XsdBoolean; }; } // --- Cell Formats (xf) --- export interface CellFormat { $attributes?: { numFmtId?: number; fontId?: number; fillId?: number; borderId?: number; xfId?: number; quotePrefix?: XsdBoolean; pivotButton?: XsdBoolean; applyNumberFormat?: XsdBoolean; applyFont?: XsdBoolean; applyFill?: XsdBoolean; applyBorder?: XsdBoolean; applyAlignment?: XsdBoolean; applyProtection?: XsdBoolean; }; alignment?: Alignment; protection?: CellProtection; } export interface CellFormats { $attributes?: { count?: number; }; xf: OneOrMany; } // --- Cell Styles --- export interface CellStyle { $attributes?: { name: string; xfId: number; builtinId?: number; iLevel?: number; hidden?: XsdBoolean; customBuiltin?: XsdBoolean; }; } export interface CellStyles { $attributes?: { count?: number; }; cellStyle: OneOrMany; } // --- Differential Formats (for conditional formatting) --- export interface DifferentialFormat { font?: Font; numFmt?: NumFmt; fill?: Fill; alignment?: Alignment; border?: Border; protection?: CellProtection; } export interface DifferentialFormats { $attributes?: { count?: number; }; dxf?: OneOrMany; } // --- Table Styles --- export interface TableStyle { $attributes?: { name: string; pivot?: XsdBoolean; table?: XsdBoolean; count?: number; }; } export interface TableStyles { $attributes?: { count?: number; defaultTableStyle?: string; defaultPivotStyle?: string; }; tableStyle?: OneOrMany; } // --- Index Color Palette --- export interface RgbColor { $attributes?: { rgb: string; }; } export interface IndexedColors { rgbColor: OneOrMany; } export interface MruColors { color: OneOrMany; } export interface Colors { indexedColors?: IndexedColors; mruColors?: MruColors; } // --- StyleSheet (root) --- export interface StyleSheet { numFmts?: NumFmts; fonts?: Fonts; fills?: Fills; borders?: Borders; cellStyleXfs?: CellFormats; cellXfs?: CellFormats; cellStyles?: CellStyles; dxfs?: DifferentialFormats; tableStyles?: TableStyles; colors?: Colors; extLst?: ExtensionList; }