/** * Parse / serialize SpreadsheetML styles part (`CT_Stylesheet`). * * Citations: * - ECMA-376-1 §12.3.20 Styles Part; §18.8 Styles * - `CT_Stylesheet` sequence in transitional `sml.xsd`: * numFmts → fonts → fills → borders → cellStyleXfs → cellXfs → * cellStyles → dxfs → tableStyles → colors → extLst * * @private */ /** Default security ceiling for style table entry counts. */ export declare const DEFAULT_MAX_STYLE_ENTRIES = 1000000; /** * Ordered known `styleSheet` children (schema sequence). * Citations: transitional `sml.xsd` `CT_Stylesheet`. */ export declare const STYLESHEET_CHILD_ORDER: string[]; export declare type StylesheetChildName = (typeof STYLESHEET_CHILD_ORDER)[number]; /** * Highest built-in `numFmtId` (0–163). Custom formats use ids ≥ 164. * Citations: ECMA-376-1 §18.8.31; engineering pack styles-and-formats.md. */ export declare const BUILTIN_NUM_FMT_ID_MAX = 163; /** * First custom `numFmtId` allocated by the library. */ export declare const FIRST_CUSTOM_NUM_FMT_ID = 164; /** * Implied `formatCode` values (en-US, as Excel / XlsIO report them) for built-in * `numFmtId`s that are **not** written as `numFmt` rows in the package. * * Follows ECMA-376-1 §18.8.30 ids with the Microsoft Excel deltas from * [MS-OE376] §2.1.739 / [MS-OI29500] (e.g. id 14 = `m/d/yyyy`, ids 5–8 currency, * 41–44 accounting). Locale-specific built-ins (ids 23–36 / 50–81) are * intentionally omitted — resolution remains undefined until a package row * supplies `formatCode`. Never serialized into `numFmts`. * * Citations: ECMA-376-1 §18.8.30 `numFmt` (All Languages table); * [MS-OE376] §2.1.739 (Excel delta note only). */ export declare const BUILTIN_NUM_FMT_FORMAT_CODES: Readonly>; /** * Implied built-in `formatCode` for `numFmtId`, or `undefined` when the id is * not in the table (locale-only ids and ids above 163). * * Does not consult package `numFmts` rows — callers that prefer disk rows must * look those up first (see `WorkbookStyles.getFormatCode`). * * @private */ export declare function getBuiltinFormatCode(numFmtId: number): string | undefined; /** * Strip OOXML locale prefix tokens from a number format code. * * Format codes may include locale identifiers like `[$-409]`, `[$-F400]`, `[$-F800]` * at the start (per ECMA-376-1 §18.8.31). Clients (formatting libraries, CSS engines) * typically expect clean codes without these tokens. * * Examples: * - `"[$-409]#,##0.00"` → `"#,##0.00"` * - `"[$-F400][$-409]mm/dd/yyyy"` → `"mm/dd/yyyy"` * - `"#,##0.00"` → `"#,##0.00"` (unchanged if no prefix) * * Citations: ECMA-376-1 §18.8.31 `numFmt@formatCode`. * * @param formatCode The format code string, potentially with locale prefix * @returns The format code with all leading locale tokens removed */ export declare function stripFormatLocalePrefix(formatCode: string): string; /** * Convert numeric indent level to pixel-based CSS string. * * One indent level in Excel is approximately 20 pixels (Calibri 11pt baseline). * Used to populate {@link Alignment.textIndent} from {@link Alignment.indent}. * * @param indent Numeric indent level (0-based) * @returns CSS pixel string (e.g., `"24px"`) or `undefined` if indent is undefined/0 * @private */ export declare function indentToTextIndent(indent: number | undefined): string | undefined; /** * One `numFmt` row under `numFmts` (`CT_NumFmt`). * Citations: transitional `sml.xsd` `CT_NumFmt` — required `numFmtId`, `formatCode`. */ export interface NumFmtEntry { readonly numFmtId: number; readonly formatCode: string; /** Full original `` when loaded (round-trip). */ readonly xmlPreserve?: string; } /** Specifies the alignment of text across the width of a cell. */ export declare type HorizontalAlignment = 'general' | 'left' | 'center' | 'right' | 'fill' | 'justify' | 'centerContinuous' | 'distributed'; /** Specifies the vertical placement of text within a cell's height. */ export declare type VerticalAlignment = 'top' | 'center' | 'bottom' | 'justify' | 'distributed'; /** * Controls how cell contents are positioned and displayed, including * horizontal and vertical placement, text rotation, indentation, and text * wrapping. */ export interface Alignment { /** * Specifies how text is aligned horizontally within the cell — left, * center, right, or justified. See {@link HorizontalAlignment} for all * supported values. */ readonly horizontal?: string; /** * Specifies how text is aligned vertically within the cell — top, center, * or bottom. See {@link VerticalAlignment} for all supported values. */ readonly vertical?: string; /** * Specifies the angle to rotate the text, in degrees from 0 to 180. Use * 255 to stack the text vertically, one character per line. */ readonly textRotation?: number; /** * Specifies whether text that is too wide for the cell wraps onto multiple * lines instead of overflowing. */ readonly wrapText?: boolean; /** * Specifies how many indent levels to shift the text away from the aligned * edge of the cell. */ readonly indent?: number; /** * Pixel-based text indent as a CSS-compatible string (e.g., `"24px"`). * Computed from the numeric `indent` level: 1 level ≈ 20 pixels (Excel * Calibri 11pt baseline). Read-only when accessed via {@link CellFormat}. * Ignored on input (set numeric `indent` instead); stored as numeric * indent level only. */ readonly textIndent?: string; /** * Specifies the indent shift, in character widths, relative to the cell's * existing indent — used in conditional formatting highlights. */ readonly relativeIndent?: number; /** * Specifies whether the last line of wrapped text is also spread across * the full cell width when using distributed alignment. */ readonly justifyLastLine?: boolean; /** * Specifies whether text automatically shrinks to a smaller font size so * it fits within the cell without wrapping. */ readonly shrinkToFit?: boolean; /** * Specifies the text direction of the cell: `0` uses the document's * default, `1` reads left to right, and `2` reads right to left. */ readonly readingOrder?: number; } /** * Controls whether a cell's contents are locked or hidden when the * worksheet is protected. */ export interface Protection { /** * Whether the cell is locked against editing. Takes effect only when * the sheet is protected. */ readonly locked?: boolean; /** * Whether the cell's formula is hidden from the formula bar. Takes * effect only when the sheet is protected. */ readonly hidden?: boolean; } /** * Specifies a number format to use in the highlight formatting of a * conditional formatting rule. * * @private Not re-exported from the package root. Used via * {@link DifferentialFormatInput} on conditional-format handles. */ export interface DifferentialNumFmtInput { /** * The number-format code the rule applies — for example `'"$"#,##0.00'` * or `'0.0%'`. */ readonly formatCode: string; /** The numeric id stored with the format. Default `0` when omitted. */ readonly numFmtId?: number; } /** * Defines the highlight formatting for a conditional formatting rule, * combining font, number format, fill, and border settings. * * @private Not re-exported from the package root. Structural typing covers * `ConditionalFormat.format` set values. */ export interface DifferentialFormatInput { /** The font styling the format applies, such as bold text or a color. */ readonly font?: Font; /** * The number format the rule applies, given as a format code — for * example `'0.0%'`. */ readonly numFmt?: DifferentialNumFmtInput; /** The background fill the format applies, such as a solid color. */ readonly fill?: Fill; /** The borders the format applies. */ readonly border?: Border; } /** * One structured `dxf` row (positional index → `cfRule/@dxfId`). * Internal wire model: full `CT_Dxf` children including alignment/protection * for round-trip. Public authoring uses {@link DifferentialFormatInput}. * Citations: transitional sml.xsd `CT_Dxf` / `CT_Dxfs`; ECMA-376-1 §18.8.14 / §18.8.15. * @private */ export interface DxfEntry { readonly font?: FontEntry; readonly numFmt?: NumFmtEntry; readonly fill?: FillEntry; readonly alignment?: Alignment; readonly border?: CellBorder; readonly protection?: Protection; /** Unknown children under dxf other than modeled ones (e.g. extLst). */ readonly extraChildrenXml?: ReadonlyArray; /** Full original `...` when present (round-trip). */ readonly xmlPreserve?: string; } /** * * @private Not re-exported from the package root. Structural typing covers * `ConditionalFormat.format` get values. * Provides a read-only snapshot of the highlight formatting applied by a * conditional formatting rule, showing its font, number format, fill, and * border. */ export interface DifferentialFormatView { /** The font styling the format applies, such as bold text or a color. */ readonly font?: Font; /** * The number format the rule applies, including its format code — for * example `'0.0%'`. */ readonly numFmt?: { readonly numFmtId: number; readonly formatCode: string; }; /** The background fill the format applies, such as a solid color. */ readonly fill?: Fill; /** The borders the format applies. */ readonly border?: Border; } /** * Defines the complete formatting for a cell — number format, font, fill, * border, alignment, and protection — so you can apply or update its * appearance in one step. */ export interface CellStyle { /** * The number format to display values with, given as a format identifier. */ readonly numFmtId?: number; /** The font applied to the cell's text. */ readonly font?: Font; /** The background fill behind the cell's contents. */ readonly fill?: Fill; /** The lines drawn around the cell. */ readonly border?: Border; /** How the cell's text is positioned and fitted within the cell. */ readonly alignment?: Alignment; /** * Whether the cell is locked or its formula is hidden when the sheet is * protected. Takes effect only on protected sheets. */ readonly protection?: Protection; /** * Parent named-style xf index (`cellStyleXfs`); `0` is Normal. * Wire detail until named-style authoring is public — not part of the * shipped package surface (`stripInternal`). * * @private */ readonly xfId?: number; /** * When `true`, Excel keeps the cell's text exactly as typed — even when it * starts with characters that normally form a formula (`=`, `+`, `-`, `@`). * Preserved and applied on the wire; not part of the shipped package * surface until a dedicated public API exists (`stripInternal`). * * @private */ readonly quotePrefix?: boolean; /** When `true`, Excel shows the PivotTable drop-down button on the cell. */ readonly pivotButton?: boolean; } /** * Provides a read-only snapshot of a cell's format, showing which font, * fill, border, number format, and alignment settings it references. * * Font and fill colors returned by {@link Cell.style} may include * {@link Color.rgbColor}. Assigning the object back through `Cell.style` * does not write `rgbColor`. */ export interface CellFormat { /** The number format used, given as its format identifier. */ readonly numFmtId: number | undefined; /** The font used, given as its position in the workbook's shared font list. */ readonly fontId: number | undefined; /** The background fill used, given as its position in the workbook's shared fill list. */ readonly fillId: number | undefined; /** The border used, given as its position in the workbook's shared border list. */ readonly borderId: number | undefined; /** * Parent named-style xf index (`cellStyleXfs`); `0` is Normal. * Wire detail — not part of the shipped package surface (`stripInternal`). * * @private */ readonly xfId: number | undefined; /** * When `true`, the cell's text is kept exactly as typed, even if it looks * like a formula. Wire/preserve detail — not part of the shipped package * surface (`stripInternal`). * * @private */ readonly quotePrefix: boolean | undefined; /** * When `true`, Excel shows the PivotTable drop-down button on cells using * this format. */ readonly pivotButton: boolean | undefined; /** Whether this format's number format overrides the one from its base style. */ readonly applyNumberFormat: boolean | undefined; /** Whether this format's font overrides the one from its base style. */ readonly applyFont: boolean | undefined; /** Whether this format's fill overrides the one from its base style. */ readonly applyFill: boolean | undefined; /** Whether this format's border overrides the one from its base style. */ readonly applyBorder: boolean | undefined; /** Whether this format's alignment overrides the one from its base style. */ readonly applyAlignment: boolean | undefined; /** Whether this format's lock settings the one from its base style. */ readonly applyProtection: boolean | undefined; /** The text alignment settings this format includes, if any. */ readonly alignment: Alignment | undefined; /** The lock and hide settings this format includes, if any. */ readonly protection: Protection | undefined; /** * Unknown `xf` child markup kept for round-trip. Not part of the shipped * package surface (`stripInternal`). * * @private */ readonly extraChildrenXml: ReadonlyArray | undefined; /** * Original `xf` element markup for round-trip. Not part of the shipped * package surface (`stripInternal`). * * @private */ readonly xmlPreserve: string; } /** * One `xf` row under stylesheet `cellXfs` (wire / table model). * Authors use {@link CellStyle}; read snapshots use {@link CellFormat}. * Not part of the public package API (`stripInternal`). * * @private */ export interface CellXfEntry { /** The number format used, given as its format identifier. */ readonly numFmtId: number | undefined; /** The font used, given as its position in the workbook's shared font list. */ readonly fontId: number | undefined; /** The background fill used, given as its position in the workbook's shared fill list. */ readonly fillId: number | undefined; /** The border used, given as its position in the workbook's shared border list. */ readonly borderId: number | undefined; /** * The built-in style this format builds on; `0` means the default Normal * style. */ readonly xfId: number | undefined; /** When `true`, the cell's text is kept exactly as typed, even if it looks like a formula. */ readonly quotePrefix: boolean | undefined; /** * When `true`, Excel shows the PivotTable drop-down button on cells using * this format. */ readonly pivotButton: boolean | undefined; /** Whether this format's number format overrides the one from its base style. */ readonly applyNumberFormat: boolean | undefined; /** Whether this format's font overrides the one from its base style. */ readonly applyFont: boolean | undefined; /** Whether this format's fill overrides the one from its base style. */ readonly applyFill: boolean | undefined; /** Whether this format's border overrides the one from its base style. */ readonly applyBorder: boolean | undefined; /** Whether this format's alignment overrides the one from its base style. */ readonly applyAlignment: boolean | undefined; /** Whether this format's lock settings the one from its base style. */ readonly applyProtection: boolean | undefined; /** The text alignment settings this format includes, if any. */ readonly alignment: Alignment | undefined; /** The lock and hide settings this format includes, if any. */ readonly protection: Protection | undefined; /** * Any formatting parts the library does not model, kept unchanged so * loaded files save back exactly. */ readonly extraChildrenXml: ReadonlyArray | undefined; readonly xmlPreserve: string | undefined; } /** * One collection under `styleSheet`, stored as ordered opaque child elements. */ export interface StylesCollectionXml { /** Local name (`fonts`, `fills`, …). */ readonly name: string; /** Full element XML including open/close tags, or empty string when absent. */ readonly xml: string; /** Direct child element count (e.g. number of `font` under `fonts`). */ readonly count: number; } /** * Parsed `styleSheet` model (preserve-first for M1.2 skeleton). */ export interface StylesXmlModel { readonly collections: ReadonlyArray; /** Ordered unknown children under `styleSheet` (not in schema list). */ readonly unknownChildrenXml: ReadonlyArray; /** Extra root attribute text excluding xmlns. */ readonly rootExtraAttrsXml: string; } /** * Parse styles part bytes. */ export declare function parseStylesXml(bytes: Uint8Array, partName: string, options?: { readonly maxEntries?: number; }): StylesXmlModel; /** * Serialize styles model to Transitional SpreadsheetML bytes. * Emits known children in schema order, then unknown children. */ export declare function serializeStylesXml(model: { readonly collections: ReadonlyArray; readonly unknownChildrenXml?: ReadonlyArray; readonly rootExtraAttrsXml?: string; }, options?: { readonly maxEntries?: number; }): Uint8Array; /** * Build Excel-compatible baseline collections for a new library-created styles part. * * fonts(1), fills(none+gray125), borders(1), cellStyleXfs(1), cellXfs(1), cellStyles(Normal). * Citations: ECMA-376-1 §18.8; presetCellStyles sample shape. */ export declare function buildBaselineStylesCollections(): StylesCollectionXml[]; /** * Parse a single `` element (`CT_NumFmt`). * Returns `undefined` when required attributes are missing or invalid. */ export declare function parseNumFmtElement(numFmtXml: string): NumFmtEntry | undefined; /** * Parse all `numFmt` children from a `numFmts` collection element. * Skips malformed children; preserves document order. */ export declare function parseNumFmtsCollection(collectionXml: string): NumFmtEntry[]; /** * Serialize custom/loaded `numFmt` rows to a `numFmts` collection element. * Omits the collection entirely when `entries` is empty (caller should drop it). * Does not invent built-in 0–163 rows — emits exactly the provided entries. * * Citations: `CT_NumFmts` / `CT_NumFmt` in transitional `sml.xsd`; §18.8.31. */ export declare function serializeNumFmtsCollection(entries: ReadonlyArray): StylesCollectionXml | undefined; /** * Next custom `numFmtId`: `max(existing ids, 163) + 1` (always ≥ 164). * Never renumbers existing ids. */ export declare function allocateNextCustomNumFmtId(existingIds: ReadonlyArray): number; /** * Parse a single `` element into a view (best-effort attributes). */ /** * Describes a color used in cell formatting, either as a raw RGB value, a * theme color with tint, an indexed palette entry, or automatic. * * Stored attributes are written back unchanged. {@link Color.rgbColor} is a * read-only resolved view and is never serialized. */ export interface Color { /** * When `true`, the color is automatic — the viewer chooses it (usually * black text or no fill). */ readonly auto?: boolean; /** A color from the workbook's legacy indexed palette, by index. */ readonly indexed?: number; /** The exact color, as `RRGGBB` or `AARRGGBB` hex digits. */ readonly rgb?: string; /** * A color from the workbook's theme palette by index (0–11) into the * theme part `clrScheme` (§20.1.6.2). */ readonly theme?: number; /** * How much to lighten or darken a theme or indexed color: 0 leaves it * unchanged, positive values lighten, negative values darken. * Applied with the SpreadsheetML HLS tint (§18.3.1.15), not DrawingML tint. */ readonly tint?: number; /** * Resolved display color as `#RRGGBB` (no alpha). Present only on colors * the library returns from a workbook. Not written to the package, and not * used when matching styles. `undefined` for automatic colors and when the * theme or palette entry cannot be resolved. * * A caller-built `{ theme, tint }` object does not carry this value — read * it from {@link Cell.style} after the color is stored. */ readonly rgbColor?: string; } /** Specifies the underline style applied to cell text. */ export declare type UnderlineValue = 'single' | 'double' | 'singleAccounting' | 'doubleAccounting' | 'none'; /** Specifies which of a style's theme fonts a font uses. */ export declare type FontSchemeValue = 'none' | 'major' | 'minor'; /** * Describes the font applied to cell text, including its name, size, style, * color, and effects such as underline and strikethrough. * * @private */ export interface Font { /** The font face name — for example `'Calibri'` or `'Arial'`. */ readonly name?: string; /** The font size in points — for example `11`. */ readonly size?: number; /** Whether the text is bold. */ readonly bold?: boolean; /** Whether the text is italic. */ readonly italic?: boolean; /** * The underline style. Pass `true` for a plain single underline, `false` * for none, or one of the style strings such as `'single'` or * `'double'`. */ readonly underline?: UnderlineValue | boolean; /** Whether the text is struck through. */ readonly strike?: boolean; /** The color of the text. */ readonly color?: Color; /** * The font family id — a numeric classification of the font, such as * `1` for Roman serif or `2` for Swiss sans-serif. */ readonly family?: number; /** * The character-set id of the font — used for selecting an appropriate * character variant, such as `0` for ANSI or `2` for Symbol. */ readonly charset?: number; /** * Whether the font belongs to the workbook's theme fonts: `'major'` * (headings), `'minor'` (body), or `'none'` (a regular font). */ readonly scheme?: FontSchemeValue; /** * The vertical position of the text: `'baseline'`, `'superscript'`, or * `'subscript'`. */ readonly vertAlign?: string; /** Whether the text is rendered as an outline (hollow glyphs). */ readonly outline?: boolean; /** Whether the text is drawn with a shadow. */ readonly shadow?: boolean; /** Whether the text is condensed (squeezed together) on Macintosh. */ readonly condense?: boolean; /** Whether the text is stretched on Macintosh. */ readonly extend?: boolean; } /** * One `font` row under stylesheet `fonts` (wire / table model). * Authors use {@link Font}; cells and CF surfaces map rows back to `Font`. * Not part of the public package API (`stripInternal`). * * @private */ export interface FontEntry { /** The font face name — for example `'Calibri'` or `'Arial'`. */ readonly name?: string; /** The font size in points — for example `11`. */ readonly size?: number; /** Whether the text is bold. */ readonly bold?: boolean; /** Whether the text is italic. */ readonly italic?: boolean; /** The underline style, such as `'single'` or `'double'`. */ readonly underline?: UnderlineValue; /** Whether the text is struck through. */ readonly strike?: boolean; /** The color of the text. */ readonly color?: Color; /** * The font family id — a numeric classification of the font, such as * `1` for Roman serif or `2` for Swiss sans-serif. */ readonly family?: number; /** * The character-set id of the font — used for selecting an appropriate * character variant, such as `0` for ANSI or `2` for Symbol. */ readonly charset?: number; /** * Whether the font belongs to the workbook's theme fonts: `'major'` * (headings), `'minor'` (body), or `'none'` (a regular font). */ readonly scheme?: FontSchemeValue; /** * The vertical position of the text: `'baseline'`, `'superscript'`, or * `'subscript'`. */ readonly vertAlign?: string; /** Whether the text is rendered as an outline (hollow glyphs). */ readonly outline?: boolean; /** Whether the text is drawn with a shadow. */ readonly shadow?: boolean; /** Whether the text is condensed (squeezed together) on Macintosh. */ readonly condense?: boolean; /** Whether the text is stretched on Macintosh. */ readonly extend?: boolean; /** Full original `...` when loaded (round-trip). */ readonly xmlPreserve?: string; } /** * Specifies the pattern drawn in a cell's background fill, such as solid or * gray stripes. * * Values beyond the common kinds are accepted as plain strings. */ export declare type PatternType = 'none' | 'solid' | 'mediumGray' | 'darkGray' | 'lightGray' | 'darkHorizontal' | 'darkVertical' | 'darkDown' | 'darkUp' | 'darkGrid' | 'darkTrellis' | 'lightHorizontal' | 'lightVertical' | 'lightDown' | 'lightUp' | 'lightGrid' | 'lightTrellis' | 'gray125' | 'gray0625' | (string & {}); /** * Describes a cell's background fill, either as a colored pattern or a * gradient. */ export declare type Fill = { readonly type: 'pattern'; readonly patternType: PatternType; readonly fgColor?: Color; readonly bgColor?: Color; } | { readonly type: 'gradient'; /** Full `...` element (or full ``). */ readonly gradientXml: string; }; export interface FillEntry { /** * The kind of fill: a repeating pattern (`'pattern'`), a smooth color * blend (`'gradient'`), or an unrecognized format kept as-is * (`'unknown'`). */ readonly type: 'pattern' | 'gradient' | 'unknown'; /** * The pattern style — for example `'solid'` for a plain color or * `'gray125'` for a fine dot grid. */ readonly patternType?: string; /** The pattern's foreground color — the color of the pattern itself. */ readonly fgColor?: Color; /** The pattern's background color — the color behind the pattern. */ readonly bgColor?: Color; /** * The full gradient definition as raw markup, when the fill is a * gradient. */ readonly gradientXml?: string; /** * The full original `...` markup as loaded from the file; * always set for loaded and authored rows. */ readonly xmlPreserve: string; } /** Specifies the styles available for a cell's border line. */ export declare enum BorderStyle { /** No border line. */ None = "none", /** A thin solid line. */ Thin = "thin", /** A medium-weight solid line. */ Medium = "medium", /** A thin line broken into dashes. */ Dashed = "dashed", /** A thin line made of dots. */ Dotted = "dotted", /** A thick solid line. */ Thick = "thick", /** Two parallel thin lines. */ Double = "double", /** The thinnest printable line. */ Hair = "hair", /** A medium-weight line broken into dashes. */ MediumDashed = "mediumDashed", /** An alternating thin dash-dot pattern. */ DashDot = "dashDot", /** A medium-weight dash-dot pattern. */ MediumDashDot = "mediumDashDot", /** An alternating thin dash-dot-dot pattern. */ DashDotDot = "dashDotDot", /** A medium-weight dash-dot-dot pattern. */ MediumDashDotDot = "mediumDashDotDot", /** A dash-dot pattern with slanted dashes. */ SlantDashDot = "slantDashDot" } /** * Represents one of the valid {@link BorderStyle} settings as a plain * string, such as `'thin'`. * * Prefer {@link BorderStyle} members when authoring. * * Typed as the enum member values (string-enum union) for TypeScript 3.3 * compatibility — equivalent to a template-literal of {@link BorderStyle}. */ export declare type BorderStyleName = (typeof BorderStyle)[keyof typeof BorderStyle]; /** * Defines the appearance of a single border line, including its style and * color. */ export interface BorderEdge { /** * Specifies how the line is drawn — its weight and dash pattern. Use a * {@link BorderStyle} value such as `BorderStyle.Thin`. */ readonly style?: BorderStyle | BorderStyleName | string; /** Specifies the color of the border line. */ readonly color?: Color; } /** * Describes the lines drawn around a cell, covering each edge plus * diagonals so you can outline or accent cells. */ export interface Border { /** The line drawn on the cell's left edge. */ readonly left?: BorderEdge; /** The line drawn on the cell's right edge. */ readonly right?: BorderEdge; /** The line drawn on the cell's top edge. */ readonly top?: BorderEdge; /** The line drawn on the cell's bottom edge. */ readonly bottom?: BorderEdge; /** * The line drawn diagonally across the cell, used together with * `diagonalUp` and `diagonalDown`. */ readonly diagonal?: BorderEdge; /** * When `true`, draws the diagonal line from the bottom-left corner to the * top-right corner of the cell. */ readonly diagonalUp?: boolean; /** * When `true`, draws the diagonal line from the top-left corner to the * bottom-right corner of the cell. */ readonly diagonalDown?: boolean; /** * When `true`, Excel applies the left, right, top, and bottom borders only * to the outside edges of the selected cell range rather than to every * cell. */ readonly outline?: boolean; } /** * Internal stored border row in the workbook style table (includes round-trip * bags). Public authoring/reading uses {@link Border}. Renamed from * `BorderEntry`. * @private */ export interface CellBorder { /** The line drawn on the cell's left edge. */ readonly left?: BorderEdge; /** The line drawn on the cell's right edge. */ readonly right?: BorderEdge; /** The line drawn on the cell's top edge. */ readonly top?: BorderEdge; /** The line drawn on the cell's bottom edge. */ readonly bottom?: BorderEdge; /** * The line drawn diagonally across the cell, used together with * `diagonalUp` and `diagonalDown`. */ readonly diagonal?: BorderEdge; /** * When `true`, draws the diagonal line from the bottom-left corner to the * top-right corner of the cell. */ readonly diagonalUp?: boolean; /** * When `true`, draws the diagonal line from the top-left corner to the * bottom-right corner of the cell. */ readonly diagonalDown?: boolean; /** * When `true`, Excel applies the left, right, top, and bottom borders only * to the outside edges of the selected cell range rather than to every * cell. */ readonly outline?: boolean; /** * Holds any border elements the library does not model (such as additional * edge kinds), kept unchanged so loaded files save back exactly. * @private */ readonly extraChildrenXml?: ReadonlyArray; /** * The complete original border markup from the loaded file, used to save it * back unchanged. * @private */ readonly xmlPreserve: string; } /** * Reserved fill indexes for Excel-compatible parts. Internal: baseline fills 0 * (`none`) and 1 (`gray125`) are implicit library constants, not public API. * @private */ export declare const FILL_INDEX_NONE = 0; /** @private Companion to {@link FILL_INDEX_NONE}. */ export declare const FILL_INDEX_GRAY125 = 1; /** * Copy stored color attributes, dropping the computed {@link Color.rgbColor} * view so match keys and writers never see it. * @private */ export declare function storedColor(color: Color): Color; /** * Parse `CT_Color` attributes from an open-tag attribute map. */ export declare function parseColorAttrs(attrs: ReadonlyMap): Color | undefined; /** * Serialize `CT_Color` as ``. */ export declare function serializeColorElement(localName: string, color: Color | undefined): string; /** * Parse a single `` element (`CT_Font`). * * @private Styles wire codec; not part of the published package surface. */ export declare function parseFontElement(fontXml: string): FontEntry; /** * Parse all `font` children from a `fonts` collection. * * @private Styles wire codec; not part of the published package surface. */ export declare function parseFontsCollection(collectionXml: string): FontEntry[]; /** * Serialize a font entry to a `` element. * Prefer `xmlPreserve` when set (loaded rows / previously serialized). * * @private Styles wire codec; not part of the published package surface. */ export declare function serializeFontElement(entry: Font | FontEntry): string; /** * Canonical match key for exact-match font reuse (order-independent fields). * * @private Styles table helper; not part of the published package surface. */ export declare function fontMatchKey(entry: Font | FontEntry): string; /** * Build FontEntry from input (library-authored). * * @private Styles table helper; not part of the published package surface. */ export declare function fontEntryFromInput(input: Font): FontEntry; /** * Serialize fonts collection. Always emits when entries non-empty. * * @private Styles wire codec; not part of the published package surface. */ export declare function serializeFontsCollection(entries: ReadonlyArray): StylesCollectionXml | undefined; /** * Parse a single `` element (`CT_Fill`). */ export declare function parseFillElement(fillXml: string): FillEntry; /** * Parse all `fill` children from a `fills` collection. */ export declare function parseFillsCollection(collectionXml: string): FillEntry[]; /** * Serialize a fill from input or entry. */ export declare function serializeFillElement(entry: Fill | FillEntry): string; /** * Build a FillEntry from Fill (library-authored). */ export declare function fillEntryFromInput(input: Fill): FillEntry; /** * Canonical match key for fills. */ export declare function fillMatchKey(entry: Fill | FillEntry): string; /** * Serialize fills collection. */ export declare function serializeFillsCollection(entries: ReadonlyArray): StylesCollectionXml | undefined; /** * Parse a single `` element (`CT_Border`). * @private */ export declare function parseBorderElement(borderXml: string): CellBorder; /** * @private * Parse all `border` children from a `borders` collection. */ export declare function parseBordersCollection(collectionXml: string): CellBorder[]; /** * Serialize a border entry using Transitional edge names for known edges. * @private * Prefer `xmlPreserve` when set. */ export declare function serializeBorderElement(entry: Border | CellBorder): string; /** * Build an internal {@link CellBorder} from public {@link Border} input. * @private */ export declare function cellBorderFromInput(input: Border): CellBorder; /** * @private * Canonical match key for borders (Transitional edges). */ export declare function borderMatchKey(entry: Border | CellBorder): string; /** * Serialize borders collection. * * @private */ export declare function serializeBordersCollection(entries: ReadonlyArray): StylesCollectionXml | undefined; /** * Baseline fill entries: index 0 none, index 1 gray125. */ export declare function buildBaselineFillEntries(): FillEntry[]; /** * Baseline default font (Calibri 11, theme 1, minor). * Matches historical baseline child order used by buildBaselineStylesCollections. * * @private Styles table helper; not part of the published package surface. */ export declare function buildBaselineFontEntries(): FontEntry[]; /** * Baseline empty border (left/right/top/bottom/diagonal empty). * @private */ export declare function buildBaselineCellBorders(): CellBorder[]; /** * Parse `CT_CellAlignment` open-tag attributes into Alignment. * Citations: transitional sml.xsd `CT_CellAlignment`. */ export declare function parseAlignmentElement(el: string): Alignment; /** * Parse `CT_CellProtection` attributes. * Citations: transitional sml.xsd `CT_CellProtection`. */ export declare function parseProtectionElement(el: string): Protection; /** * Serialize alignment child. Empty object still emits `` when caller * sets applyAlignment (caller decides whether to include). * Note: `textIndent` is computed from `indent` and never serialized. */ export declare function serializeAlignmentElement(alignment: Alignment): string; /** * Serialize protection child. */ export declare function serializeProtectionElement(protection: Protection): string; /** * Serialize one inline `numFmt` element for nesting under `dxf`. * Citations: `CT_NumFmt` — required `numFmtId`, `formatCode`. */ export declare function serializeNumFmtElement(entry: NumFmtEntry | DifferentialNumFmtInput): string; /** * Parse a single `` element (`CT_Dxf`). * Citations: transitional sml.xsd `CT_Dxf` child sequence. * @private */ export declare function parseDxfElement(dxfXml: string): DxfEntry; /** * Parse all `dxf` children from a `dxfs` collection element. * @private */ export declare function parseDxfsCollection(collectionXml: string): DxfEntry[]; /** * Serialize one `` element. Prefer xmlPreserve when set. * Nested children use schema order: font → numFmt → fill → alignment → border → protection → extras. * @private */ export declare function serializeDxfElement(entry: DxfEntry): string; /** * Canonical match key for dxf exact-match reuse. * Alignment/protection participate when present on internal {@link DxfEntry} * @private * so loaded rows with those children do not false-match public authoring keys. */ export declare function dxfMatchKey(entry: DxfEntry | DifferentialFormatInput | DifferentialFormatView): string; /** * Build a library-authored `DxfEntry` from public input and pre-serialize xmlPreserve. * @private * Public input does not author alignment/protection (internal preserve only). */ export declare function dxfEntryFromInput(input: DifferentialFormatInput): DxfEntry; /** * Snapshot view of a dxf row (public font / numFmt / fill / border only). * @private * Alignment / protection remain on {@link DxfEntry} for internal preserve. */ export declare function dxfEntryToView(entry: DxfEntry): DifferentialFormatView; /** * Serialize `dxfs` collection. Omits the collection when empty. * @private * Citations: `CT_Dxfs` in transitional sml.xsd. */ export declare function serializeDxfsCollection(entries: ReadonlyArray): StylesCollectionXml | undefined; /** * Canonical match key for cell xf exact-match reuse. * Includes id attrs, apply* flags, alignment, protection, extras. */ export declare function cellXfMatchKey(entry: CellXfEntry | CellFormat): string; /** * Serialize one `` element. Prefer xmlPreserve when set. * Citations: `CT_Xf` sequence alignment → protection → extLst. */ export declare function serializeXfElement(entry: CellXfEntry): string; /** * Build a library-authored CellXfEntry and pre-serialize xmlPreserve. */ export declare function cellXfEntryFromResolved(fields: { readonly numFmtId?: number; readonly fontId?: number; readonly fillId?: number; readonly borderId?: number; readonly xfId?: number; readonly quotePrefix?: boolean; readonly pivotButton?: boolean; readonly applyNumberFormat?: boolean; readonly applyFont?: boolean; readonly applyFill?: boolean; readonly applyBorder?: boolean; readonly applyAlignment?: boolean; readonly applyProtection?: boolean; readonly alignment?: Alignment; readonly protection?: Protection; }): CellXfEntry; /** * Parse a single `` element into a view (attributes + alignment/protection). * Citations: `CT_Xf` in transitional sml.xsd. */ export declare function parseXfElement(xfXml: string): CellFormat; /** * Parse all `xf` children from a `cellXfs` (or cellStyleXfs) collection. */ export declare function parseCellXfsCollection(collectionXml: string): CellXfEntry[]; /** * Serialize cellXfs collection. */ export declare function serializeCellXfsCollection(entries: ReadonlyArray): StylesCollectionXml | undefined; /** * Baseline default cell xf (ids 0, xfId 0). * Matches historical baseline used by buildBaselineStylesCollections. */ export declare function buildBaselineCellXfEntries(): CellXfEntry[]; /** * Extract ordered child element XML strings from a collection element body. */ export declare function collectionItemXmls(collectionXml: string): string[];