modern-xlsx API Reference - v1.3.0
    Preparing search index...

    Interface DrawTableFromDataOptions

    Options for drawTableFromData.

    interface DrawTableFromDataOptions {
        alternateRowColor?: string | null;
        autoFilter?: boolean;
        autoWidth?: boolean;
        bodyAlign?: "left" | "center" | "right";
        bodyFont?: Partial<FontData>;
        borderColor?: string;
        borderStyle?: BorderStyle | null;
        cellStyles?: Record<string, CellStyle>;
        columns?: TableColumn[];
        columnWidths?: number[];
        freezeHeader?: boolean;
        headerAlign?: "left" | "center" | "right";
        headerColor?: string;
        headerFont?: Partial<FontData>;
        headerMap?: Record<string, string>;
        headers?: string[];
        merges?: { col: number; colSpan?: number; row: number; rowSpan?: number }[];
        origin?: string;
        verticalAlign?: "center" | "top" | "bottom";
        wrapText?: boolean;
    }

    Hierarchy

    Index
    alternateRowColor?: string | null

    Alternating row background color (hex). Null/undefined = no striping.

    autoFilter?: boolean

    Add auto-filter dropdowns to the headers, spanning the header row through the last data row. Default: false.

    autoWidth?: boolean

    Auto-calculate column widths from content. Default: false.

    bodyAlign?: "left" | "center" | "right"

    Default horizontal alignment for body cells.

    bodyFont?: Partial<FontData>

    Body font override.

    borderColor?: string

    Border color (hex). Default: '000000'.

    borderStyle?: BorderStyle | null

    Border style for all cells. Default: 'thin'. Set to null for no borders.

    cellStyles?: Record<string, CellStyle>

    Per-cell style overrides. Key is "row,col" (0-based, data area).

    columns?: TableColumn[]

    Column definitions for header, width, alignment, and number format.

    columnWidths?: number[]

    Fixed column widths array. A width above 0 wins over columns[c].width and over autoWidth for that column; 0 or less counts as unset.

    freezeHeader?: boolean

    Freeze the rows down to and including the header row. Default: false.

    headerAlign?: "left" | "center" | "right"

    Default horizontal alignment for header cells. Default: 'center'.

    headerColor?: string

    Header row background color (hex, no #). Default: '4472C4'.

    headerFont?: Partial<FontData>

    Header row font. Default: bold white.

    headerMap?: Record<string, string>

    Map object keys to display headers.

    headers?: string[]

    Explicit column order. If omitted, uses Object.keys of first item.

    merges?: { col: number; colSpan?: number; row: number; rowSpan?: number }[]

    Cells to merge. Row/col are 0-based relative to data area (row 0 = first data row).

    origin?: string

    Origin cell reference (default: "A1").

    verticalAlign?: "center" | "top" | "bottom"

    Default vertical alignment for all cells.

    wrapText?: boolean

    Enable text wrapping in body cells. Default: false.