# @salmonui/data-grid/engine/export API reference

> 65 exported symbols of @salmonui/data-grid/engine/export: 15 functions, 40 interfaces, 9 types and 1 constant.

Canonical: https://salmonui.dev/docs/reference/data-grid/engine-export

```ts
import { … } from '@salmonui/data-grid/engine/export';
```

## Functions

### createChildExportEngine

Kind: function

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/createChildExportEngine

```ts
function createChildExportEngine<Child>(descriptor: ChildGridDescriptor<Child>): DataGridEngine<Child>;
```

A headless child engine over a descriptor (local child sources are read synchronously).

### createExportModel

Kind: function

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/createExportModel

```ts
function createExportModel<Row>(engine: ExportEngine<Row>, options?: ExportModelOptions<Row>): ExportModel<Row>;
```

`createExportModel(engine, options)`: the export model of an engine with the `export` module.

### createExportModelFromContext

Kind: function

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/createExportModelFromContext

```ts
function createExportModelFromContext<Row>(ctx: ModuleContext<Row>, options?: ExportModelOptions<Row>): ExportModel<Row>;
```

Builds the export model from a module context. For renderers that load the
export code on demand: they register a context-only module up front (no
export code in the default bundle) and pass its context here later.

### createExportModule

Kind: function

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/createExportModule

```ts
function createExportModule<Row>(): ExportModule<Row>;
```

Creates the `export` module: `engine.export.getModel(options)`.

### escapeCsvFormula

Kind: function

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/escapeCsvFormula

```ts
function escapeCsvFormula(text: string, value?: unknown): string;
```

Prefixes `'` to formula-like text; a numeric `value` whose text reads as a number stays as is.

### exportCsv

Kind: function

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/exportCsv

```ts
function exportCsv<Row>(source: ExportSource<Row>, options?: CsvExportOptions<Row>, handlers?: ExportHandlers<Row, string>): Promise<ExportFile<string> | null>;
```

Exports a grid (an engine with the `export` module, or a model) as CSV text.

### exportFileName

Kind: function

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/exportFileName

```ts
function exportFileName(name: string | undefined, extension: string): string;
```

File name with the format extension (default `export`).

### hierarchyExportDetail

Kind: function

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/hierarchyExportDetail

```ts
function hierarchyExportDetail<Row>(engine: DataGridEngine<Row>, mode: ExportHierarchyMode, user?: DetailHook<Row>, options?: HierarchyDetailOptions): DetailHook<Row> | undefined;
```

