/** * Excel Cell Format Parser * A simplified implementation for formatting cell values according to Excel numFmt patterns * Supports: General, percentages, decimals, thousands separators, dates, currencies, * scientific notation, fractions, elapsed time, and more */ import type { NumFmt } from "../types.js"; /** * Get format string from numFmtId * Handles default mappings for certain format IDs */ export declare function getFormat(numFmtId: number): string; /** * Check if format is "General" */ declare function isGeneral(fmt: string): boolean; /** * Check if format is a date format */ declare function isDateFormat(fmt: string): boolean; /** * Main format function - formats a value according to Excel numFmt * @param fmt The Excel number format string (e.g., "0.00%", "#,##0", "yyyy-mm-dd") * @param val The value to format */ export declare function format(fmt: string, val: number | string | boolean): string; export declare const cellFormat: { format: typeof format; getFormat: typeof getFormat; isDateFormat: typeof isDateFormat; isGeneral: typeof isGeneral; }; /** * Check if format is a pure time format (no date components like y, m for month, d). * Time formats only contain: h, m (minutes in time context), s, AM/PM. * Excludes elapsed time formats like [h]:mm:ss which need the full serial number. */ export declare function isTimeOnlyFormat(fmt: string): boolean; /** * Check if format is a date format (contains y, d, or month-m). * More precise than the internal isDateFormat — correctly handles elapsed time * formats like [h]:mm:ss (not a date format) and distinguishes month-m from minute-m. */ export declare function isDateDisplayFormat(fmt: string): boolean; /** * Format a value according to the given format string. * Handles Date objects with timezone-independent Excel serial conversion. */ export declare function formatCellValue(value: Date | number | boolean | string, fmt: string, dateFormat?: string): string; /** Minimal cell shape needed by {@link getCellDisplayText} — avoids importing Cell. */ interface CellLike { value: unknown; numFmt: string | NumFmt | undefined; text: string; } /** * Get the formatted display text for a cell value. * * Handles primitive values, Date objects, formula results, and falls back to * `cell.text` for complex types (rich text, hyperlinks, errors, etc.). * * @param cell - A cell (or cell-like object) with `.value`, `.numFmt`, and `.text` * @param dateFormat - Optional custom date format override */ export declare function getCellDisplayText(cell: CellLike, dateFormat?: string): string; export {};