/** * declare module ExcelRows { export interface cell { text: string; } export interface Cells { 0: cell; 1: cell; 2: cell; } export interface ExcelRows { cells: Cells; } } */ /** * BinaryMatrix = [ [any, any, any, ...], [any, any, any, ...], [any, any, any, ...], ] ExcelDataType = [ { cells: { 0: { text: any }, 1: { text: any }, 2: { text: any } } }, { cells: { 0: { text: any }, 1: { text: any }, 2: { text: any } } }, ] */ export interface ColProperties { width?: number; } export interface CellStyle { align?: 'left' | 'center' | 'right'; valign?: 'top' | 'middle' | 'bottom'; font?: { bold?: boolean; }; bgcolor?: string; textwrap?: boolean; color?: string; border?: { top?: string[]; right?: string[]; bottom?: string[]; left?: string[]; }; } export interface RowsType { [key: number]: RowData; } export interface SheetDataType { name?: string; freeze?: string; styles?: CellStyle[]; merges?: string[]; cols?: { len?: number; [key: number]: ColProperties; }; rows?: { [key: number]: RowData; }; } export interface RowData { cells: { [key: number]: CellData; }; } export declare type CellMerge = [number, number]; export interface CellData { text: string; style?: number; merge?: CellMerge; } export interface RowType { [key: number]: RowData; } export default class Parser { /** * * @param {*} dataset ExcelDataType */ /** * [ [1,2,3,4], [5,6,7,8], [9,10,11,12] ] * @param {Object} BinaryMatrix * @returns {Object} ExcelDataType */ static binaryMatrix2excel(binaryMatrix: [[]]): { cells: { [key: string]: any; }; }[]; static excel2BinaryMatrix(excelData: SheetDataType): any[][]; }