The `detail` hook of a grid's hierarchy: a nested child-grid model per
parent row by `mode`, or undefined when `mode` is `none`. `user` (the
export's own `detail` hook) runs first and wins when it returns a value
(`null` suppresses the block). In `expanded` mode with an enabled `detail`
module, rows whose detail is collapsed get no block (user hook included).
Without a `detail` module the user hook is returned as is.

### isExportCapableEngine

Kind: function

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/isExportCapableEngine

```ts
function isExportCapableEngine<Row>(value: unknown): value is ExportCapableEngine<Row>;
```

True for an engine with the `export` module (as opposed to a prebuilt model).

### resolveExportModel

Kind: function

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/resolveExportModel

```ts
function resolveExportModel<Row>(source: ExportSource<Row>, options?: ExportModelOptions<Row>): ExportModel<Row>;
```

Resolves an export source to a model.

### runBeforeExport

Kind: function

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/runBeforeExport

```ts
function runBeforeExport(handlers: {
    readonly onBeforeExport?: ((event: BeforeExportEvent) => void) | undefined;
}, format: ExportFormat): boolean;
```

Raises `onBeforeExport`; true when the export may proceed.

### runExport

Kind: function

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/runExport

```ts
function runExport<Row, Data>(format: ExportFormat, source: ExportSource<Row> | readonly ExportSource<Row>[], options: ExportOptions<Row> | undefined, handlers: ExportHandlers<Row, Data>, extension: string, mimeType: string, write: (models: readonly ExportModel<Row>[]) => Promise<Data>): Promise<ExportFile<Data> | null>;
```

Runs one export: `onBeforeExport`, the model from the source and options,
the writer, then `onExport`. Resolves to null when prevented.

### streamCsv

Kind: function

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/streamCsv

```ts
function streamCsv<Row>(model: ExportModel<Row>, options?: CsvStreamOptions): AsyncGenerator<string, void, undefined>;
```

Streams the model as CSV chunks. Each chunk is complete lines; chunks end
at `chunkRows` rows or after `sliceMs`, then the iterator awaits `yield`
before producing the next one. Pipe into a `WritableStream`, a file, or
collect into a `Blob`.

### toExportModelOptions

Kind: function

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/toExportModelOptions

```ts
function toExportModelOptions<Row, Data>(options: ExportOptions<Row> | undefined, handlers?: ExportHandlers<Row, Data>): ExportModelOptions<Row>;
```

Maps public export options and bound hooks to export model options.

### writeCsv

Kind: function

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/writeCsv

```ts
function writeCsv<Row>(model: ExportModel<Row>, options?: CsvOptions): string;
```

Writes the whole model as one CSV string.

## Interfaces

### BeforeExportEvent

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/BeforeExportEvent

```ts
interface BeforeExportEvent {
    readonly format: ExportFormat;
    readonly defaultPrevented: boolean;
    preventDefault(): void;
}
```

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `format` | `readonly format: ExportFormat;` |  |  |
| `defaultPrevented` | `readonly defaultPrevented: boolean;` |  |  |
| `preventDefault` | `preventDefault(): void;` |  | Cancels the export; the export resolves to null. |

### CsvExportOptions

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/CsvExportOptions

```ts
interface CsvExportOptions<Row> extends ExportOptions<Row>, CsvOptions {
}
```

Members (16):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `delimiter` | `delimiter?: string;` | optional, inherited | Default `,`. |
| `lineBreak` | `lineBreak?: string;` | optional, inherited | Default `\r\n` (RFC 4180). |
| `includeHeaders` | `includeHeaders?: boolean;` | optional, inherited | Header line with the leaf header texts. Default true. |
| `values` | `values?: "formatted" \| "raw";` | optional, inherited | `formatted` (default): the column display text. `raw`: numbers and booleans as is, dates as ISO 8601. |
| `aggregateRows` | `aggregateRows?: boolean;` | optional, inherited | Group caption, group footer, and grid footer aggregate lines. Default true. |
| `bom` | `bom?: boolean;` | optional, inherited | Prefix a UTF-8 byte order mark (Excel detects UTF-8). Default false. |
| `quoteAll` | `quoteAll?: boolean;` | optional, inherited | Quote every field instead of only those that need it. Default false. |
| `escapeFormulas` | `escapeFormulas?: boolean;` | optional, inherited | Neutralize spreadsheet formulas in text cells: a leading `'` on tab, CR, or `=`, `+`, `-`, `@` after optional whitespace. Real numbers are kept. Default true; `false` writes raw text. |
| `treeDepthColumn` | `treeDepthColumn?: string \| boolean;` | optional, inherited | Tree mode: a leading column with each row's tree depth (0 for roots). `true` names it `Depth`; a string is the header text. Ignored outside tree mode. |
| `pages` | `pages?: "all" \| "current";` | optional, inherited | `all` (default): every page of the current query. `current`: the current page as shown. |
| `includeHiddenColumns` | `includeHiddenColumns?: boolean;` | optional, inherited | Include hidden columns. Default false. |
| `rows` | `rows?: readonly Row[];` | optional, inherited | Rows to export instead of the grid rows (for example the selected rows), with the grid's columns. |
| `columns` | `columns?: readonly ExportColumnOption[];` | optional, inherited | Export-only columns, in order. |
| `fileName` | `fileName?: string;` | optional, inherited | Download name; the format extension is added when missing. Default `export`. |
| `hierarchy` | `hierarchy?: "all" \| "expanded" \| "none";` | optional, inherited | Detail and child-grid rows: `expanded` (default), `all`, or `none`. |
| `tree` | `tree?: "all" \| "expanded";` | optional, inherited | Tree mode rows: `expanded` (default) exports the visible rows in pre-order; `all` exports every kept row regardless of expansion (XLSX `outlineCollapsed` then keeps the collapsed state). |

### CsvOptions

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/CsvOptions

```ts
interface CsvOptions {
    readonly delimiter?: string;
    readonly lineBreak?: string;
    readonly includeHeaders?: boolean;
    readonly values?: 'formatted' | 'raw';
    readonly aggregateRows?: boolean;
    readonly bom?: boolean;
    readonly quoteAll?: boolean;
    readonly escapeFormulas?: boolean;
    readonly treeDepthColumn?: boolean | string;
}
```

Members (9):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `delimiter` | `readonly delimiter?: string;` | optional | Default `,`. |
| `lineBreak` | `readonly lineBreak?: string;` | optional | Default `\r\n` (RFC 4180). |
| `includeHeaders` | `readonly includeHeaders?: boolean;` | optional | Header line with the leaf header texts. Default true. |
| `values` | `readonly values?: 'formatted' \| 'raw';` | optional | `formatted` (default): the column display text. `raw`: numbers and booleans as is, dates as ISO 8601. |
| `aggregateRows` | `readonly aggregateRows?: boolean;` | optional | Group caption, group footer, and grid footer aggregate lines. Default true. |
| `bom` | `readonly bom?: boolean;` | optional | Prefix a UTF-8 byte order mark (Excel detects UTF-8). Default false. |
| `quoteAll` | `readonly quoteAll?: boolean;` | optional | Quote every field instead of only those that need it. Default false. |
| `escapeFormulas` | `readonly escapeFormulas?: boolean;` | optional | Neutralize spreadsheet formulas in text cells: a leading `'` on tab, CR, or `=`, `+`, `-`, `@` after optional whitespace. Real numbers are kept. Default true; `false` writes raw text. |
| `treeDepthColumn` | `readonly treeDepthColumn?: boolean \| string;` | optional | Tree mode: a leading column with each row's tree depth (0 for roots). `true` names it `Depth`; a string is the header text. Ignored outside tree mode. |

### CsvStreamOptions

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/CsvStreamOptions

```ts
interface CsvStreamOptions extends CsvOptions {
    readonly chunkRows?: number;
    readonly sliceMs?: number;
    readonly yield?: () => Promise<void>;
}
```

Members (12):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `chunkRows` | `readonly chunkRows?: number;` | optional | Upper bound of rows per chunk. Default 5,000. |
| `sliceMs` | `readonly sliceMs?: number;` | optional | Time slice per chunk in ms; a chunk ends early when it runs longer. Default 25. |
| `yield` | `readonly yield?: () => Promise<void>;` | optional | Awaited between chunks. Default: a macrotask (`setTimeout(0)`) when available, else a resolved promise. |
| `delimiter` | `delimiter?: string;` | optional, inherited | Default `,`. |
| `lineBreak` | `lineBreak?: string;` | optional, inherited | Default `\r\n` (RFC 4180). |
| `includeHeaders` | `includeHeaders?: boolean;` | optional, inherited | Header line with the leaf header texts. Default true. |
| `values` | `values?: "formatted" \| "raw";` | optional, inherited | `formatted` (default): the column display text. `raw`: numbers and booleans as is, dates as ISO 8601. |
| `aggregateRows` | `aggregateRows?: boolean;` | optional, inherited | Group caption, group footer, and grid footer aggregate lines. Default true. |
| `bom` | `bom?: boolean;` | optional, inherited | Prefix a UTF-8 byte order mark (Excel detects UTF-8). Default false. |
| `quoteAll` | `quoteAll?: boolean;` | optional, inherited | Quote every field instead of only those that need it. Default false. |
| `escapeFormulas` | `escapeFormulas?: boolean;` | optional, inherited | Neutralize spreadsheet formulas in text cells: a leading `'` on tab, CR, or `=`, `+`, `-`, `@` after optional whitespace. Real numbers are kept. Default true; `false` writes raw text. |
| `treeDepthColumn` | `treeDepthColumn?: string \| boolean;` | optional, inherited | Tree mode: a leading column with each row's tree depth (0 for roots). `true` names it `Depth`; a string is the header text. Ignored outside tree mode. |

### ExportAggregateCell

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportAggregateCell

```ts
interface ExportAggregateCell {
    readonly columnId: ColumnId;
    readonly type: AggregateType;
    readonly style?: ExportCellStyle;
    readonly value: unknown;
    readonly text: string;
}
```

Members (5):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `columnId` | `readonly columnId: ColumnId;` |  |  |
| `type` | `readonly type: AggregateType;` |  |  |
| `style` | `readonly style?: ExportCellStyle;` | optional | Set by the `aggregate` hook; merged over the theme aggregate / caption style. |
| `value` | `readonly value: unknown;` |  |  |
| `text` | `readonly text: string;` |  |  |

### ExportAggregateCellHookContext

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportAggregateCellHookContext

```ts
interface ExportAggregateCellHookContext {
    readonly placement: 'footer' | 'groupFooter' | 'groupCaption';
    readonly columnId: ColumnId;
    readonly type: AggregateType;
    readonly value: unknown;
    readonly text: string;
}
```

Members (5):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `placement` | `readonly placement: 'footer' \| 'groupFooter' \| 'groupCaption';` |  |  |
| `columnId` | `readonly columnId: ColumnId;` |  |  |
| `type` | `readonly type: AggregateType;` |  |  |
| `value` | `readonly value: unknown;` |  |  |
| `text` | `readonly text: string;` |  |  |

### ExportAggregateContext

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportAggregateContext

```ts
interface ExportAggregateContext {
    readonly placement: 'footer' | 'groupFooter' | 'groupCaption';
    readonly columnId: ColumnId;
    readonly type: AggregateType;
    readonly value: unknown;
    readonly text: string;
    readonly groupId: RowId | null;
}
```

Members (6):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `placement` | `readonly placement: 'footer' \| 'groupFooter' \| 'groupCaption';` |  |  |
| `columnId` | `readonly columnId: ColumnId;` |  |  |
| `type` | `readonly type: AggregateType;` |  |  |
| `value` | `readonly value: unknown;` |  |  |
| `text` | `readonly text: string;` |  |  |
| `groupId` | `readonly groupId: RowId \| null;` |  | Group row id for group placements. |

### ExportAggregateRow

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportAggregateRow

```ts
interface ExportAggregateRow {
    readonly kind: 'aggregate';
    readonly index: number;
    readonly id: RowId;
    readonly depth: 0;
    readonly line: number;
    readonly aggregates: ExportAggregateCells;
}
```

DataGrid footer aggregate line (`model.footerRows`).

Members (6):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `kind` | `readonly kind: 'aggregate';` |  |  |
| `index` | `readonly index: number;` |  |  |
| `id` | `readonly id: RowId;` |  |  |
| `depth` | `readonly depth: 0;` |  |  |
| `line` | `readonly line: number;` |  |  |
| `aggregates` | `readonly aggregates: ExportAggregateCells;` |  |  |

### ExportCapableEngine

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportCapableEngine

```ts
interface ExportCapableEngine<Row> extends ExportEngine<Row> {
    readonly export: {
        getModel(options?: ExportModelOptions<Row>): ExportModel<Row>;
    };
}
```

An engine with the `export` module registered.

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `export` | `readonly export: {     getModel(options?: ExportModelOptions<Row>): ExportModel<Row>; };` |  |  |
| `getRow` | `getRow: (rowId: string) => Row \| undefined;` | inherited |  |

### ExportCell

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportCell

```ts
interface ExportCell {
    readonly value: unknown;
    readonly text: string;
    readonly type: ColumnType;
    readonly style?: ExportCellStyle;
    readonly formula?: string;
    readonly colSpan?: number;
    readonly rowSpan?: number;
    readonly image?: ExportImage;
}
```

One exported cell. `value` is the typed value (numbers, booleans, `Date`, strings), `text` the display string.

Members (8):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `value` | `readonly value: unknown;` |  |  |
| `text` | `readonly text: string;` |  |  |
| `type` | `readonly type: ColumnType;` |  |  |
| `style` | `readonly style?: ExportCellStyle;` | optional |  |
| `formula` | `readonly formula?: string;` | optional | XLSX formula without the leading `=`. Security: never build it from untrusted input. |
| `colSpan` | `readonly colSpan?: number;` | optional |  |
| `rowSpan` | `readonly rowSpan?: number;` | optional |  |
| `image` | `readonly image?: ExportImage;` | optional | Image drawn in the cell; `text` stays the fallback. |

### ExportCellContext

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportCellContext

```ts
interface ExportCellContext<Row> {
    readonly row: Row;
    readonly rowId: RowId;
    readonly column: ExportColumn<Row>;
    readonly cell: ExportCell;
}
```

Members (4):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `row` | `readonly row: Row;` |  |  |
| `rowId` | `readonly rowId: RowId;` |  |  |
| `column` | `readonly column: ExportColumn<Row>;` |  |  |
| `cell` | `readonly cell: ExportCell;` |  | The computed cell before the override. |

### ExportCellHookContext

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportCellHookContext

```ts
interface ExportCellHookContext<Row> {
    readonly row: Row;
    readonly rowId: RowId;
    readonly column: ExportColumnDef;
    readonly value: unknown;
    readonly text: string;
}
```

Members (5):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `row` | `readonly row: Row;` |  |  |
| `rowId` | `readonly rowId: RowId;` |  |  |
| `column` | `readonly column: ExportColumnDef;` |  |  |
| `value` | `readonly value: unknown;` |  | Typed value (numbers, booleans, `Date`, strings). |
| `text` | `readonly text: string;` |  | Display text. |

### ExportCellOverride

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportCellOverride

```ts
interface ExportCellOverride {
    readonly value?: unknown;
    readonly text?: string;
    readonly style?: ExportCellStyle;
    readonly formula?: string;
    readonly colSpan?: number;
    readonly rowSpan?: number;
    readonly image?: ExportImage;
}
```

Returned by the `cell` hook: any field overrides the computed cell.

Members (7):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `value` | `readonly value?: unknown;` | optional |  |
| `text` | `readonly text?: string;` | optional |  |
| `style` | `readonly style?: ExportCellStyle;` | optional |  |
| `formula` | `readonly formula?: string;` | optional |  |
| `colSpan` | `readonly colSpan?: number;` | optional |  |
| `rowSpan` | `readonly rowSpan?: number;` | optional |  |
| `image` | `readonly image?: ExportImage;` | optional |  |

### ExportCellPatch

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportCellPatch

```ts
interface ExportCellPatch {
    readonly value?: unknown;
    readonly text?: string;
    readonly style?: ExportCellStyle;
    readonly formula?: string;
    readonly colSpan?: number;
    readonly rowSpan?: number;
    readonly image?: ExportImage;
}
```

Returned by the `cell` hook: any field replaces the computed one. A `text`
without `value` replaces the typed value too, so XLSX writes a text cell.

Members (7):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `value` | `readonly value?: unknown;` | optional |  |
| `text` | `readonly text?: string;` | optional |  |
| `style` | `readonly style?: ExportCellStyle;` | optional |  |
| `formula` | `readonly formula?: string;` | optional | XLSX formula (with or without the leading `=`). Security: runs when the workbook opens; never build it from untrusted input. |
| `colSpan` | `readonly colSpan?: number;` | optional |  |
| `rowSpan` | `readonly rowSpan?: number;` | optional |  |
| `image` | `readonly image?: ExportImage;` | optional | Image drawn in the cell: PNG or JPEG bytes with the display size in px. XLSX anchors a picture to the cell (the text is still written unless `text: ''`); PDF draws it in the cell box, scaled to fit. Rows grow to the image height. CSV writes the text. |

### ExportCellStyle

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportCellStyle

```ts
interface ExportCellStyle {
    readonly bold?: boolean;
    readonly italic?: boolean;
    readonly color?: string;
    readonly backgroundColor?: string;
    readonly textAlign?: 'start' | 'center' | 'end';
    readonly fontSize?: number;
    readonly numberFormat?: string;
    readonly indent?: number;
}
```

Members (8):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `bold` | `readonly bold?: boolean;` | optional |  |
| `italic` | `readonly italic?: boolean;` | optional |  |
| `color` | `readonly color?: string;` | optional | `#rrggbb`. |
| `backgroundColor` | `readonly backgroundColor?: string;` | optional | `#rrggbb`. |
| `textAlign` | `readonly textAlign?: 'start' \| 'center' \| 'end';` | optional |  |
| `fontSize` | `readonly fontSize?: number;` | optional |  |
| `numberFormat` | `readonly numberFormat?: string;` | optional | Excel number format code (XLSX only), e.g. `#,##0.00`. |
| `indent` | `readonly indent?: number;` | optional | Indent levels of the text (XLSX alignment indent; PDF one font size per level). |

### ExportColumn

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportColumn

```ts
interface ExportColumn<Row> {
    readonly index: number;
    readonly columnId: ColumnId;
    readonly field: string | null;
    readonly headerText: string;
    readonly type: ColumnType;
    readonly width: number;
    readonly textAlign: 'start' | 'center' | 'end';
    readonly format: FormatDescriptor | null;
    readonly freeze: 'left' | 'right' | null;
    readonly visible: boolean;
    readonly column: ExportSourceColumn<Row>;
    value(row: Row): unknown;
    text(row: Row): string;
}
```

Members (13):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `index` | `readonly index: number;` |  | Position in `model.columns`. |
| `columnId` | `readonly columnId: ColumnId;` |  |  |
| `field` | `readonly field: string \| null;` |  |  |
| `headerText` | `readonly headerText: string;` |  |  |
| `type` | `readonly type: ColumnType;` |  |  |
| `width` | `readonly width: number;` |  | Width in CSS px (runtime width, else the numeric definition width, else 150). |
| `textAlign` | `readonly textAlign: 'start' \| 'center' \| 'end';` |  |  |
| `format` | `readonly format: FormatDescriptor \| null;` |  |  |
| `freeze` | `readonly freeze: 'left' \| 'right' \| null;` |  | Freeze zone of the column at export time. |
| `visible` | `readonly visible: boolean;` |  |  |
| `column` | `readonly column: ExportSourceColumn<Row>;` |  | The host column the export column was built from (the Data Grid passes its compiled column). |
| `value` | `value(row: Row): unknown;` |  | Typed value of a row (numbers, booleans, `Date` for date columns, strings). |
| `text` | `text(row: Row): string;` |  | Display text of a row (column formatter, `formatValue`). |

### ExportColumnDef

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportColumnDef

```ts
interface ExportColumnDef {
    readonly id?: string;
    readonly field?: string;
    readonly type?: ColumnType;
    readonly format?: string | FormatOptions;
    readonly header?: string;
}
```

The column definition fields an export hook may read (the Data Grid passes its column definition).

Members (5):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `id` | `readonly id?: string;` | optional |  |
| `field` | `readonly field?: string;` | optional |  |
| `type` | `readonly type?: ColumnType;` | optional |  |
| `format` | `readonly format?: string \| FormatOptions;` | optional |  |
| `header` | `readonly header?: string;` | optional |  |

### ExportColumnOption

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportColumnOption

```ts
interface ExportColumnOption {
    readonly id?: string;
    readonly field?: string;
    readonly header?: string;
    readonly width?: number;
}
```

An export-only column: picked by `id` (or `field`), with an optional header text and width (px).

Members (4):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `id` | `readonly id?: string;` | optional |  |
| `field` | `readonly field?: string;` | optional |  |
| `header` | `readonly header?: string;` | optional |  |
| `width` | `readonly width?: number;` | optional |  |

### ExportColumnSelection

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportColumnSelection

```ts
interface ExportColumnSelection {
    readonly columnId: ColumnId;
    readonly headerText?: string;
    readonly width?: number;
}
```

An exported column picked by id (or field) with optional overrides.

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `columnId` | `readonly columnId: ColumnId;` |  |  |
| `headerText` | `readonly headerText?: string;` | optional |  |
| `width` | `readonly width?: number;` | optional | CSS px. |

### ExportDataRow

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportDataRow

```ts
interface ExportDataRow<Row> {
    readonly kind: 'data';
    readonly index: number;
    readonly id: RowId;
    readonly row: Row;
    readonly depth: number;
    readonly collapsed?: true;
    readonly hidden?: true;
}
```

Members (7):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `kind` | `readonly kind: 'data';` |  |  |
| `index` | `readonly index: number;` |  |  |
| `id` | `readonly id: RowId;` |  |  |
| `row` | `readonly row: Row;` |  |  |
| `depth` | `readonly depth: number;` |  | Nesting depth (group levels above the row; tree depth for hierarchy rows). |
| `collapsed` | `readonly collapsed?: true;` | optional | Tree mode: a parent collapsed in the grid whose subtree follows in the export (`tree: 'all'`). |
| `hidden` | `readonly hidden?: true;` | optional | Tree mode: a row under a collapsed ancestor (`tree: 'all'`); XLSX `outlineCollapsed` hides it. |

### ExportDetail

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportDetail

```ts
interface ExportDetail {
    readonly model?: ExportModel<unknown>;
    readonly text?: readonly string[];
}
```

Detail block of a data row (`exportDetailDataBound`).
Produced by the `detail` hook today; the detail and hierarchy modules
produce it from their expansion state.

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `model` | `readonly model?: ExportModel<unknown>;` | optional | A nested grid (child grid / hierarchy level). |
| `text` | `readonly text?: readonly string[];` | optional | Plain text lines (detail template text). |

### ExportDetailContext

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportDetailContext

```ts
interface ExportDetailContext<Row> {
    readonly row: Row;
    readonly rowId: RowId;
    readonly depth: number;
    readonly hierarchy: ExportHierarchyMode;
}
```

Members (4):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `row` | `readonly row: Row;` |  |  |
| `rowId` | `readonly rowId: RowId;` |  |  |
| `depth` | `readonly depth: number;` |  |  |
| `hierarchy` | `readonly hierarchy: ExportHierarchyMode;` |  |  |

### ExportDetailRow

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportDetailRow

```ts
interface ExportDetailRow<Row> {
    readonly kind: 'detail';
    readonly index: number;
    readonly id: RowId;
    readonly parentId: RowId;
    readonly row: Row;
    readonly depth: number;
    readonly detail: ExportDetail;
}
```

Members (7):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `kind` | `readonly kind: 'detail';` |  |  |
| `index` | `readonly index: number;` |  |  |
| `id` | `readonly id: RowId;` |  |  |
| `parentId` | `readonly parentId: RowId;` |  |  |
| `row` | `readonly row: Row;` |  |  |
| `depth` | `readonly depth: number;` |  |  |
| `detail` | `readonly detail: ExportDetail;` |  |  |

### ExportEngine

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportEngine

```ts
interface ExportEngine<Row = unknown> {
    getRow(rowId: RowId): Row | undefined;
}
```

An engine-like source; it must have the `export` module (`engine.export.getModel`), checked at run time.

Members (1):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `getRow` | `getRow(rowId: RowId): Row \| undefined;` |  |  |

### ExportEvent

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportEvent

```ts
interface ExportEvent<Data = Uint8Array> {
    readonly format: ExportFormat;
    readonly file: Promise<ExportFile<Data>>;
}
```

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `format` | `readonly format: ExportFormat;` |  |  |
| `file` | `readonly file: Promise<ExportFile<Data>>;` |  |  |

### ExportFile

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportFile

```ts
interface ExportFile<Data = Uint8Array> {
    readonly fileName: string;
    readonly mimeType: string;
    readonly data: Data;
}
```

Result of an export; the React instance methods download it as `fileName`.

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `fileName` | `readonly fileName: string;` |  |  |
| `mimeType` | `readonly mimeType: string;` |  |  |
| `data` | `readonly data: Data;` |  |  |

### ExportGroupCaptionContext

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportGroupCaptionContext

```ts
interface ExportGroupCaptionContext {
    readonly columnId: ColumnId;
    readonly headerText: string;
    readonly key: Json;
    readonly value: unknown;
    readonly formattedKey: string;
    readonly count: number;
    readonly depth: number;
    readonly caption: string;
}
```

Members (8):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `columnId` | `readonly columnId: ColumnId;` |  |  |
| `headerText` | `readonly headerText: string;` |  |  |
| `key` | `readonly key: Json;` |  |  |
| `value` | `readonly value: unknown;` |  |  |
| `formattedKey` | `readonly formattedKey: string;` |  |  |
| `count` | `readonly count: number;` |  |  |
| `depth` | `readonly depth: number;` |  |  |
| `caption` | `readonly caption: string;` |  |  |

### ExportGroupCaptionHookContext

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportGroupCaptionHookContext

```ts
interface ExportGroupCaptionHookContext {
    readonly columnId: ColumnId;
    readonly header: string;
    readonly key: Json;
    readonly value: unknown;
    readonly formattedKey: string;
    readonly count: number;
    readonly depth: number;
    readonly text: string;
}
```

Members (8):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `columnId` | `readonly columnId: ColumnId;` |  |  |
| `header` | `readonly header: string;` |  |  |
| `key` | `readonly key: Json;` |  |  |
| `value` | `readonly value: unknown;` |  |  |
| `formattedKey` | `readonly formattedKey: string;` |  |  |
| `count` | `readonly count: number;` |  |  |
| `depth` | `readonly depth: number;` |  |  |
| `text` | `readonly text: string;` |  | Default caption (`Header: key - N items`). |

### ExportGroupFooterRow

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportGroupFooterRow

```ts
interface ExportGroupFooterRow {
    readonly kind: 'groupFooter';
    readonly index: number;
    readonly id: RowId;
    readonly groupId: RowId;
    readonly depth: number;
    readonly line: number;
    readonly aggregates: ExportAggregateCells;
}
```

Members (7):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `kind` | `readonly kind: 'groupFooter';` |  |  |
| `index` | `readonly index: number;` |  |  |
| `id` | `readonly id: RowId;` |  |  |
| `groupId` | `readonly groupId: RowId;` |  |  |
| `depth` | `readonly depth: number;` |  |  |
| `line` | `readonly line: number;` |  | One footer line per aggregate stacked on a column. |
| `aggregates` | `readonly aggregates: ExportAggregateCells;` |  |  |

### ExportGroupRow

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportGroupRow

```ts
interface ExportGroupRow {
    readonly kind: 'group';
    readonly index: number;
    readonly id: RowId;
    readonly depth: number;
    readonly columnId: ColumnId;
    readonly headerText: string;
    readonly key: Json;
    readonly value: unknown;
    readonly formattedKey: string;
    readonly count: number;
    readonly caption: string;
    readonly aggregates: ExportAggregateCells;
}
```

Members (12):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `kind` | `readonly kind: 'group';` |  |  |
| `index` | `readonly index: number;` |  |  |
| `id` | `readonly id: RowId;` |  |  |
| `depth` | `readonly depth: number;` |  |  |
| `columnId` | `readonly columnId: ColumnId;` |  |  |
| `headerText` | `readonly headerText: string;` |  |  |
| `key` | `readonly key: Json;` |  |  |
| `value` | `readonly value: unknown;` |  |  |
| `formattedKey` | `readonly formattedKey: string;` |  |  |
| `count` | `readonly count: number;` |  |  |
| `caption` | `readonly caption: string;` |  | Caption text (`groupCaption` hook, else `Header: key - N items`). |
| `aggregates` | `readonly aggregates: ExportAggregateCells;` |  | `groupCaption` aggregates. |

### ExportHandlers

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportHandlers

```ts
interface ExportHandlers<Row, Data = Uint8Array> {
    readonly onBeforeExport?: (event: BeforeExportEvent) => void;
    readonly onExport?: (event: ExportEvent<Data>) => void;
    readonly cell?: (ctx: ExportCellHookContext<Row>) => ExportCellPatch | null | undefined | void;
    readonly headerCell?: (ctx: ExportHeaderCellHookContext<Row>) => {
        readonly text?: string;
        readonly style?: ExportCellStyle;
    } | null | undefined | void;
    readonly aggregateCell?: (ctx: ExportAggregateCellHookContext) => {
        readonly text?: string;
        readonly style?: ExportCellStyle;
    } | null | undefined | void;
    readonly groupCaption?: (ctx: ExportGroupCaptionHookContext) => string | null | undefined | void;
    readonly detail?: (ctx: ExportDetailContext<Row>) => ExportDetail | null | undefined | void;
}
```

Hooks and events of an export.

Members (7):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `onBeforeExport` | `readonly onBeforeExport?: (event: BeforeExportEvent) => void;` | optional | Synchronous; `preventDefault()` cancels. |
| `onExport` | `readonly onExport?: (event: ExportEvent<Data>) => void;` | optional | Called once the file is being produced; `file` resolves when it is ready. |
| `cell` | `readonly cell?: (ctx: ExportCellHookContext<Row>) => ExportCellPatch \| null \| undefined \| void;` | optional | Per data cell. Not called when unset. |
| `headerCell` | `readonly headerCell?: (ctx: ExportHeaderCellHookContext<Row>) => {     readonly text?: string;     readonly style?: ExportCellStyle; } \| null \| undefined \| void;` | optional | Per header cell. |
| `aggregateCell` | `readonly aggregateCell?: (ctx: ExportAggregateCellHookContext) => {     readonly text?: string;     readonly style?: ExportCellStyle; } \| null \| undefined \| void;` | optional | Per aggregate cell (grid footer, group footer, group caption). |
| `groupCaption` | `readonly groupCaption?: (ctx: ExportGroupCaptionHookContext) => string \| null \| undefined \| void;` | optional | Group caption text. |
| `detail` | `readonly detail?: (ctx: ExportDetailContext<Row>) => ExportDetail \| null \| undefined \| void;` | optional | A detail block written after a data row (text lines or a child table), or null for none. |

### ExportHeaderCell

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportHeaderCell

```ts
interface ExportHeaderCell {
    readonly text: string;
    readonly columnId: ColumnId;
    readonly colIndex: number;
    readonly colSpan: number;
    readonly rowSpan: number;
    readonly leaf: boolean;
    readonly textAlign: 'start' | 'center' | 'end';
    readonly style?: ExportCellStyle;
}
```

A header cell. Header rows list cells at their start column; covered positions have no entry.

Members (8):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `text` | `readonly text: string;` |  |  |
| `columnId` | `readonly columnId: ColumnId;` |  |  |
| `colIndex` | `readonly colIndex: number;` |  | Index of the first exported column the cell covers. |
| `colSpan` | `readonly colSpan: number;` |  |  |
| `rowSpan` | `readonly rowSpan: number;` |  |  |
| `leaf` | `readonly leaf: boolean;` |  |  |
| `textAlign` | `readonly textAlign: 'start' \| 'center' \| 'end';` |  |  |
| `style` | `readonly style?: ExportCellStyle;` | optional | Set by header hooks (`excelHeaderQueryCellInfo`); merged over the theme header style. |

### ExportHeaderCellHookContext

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportHeaderCellHookContext

```ts
interface ExportHeaderCellHookContext<Row> {
    readonly column: ExportColumnDef | undefined;
    readonly columnId: ColumnId;
    readonly text: string;
    readonly colSpan: number;
    readonly rowSpan: number;
}
```

Members (5):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `column` | `readonly column: ExportColumnDef \| undefined;` |  | Leaf column, or undefined for a stacked group header. |
| `columnId` | `readonly columnId: ColumnId;` |  |  |
| `text` | `readonly text: string;` |  |  |
| `colSpan` | `readonly colSpan: number;` |  |  |
| `rowSpan` | `readonly rowSpan: number;` |  |  |

### ExportHeaderContext

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportHeaderContext

```ts
interface ExportHeaderContext<Row> {
    readonly columns: readonly ExportColumn<Row>[];
    readonly headerRows: readonly ExportHeaderRow[];
}
```

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `columns` | `readonly columns: readonly ExportColumn<Row>[];` |  |  |
| `headerRows` | `readonly headerRows: readonly ExportHeaderRow[];` |  | The rows built from the column header tree. |

### ExportImage

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportImage

```ts
interface ExportImage {
    readonly data: Uint8Array;
    readonly type?: 'png' | 'jpeg';
    readonly width: number;
    readonly height: number;
}
```

An image drawn in a cell: PNG or JPEG bytes and the display size
in CSS px (96 dpi). `type` is sniffed from the magic bytes when absent.
XLSX embeds it as a picture anchored to the cell, PDF as an image XObject;
CSV writes the cell text.

Members (4):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `data` | `readonly data: Uint8Array;` |  |  |
| `type` | `readonly type?: 'png' \| 'jpeg';` | optional |  |
| `width` | `readonly width: number;` |  |  |
| `height` | `readonly height: number;` |  |  |

### ExportModel

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportModel

```ts
interface ExportModel<Row> {
    readonly scope: ExportScope;
    readonly columns: readonly ExportColumn<Row>[];
    readonly headerRows: readonly ExportHeaderRow[];
    readonly rowCount: number;
    readonly dataRowCount: number;
    readonly detailRowCount: number;
    readonly groupDepth: number;
    readonly tree?: {
        readonly column: number;
        readonly depth: number;
    };
    readonly footerRows: readonly ExportAggregateRow[];
    readonly frozen: {
        readonly left: number;
        readonly right: number;
        readonly top: number;
    };
    readonly locale: string;
    readonly direction: 'ltr' | 'rtl';
    readonly timeZone: string | undefined;
    readonly hasCellHook: boolean;
    getRow(index: number): ExportRow<Row>;
    rows(): IterableIterator<ExportRow<Row>>;
    cell(row: ExportDataRow<Row>, column: ExportColumn<Row>): ExportCell;
}
```

Members (17):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `scope` | `readonly scope: ExportScope;` |  |  |
| `columns` | `readonly columns: readonly ExportColumn<Row>[];` |  |  |
| `headerRows` | `readonly headerRows: readonly ExportHeaderRow[];` |  | Header rows, top first; the last row holds the leaves (rowSpan covers shallower leaves). |
| `rowCount` | `readonly rowCount: number;` |  | Body rows (data, captions, group footers, details). |
| `dataRowCount` | `readonly dataRowCount: number;` |  | Data rows among the body rows. |
| `detailRowCount` | `readonly detailRowCount: number;` |  | Detail rows among the body rows (detail blocks and child models). |
| `groupDepth` | `readonly groupDepth: number;` |  | Grouping levels (outline depth). 0 when ungrouped or flattened. |
| `tree` | `readonly tree?: {     readonly column: number;     readonly depth: number; };` | optional | Tree mode: the exported tree column (index in `columns`, -1 when it is not exported) and the deepest data row depth. Absent outside tree mode. |
| `footerRows` | `readonly footerRows: readonly ExportAggregateRow[];` |  | DataGrid footer aggregate lines. |
| `frozen` | `readonly frozen: {     readonly left: number;     readonly right: number;     readonly top: number; };` |  | Frozen exported columns at the start (left zone) and end (right zone); frozen body rows at the top. |
| `locale` | `readonly locale: string;` |  |  |
| `direction` | `readonly direction: 'ltr' \| 'rtl';` |  |  |
| `timeZone` | `readonly timeZone: string \| undefined;` |  |  |
| `hasCellHook` | `readonly hasCellHook: boolean;` |  | True when a `cell` hook is set (writers then go through `cell()` for every cell). |
| `getRow` | `getRow(index: number): ExportRow<Row>;` |  |  |
| `rows` | `rows(): IterableIterator<ExportRow<Row>>;` |  |  |
| `cell` | `cell(row: ExportDataRow<Row>, column: ExportColumn<Row>): ExportCell;` |  | The exported cell of a data row (hook applied). |

### ExportModelOptions

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportModelOptions

```ts
interface ExportModelOptions<Row> {
    readonly scope?: ExportScope;
    readonly includeHiddenColumns?: boolean;
    readonly columns?: readonly (ColumnId | ExportColumnSelection)[];
    readonly rows?: readonly Row[];
    readonly rowIds?: readonly RowId[];
    readonly groups?: 'captions' | 'flatten';
    readonly collapsedGroups?: 'include' | 'exclude';
    readonly aggregates?: boolean;
    readonly hierarchy?: ExportHierarchyMode;
    readonly tree?: 'expanded' | 'all';
    readonly cell?: (ctx: ExportCellContext<Row>) => ExportCellOverride | null | undefined | void;
    readonly groupCaption?: (ctx: ExportGroupCaptionContext) => string | null | undefined | void;
    readonly aggregate?: (ctx: ExportAggregateContext) => string | {
        readonly text?: string;
        readonly style?: ExportCellStyle;
    } | null | undefined | void;
    readonly detail?: (ctx: ExportDetailContext<Row>) => ExportDetail | null | undefined | void;
    readonly headerRows?: (ctx: ExportHeaderContext<Row>) => readonly ExportHeaderRow[];
}
```

Members (15):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `scope` | `readonly scope?: ExportScope;` | optional | Default `filtered`. |
| `includeHiddenColumns` | `readonly includeHiddenColumns?: boolean;` | optional | Export hidden columns too. Default false. |
| `columns` | `readonly columns?: readonly (ColumnId \| ExportColumnSelection)[];` | optional | Explicit leaf columns, in export order (overrides visibility and order); objects override header text and width. |
| `rows` | `readonly rows?: readonly Row[];` | optional | Custom data: exported with the grid's columns, ungrouped, in the given order. |
| `rowIds` | `readonly rowIds?: readonly RowId[];` | optional | Explicit rows by id, in the given order (overrides `scope`). |
| `groups` | `readonly groups?: 'captions' \| 'flatten';` | optional | Group rows: `captions` (default) writes caption and group footer rows; `flatten` writes data rows only. |
| `collapsedGroups` | `readonly collapsedGroups?: 'include' \| 'exclude';` | optional | `include` (default) exports the rows of collapsed groups; `exclude` exports what the grid shows. |
| `aggregates` | `readonly aggregates?: boolean;` | optional | Aggregate rows (grid footer, group footers, caption aggregates). Default true. |
| `hierarchy` | `readonly hierarchy?: ExportHierarchyMode;` | optional | Detail / hierarchy mode passed to the `detail` hook. Default `expanded`. |
| `tree` | `readonly tree?: 'expanded' \| 'all';` | optional | Tree mode rows: `expanded` (default) writes the visible rows in pre-order; `all` writes every kept row regardless of expansion, flagging collapsed parents and the rows they hide. |
| `cell` | `readonly cell?: (ctx: ExportCellContext<Row>) => ExportCellOverride \| null \| undefined \| void;` | optional | Per-cell customization. |
| `groupCaption` | `readonly groupCaption?: (ctx: ExportGroupCaptionContext) => string \| null \| undefined \| void;` | optional | Returns the group caption text. |
| `aggregate` | `readonly aggregate?: (ctx: ExportAggregateContext) => string \| {     readonly text?: string;     readonly style?: ExportCellStyle; } \| null \| undefined \| void;` | optional | Returns the aggregate text, or text and style. |
| `detail` | `readonly detail?: (ctx: ExportDetailContext<Row>) => ExportDetail \| null \| undefined \| void;` | optional | A detail block written after the row, or null. |
| `headerRows` | `readonly headerRows?: (ctx: ExportHeaderContext<Row>) => readonly ExportHeaderRow[];` | optional | Replaces the header rows (custom stacked headers). |

### ExportOptions

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportOptions

```ts
interface ExportOptions<Row> {
    readonly pages?: 'current' | 'all';
    readonly includeHiddenColumns?: boolean;
    readonly rows?: readonly Row[];
    readonly columns?: readonly ExportColumnOption[];
    readonly fileName?: string;
    readonly hierarchy?: 'expanded' | 'all' | 'none';
    readonly tree?: 'expanded' | 'all';
}
```

Options shared by `exportCsv`, `exportXlsx`, and `exportPdf`.

Members (7):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `pages` | `readonly pages?: 'current' \| 'all';` | optional | `all` (default): every page of the current query. `current`: the current page as shown. |
| `includeHiddenColumns` | `readonly includeHiddenColumns?: boolean;` | optional | Include hidden columns. Default false. |
| `rows` | `readonly rows?: readonly Row[];` | optional | Rows to export instead of the grid rows (for example the selected rows), with the grid's columns. |
| `columns` | `readonly columns?: readonly ExportColumnOption[];` | optional | Export-only columns, in order. |
| `fileName` | `readonly fileName?: string;` | optional | Download name; the format extension is added when missing. Default `export`. |
| `hierarchy` | `readonly hierarchy?: 'expanded' \| 'all' \| 'none';` | optional | Detail and child-grid rows: `expanded` (default), `all`, or `none`. |
| `tree` | `readonly tree?: 'expanded' \| 'all';` | optional | Tree mode rows: `expanded` (default) exports the visible rows in pre-order; `all` exports every kept row regardless of expansion (XLSX `outlineCollapsed` then keeps the collapsed state). |

### ExportSourceColumn

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportSourceColumn

```ts
interface ExportSourceColumn<Row> {
    readonly columnId: ColumnId;
    readonly path: readonly ColumnId[];
    readonly def: ExportColumnDef;
    readonly accessor: (row: Row) => unknown;
}
```

The host column behind an export column (the Data Grid passes its compiled column).

Members (4):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `columnId` | `readonly columnId: ColumnId;` |  |  |
| `path` | `readonly path: readonly ColumnId[];` |  | Stacked header ancestry, root first, including this column. |
| `def` | `readonly def: ExportColumnDef;` |  |  |
| `accessor` | `readonly accessor: (row: Row) => unknown;` |  |  |

### HierarchyDetailOptions

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/HierarchyDetailOptions

```ts
interface HierarchyDetailOptions {
    readonly maxDepth?: number;
}
```

Options of a child model (the parent export's scope does not apply; child grids are not paged in export).

Members (1):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `maxDepth` | `readonly maxDepth?: number;` | optional | Upper bound of nested levels (Excel outlines nest at most 7). Default 7. |

## Types

### ExportAggregateCells

Kind: type

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportAggregateCells

```ts
type ExportAggregateCells = readonly (ExportAggregateCell | null)[];
```

Aggregate cells per exported column (`null` where a column has none).

### ExportFormat

Kind: type

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportFormat

```ts
type ExportFormat = 'excel' | 'csv' | 'pdf';
```

Export formats (`excel` writes an `.xlsx` file).

### ExportHeaderRow

Kind: type

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportHeaderRow

```ts
type ExportHeaderRow = readonly ExportHeaderCell[];
```

### ExportHierarchyMode

Kind: type

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportHierarchyMode

```ts
type ExportHierarchyMode = 'expanded' | 'all' | 'none';
```

Detail / hierarchy export mode (`hierarchyExportMode`). Reserved for the detail and tree modules.

### ExportMethods

Kind: type

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportMethods

```ts
type ExportMethods<Row> = {
    getModel(ctx: ModuleContext<Row>, options?: ExportModelOptions<Row>): ExportModel<Row>;
};
```

Members (1):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `getModel` | `getModel(ctx: ModuleContext<Row>, options?: ExportModelOptions<Row>): ExportModel<Row>;` |  | Builds the export model of the current grid state. |

### ExportModule

Kind: type

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportModule

```ts
type ExportModule<Row> = DataGridModule<Row, null, never, 'export', ExportMethods<Row>>;
```

Members (18):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `name` | `name: "export";` | inherited |  |
| `dependencies` | `dependencies?: readonly string[];` | optional, inherited | Validated at engine creation. |
| `inSnapshot` | `inSnapshot?: boolean;` | optional, inherited | When true (default) the slice lives in `snapshot.modules[name]` and every change replaces the grid snapshot. High-churn modules (focus, selection, drafts) set false and notify through row/cell/header/module channels only. |
| `commands` | `commands: readonly never[];` | inherited | Declared, validated, serializable. Every type must start with `${name}.`. |
| `initialState` | `initialState: (options: DataGridOptions<Row>) => null;` | inherited |  |
| `reduce` | `reduce?: ((state: null, command: never, ctx: ModuleContext<Row>) => CommandRejection \| null);` | optional, inherited |  |
| `extendColumns` | `extendColumns?: ((columns: readonly CompiledColumn<Row>[], ctx: ModuleContext<Row>) => readonly CompiledColumn<Row>[]);` | optional, inherited |  |
| `extendQuery` | `extendQuery?: ((query: DataQuery, state: null) => DataQuery);` | optional, inherited |  |
| `pipeline` | `pipeline?: readonly PipelineStage<Row, null>[];` | optional, inherited |  |
| `selectors` | `selectors?: Readonly<Record<string, (snapshot: DataGridSnapshot<Row>) => unknown>>;` | optional, inherited |  |
| `methods` | `methods?: ExportMethods<Row>;` | optional, inherited | Reads that need more than the snapshot (facets, pager totals). Must not change state; names may not collide with command actions. |
| `notify` | `notify?: ((previous: null, next: null, ctx: ModuleContext<Row>) => NotificationScope);` | optional, inherited |  |
| `hiddenColumns` | `hiddenColumns?: ((state: null) => readonly string[]);` | optional, inherited | Leaf columns this module hides from the visible column set (grouped columns with `showGroupedColumns: false`). |
| `interceptRead` | `interceptRead?: ((query: DataQuery, state: null, ctx: ModuleContext<Row>) => boolean);` | optional, inherited | Remote sources only: return true to serve the main read of `query` yourself (lazy grouping loads group levels instead of rows). The engine then shows no source rows and runs only the stages the source did not perform. |
| `onQueryChange` | `onQueryChange?: ((previous: DataQuery, next: DataQuery, ctx: ModuleContext<Row>) => void);` | optional, inherited | Called after the effective query changed (sort, filter, search, page, group). Runs inside the dispatch of the command that changed it; may dispatch commands through `ctx` (selection clears itself here when it does not persist). |
| `onConnect` | `onConnect?: ((ctx: ModuleContext<Row>) => void);` | optional, inherited | `engine.connect()` ran (`deferDataSource`): start loads that were held while disconnected. |
| `onSourceEvent` | `onSourceEvent?: ((event: DataSourceEvent<Row>, state: null, ctx: ModuleContext<Row>) => boolean);` | optional, inherited | A data source event (patch or reset). Return true to consume it: the engine then leaves its source rows unchanged (infinite scroll applies write echoes to the blocks it owns). |
| `dispose` | `dispose?: (() => void);` | optional, inherited |  |

### ExportRow

Kind: type

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportRow

```ts
type ExportRow<Row> = ExportDataRow<Row> | ExportGroupRow | ExportGroupFooterRow | ExportAggregateRow | ExportDetailRow<Row>;
```

### ExportScope

Kind: type

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportScope

```ts
type ExportScope = 'filtered' | 'page' | 'selected' | 'all';
```

Which rows an export covers:
- `filtered` (default, `AllPages`): every page of the current query (search,
  filter, sort, grouping applied).
- `page` (`CurrentPage`): the rows of the current page as the grid shows them.
- `selected`: the selected rows, in view order (ungrouped).
- `all`: every source row in source order, ignoring the query.

### ExportSource

Kind: type

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/ExportSource

```ts
type ExportSource<Row> = ExportModel<Row> | ExportEngine<Row>;
```

Export model source: a prebuilt model or an engine with the `export` module.

## Constants

### isFormulaText

Kind: const

Page: https://salmonui.dev/docs/reference/data-grid/engine-export/isFormulaText

```ts
const isFormulaText: (text: string) => boolean;
```

Whether a spreadsheet could read this text as a formula.
