UNPKG

exceljs-wrpper-to-excel-export

Version:

A simple Excel export utility using ExcelJS

58 lines (57 loc) 1.51 kB
import ExcelJS from "exceljs"; export interface SheetConfig { name: string; config: Config; data: Data[]; extraHeaders?: ExtraHeader[]; } export interface Config { columns: ColumnConfig[]; autoAdjustColumnsWidth?: boolean; maxColumnWidth?: number; groupBy?: string; groupHeaderRow?: boolean; groupTotalLable?: string; groupTotalLableCell?: string; groupSumRowStyle?: ExcelJS.Style; showLastSumColumnRow?: boolean; showSumColumnLable?: boolean; sumColumnLable?: string; sumColumnLableCell?: string; } export interface ExtraHeader { values: string[]; mergeAcross?: number[]; style?: ExcelJS.Style; } export interface ColumnConfig { header: string; key: string; type?: string; width?: number; style?: ExcelJS.Style; headerStyle?: ExcelJS.Style; groupHeader?: string; dateFormat?: string; formula?: string; sum?: boolean; sumColumnCellStyle?: ExcelJS.Style; maxWidth?: number; /** * If true, merge vertically consecutive rows with duplicate values in this column. */ mergeDuplicateRows?: boolean; } export interface Data { [key: string]: any; } export interface SumColumnCellConfig { sumColumnCellStyle?: ExcelJS.Style; } export interface GroupByConfig { groupBy?: string; groupHeaderRow?: boolean; groupTotalLable?: string; groupTotalLableCell?: string; groupSumRowStyle?: ExcelJS.Style; }