import type { Workbook } from '../workbook/workbook';
import type { AutoFilter } from './auto-filter';
import type { Worksheet } from './worksheet';
export interface TableColumn {
/** 1-based column id (per-table). */
id: number;
/** Header name. */
name: string;
/** Totals-row aggregation function. */
totalsRowFunction?: 'sum' | 'min' | 'max' | 'count' | 'countNums' | 'average' | 'stdDev' | 'var' | 'custom';
/** Override label for the totals row. */
totalsRowLabel?: string;
/** Custom totals-row formula text. */
totalsRowFormula?: string;
/** Calculated-column formula. */
calculatedColumnFormula?: string;
}
export interface TableStyleInfo {
/** Built-in style name (TableStyleMedium2, etc) or custom. */
name?: string;
showFirstColumn?: boolean;
showLastColumn?: boolean;
showRowStripes?: boolean;
showColumnStripes?: boolean;
}
export interface TableDefinition {
/** Workbook-unique id (`
`). */
id: number;
/** Workbook-unique displayName — Excel surfaces this in formulas. */
displayName: string;
/** Optional friendly name; usually matches `displayName`. */
name?: string;
/** Range covered by the table, e.g. "A1:E10". */
ref: string;
/** Number of header rows. Defaults to 1; 0 means a header-less table. */
headerRowCount?: number;
/** Number of totals rows. */
totalsRowCount?: number;
/** Whether the totals row is currently visible. */
totalsRowShown?: boolean;
styleInfo?: TableStyleInfo;
columns: TableColumn[];
autoFilter?: AutoFilter;
/** Worksheet-rels rId — populated on read; the writer assigns its own. */
rId?: string;
}
export declare function makeTableColumn(opts: {
id: number;
name: string;
}): TableColumn;
export declare function makeTableDefinition(opts: {
id: number;
displayName: string;
ref: string;
name?: string;
columns?: TableColumn[];
headerRowCount?: number;
totalsRowCount?: number;
totalsRowShown?: boolean;
styleInfo?: TableStyleInfo;
autoFilter?: AutoFilter;
}): TableDefinition;
/**
* High-level wrapper that builds a TableDefinition + pushes it onto `ws.tables`
* in one call. Auto-assigns the workbook-unique `id`, derives `displayName`
* from the supplied `name`, and constructs `TableColumn` records (1-based ids)
* from a string-array shorthand.
*/
export declare const addExcelTable: (wb: Workbook, ws: Worksheet, opts: {
name: string;
ref: string;
columns: ReadonlyArray;
style?: string;
styleInfo?: TableStyleInfo;
headerRowCount?: number;
totalsRowCount?: number;
totalsRowShown?: boolean;
autoFilter?: AutoFilter;
displayName?: string;
}) => TableDefinition;