forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xlsx.d.ts
136 lines (115 loc) · 3.32 KB
/
xlsx.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// Type definitions for xlsx
// Project: https://github.com/SheetJS/js-xlsx
// Definitions by: themauveavenger <https://github.com/themauveavenger/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'xlsx' {
export function readFile(filename:string, opts?:IParsingOptions):IWorkBook;
export function read(data:any, opts?:IParsingOptions):IWorkBook;
export var utils:IUtils;
export interface IProperties {
LastAuthor?:string
Author?:string;
CreatedDate?:Date;
ModifiedDate?:Date
Application?:string;
AppVersion?:string;
Company?:string;
DocSecurity?:string;
Manager?:string;
HyperlinksChanged?: boolean;
SharedDoc?:boolean;
LinksUpToDate?:boolean;
ScaleCrop?:boolean;
Worksheets?:number;
SheetNames?:string[];
}
export interface IParsingOptions {
cellFormula?:boolean;
cellHTML?:boolean;
cellNF?:boolean;
cellStyles?:boolean;
cellDates?:boolean;
sheetStubs?:boolean;
sheetRows?:number;
bookDeps?:boolean;
bookFiles?:boolean;
bookProps?:boolean;
bookSheets?:boolean;
bookVBA?:boolean;
password?:string;
/**
* Possible options: 'binary', 'base64', 'buffer', 'file'
*/
type?:string;
}
export interface IWorkBook {
/**
* A dictionary of the worksheets in the workbook.
* Use SheetNames to reference these.
*/
Sheets:{[sheet:string]:IWorkSheet};
/**
* ordered list of the sheet names in the workbook
*/
SheetNames:string[];
/**
* an object storing the standard properties. wb.Custprops stores custom properties.
* Since the XLS standard properties deviate from the XLSX standard, XLS parsing stores core properties in both places.
*/
Props:IProperties;
}
/**
* object representing the worksheet
*/
export interface IWorkSheet {
[cell:string]:IWorkSheetCell;
}
export interface IWorkSheetCell {
/**
* The Excel Data Type of the cell.
* b Boolean, n Number, e error, s String, d Date
*/
t: string;
/**
* The raw value of the cell.
*/
v: string;
/**
* rich text encoding (if applicable)
*/
r?: string;
/**
* HTML rendering of the rich text (if applicable)
*/
h?: string;
/**
* formatted text (if applicable)
*/
w?: string;
/**
* cell formula (if applicable)
*/
f?: string;
/**
* comments associated with the cell **
*/
c?: string;
/**
* number format string associated with the cell (if requested)
*/
z?: string;
/**
* cell hyperlink object (.Target holds link, .tooltip is tooltip)
*/
l?: string;
/**
* the style/theme of the cell (if applicable)
*/
s?: string;
}
export interface IUtils {
sheet_to_json<T>(worksheet:IWorkSheet):T[];
sheet_to_csv(worksheet:IWorkSheet):any;
sheet_to_formulae(worksheet:IWorkSheet):any;
}
}