@shbernal/ts-xlsx 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +23 -0
- package/README.md +230 -0
- package/dist/core/address.d.ts +49 -0
- package/dist/core/address.js +125 -0
- package/dist/core/autofilter.d.ts +55 -0
- package/dist/core/autofilter.js +48 -0
- package/dist/core/cell.d.ts +132 -0
- package/dist/core/cell.js +249 -0
- package/dist/core/color-resolution.d.ts +58 -0
- package/dist/core/color-resolution.js +170 -0
- package/dist/core/column.d.ts +87 -0
- package/dist/core/column.js +167 -0
- package/dist/core/comment-thread.d.ts +116 -0
- package/dist/core/comment-thread.js +62 -0
- package/dist/core/conditional-formatting-overlay.d.ts +15 -0
- package/dist/core/conditional-formatting-overlay.js +24 -0
- package/dist/core/conditional-formatting.d.ts +70 -0
- package/dist/core/conditional-formatting.js +35 -0
- package/dist/core/containers.d.ts +2 -0
- package/dist/core/containers.js +25 -0
- package/dist/core/data-validation-overlay.d.ts +28 -0
- package/dist/core/data-validation-overlay.js +56 -0
- package/dist/core/data-validation.d.ts +38 -0
- package/dist/core/data-validation.js +13 -0
- package/dist/core/date.d.ts +25 -0
- package/dist/core/date.js +58 -0
- package/dist/core/formula.d.ts +49 -0
- package/dist/core/formula.js +319 -0
- package/dist/core/grid-edits.d.ts +22 -0
- package/dist/core/grid-edits.js +206 -0
- package/dist/core/image.d.ts +76 -0
- package/dist/core/image.js +65 -0
- package/dist/core/internal.d.ts +11 -0
- package/dist/core/internal.js +29 -0
- package/dist/core/merge.d.ts +13 -0
- package/dist/core/merge.js +26 -0
- package/dist/core/modern-functions.d.ts +1 -0
- package/dist/core/modern-functions.js +165 -0
- package/dist/core/page-setup.d.ts +94 -0
- package/dist/core/page-setup.js +6 -0
- package/dist/core/pivot-table.d.ts +113 -0
- package/dist/core/pivot-table.js +249 -0
- package/dist/core/preserved.d.ts +58 -0
- package/dist/core/preserved.js +5 -0
- package/dist/core/protection.d.ts +67 -0
- package/dist/core/protection.js +68 -0
- package/dist/core/range.d.ts +112 -0
- package/dist/core/range.js +283 -0
- package/dist/core/row.d.ts +73 -0
- package/dist/core/row.js +135 -0
- package/dist/core/style.d.ts +246 -0
- package/dist/core/style.js +125 -0
- package/dist/core/table-style.d.ts +67 -0
- package/dist/core/table-style.js +90 -0
- package/dist/core/table.d.ts +194 -0
- package/dist/core/table.js +291 -0
- package/dist/core/theme.d.ts +90 -0
- package/dist/core/theme.js +272 -0
- package/dist/core/value.d.ts +115 -0
- package/dist/core/value.js +144 -0
- package/dist/core/workbook-protection.d.ts +27 -0
- package/dist/core/workbook-protection.js +25 -0
- package/dist/core/workbook.d.ts +528 -0
- package/dist/core/workbook.js +732 -0
- package/dist/core/worksheet-model.d.ts +34 -0
- package/dist/core/worksheet-model.js +100 -0
- package/dist/core/worksheet.d.ts +647 -0
- package/dist/core/worksheet.js +1025 -0
- package/dist/customui/errors.d.ts +15 -0
- package/dist/customui/errors.js +15 -0
- package/dist/customui/index.d.ts +2 -0
- package/dist/customui/index.js +7 -0
- package/dist/customui/ribbon.d.ts +86 -0
- package/dist/customui/ribbon.js +180 -0
- package/dist/entries/core.d.ts +23 -0
- package/dist/entries/core.js +20 -0
- package/dist/entries/csv.d.ts +2 -0
- package/dist/entries/csv.js +6 -0
- package/dist/entries/customui.d.ts +1 -0
- package/dist/entries/customui.js +3 -0
- package/dist/entries/errors.d.ts +7 -0
- package/dist/entries/errors.js +20 -0
- package/dist/entries/vba.d.ts +2 -0
- package/dist/entries/vba.js +7 -0
- package/dist/entries/xlsb.d.ts +1 -0
- package/dist/entries/xlsb.js +7 -0
- package/dist/entries/xlsx.d.ts +5 -0
- package/dist/entries/xlsx.js +18 -0
- package/dist/errors.d.ts +65 -0
- package/dist/errors.js +66 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +19 -0
- package/dist/io/csv/read.d.ts +15 -0
- package/dist/io/csv/read.js +113 -0
- package/dist/io/csv/write.d.ts +28 -0
- package/dist/io/csv/write.js +124 -0
- package/dist/io/opc/errors.d.ts +46 -0
- package/dist/io/opc/errors.js +49 -0
- package/dist/io/opc/inflate.d.ts +15 -0
- package/dist/io/opc/inflate.js +91 -0
- package/dist/io/opc/namespaces.d.ts +18 -0
- package/dist/io/opc/namespaces.js +18 -0
- package/dist/io/opc/part-paths.d.ts +4 -0
- package/dist/io/opc/part-paths.js +35 -0
- package/dist/io/opc/read-opc.d.ts +24 -0
- package/dist/io/opc/read-opc.js +153 -0
- package/dist/io/opc/read-options.d.ts +10 -0
- package/dist/io/opc/read-options.js +7 -0
- package/dist/io/opc/rels.d.ts +15 -0
- package/dist/io/opc/rels.js +28 -0
- package/dist/io/opc/sniff-format.d.ts +27 -0
- package/dist/io/opc/sniff-format.js +92 -0
- package/dist/io/style/xf-style.d.ts +47 -0
- package/dist/io/style/xf-style.js +95 -0
- package/dist/io/xlsb/errors.d.ts +15 -0
- package/dist/io/xlsb/errors.js +15 -0
- package/dist/io/xlsb/formula.d.ts +48 -0
- package/dist/io/xlsb/formula.js +398 -0
- package/dist/io/xlsb/primitives.d.ts +86 -0
- package/dist/io/xlsb/primitives.js +230 -0
- package/dist/io/xlsb/ptg-functions.d.ts +16 -0
- package/dist/io/xlsb/ptg-functions.js +659 -0
- package/dist/io/xlsb/read-shared-strings.d.ts +2 -0
- package/dist/io/xlsb/read-shared-strings.js +22 -0
- package/dist/io/xlsb/read-styles.d.ts +4 -0
- package/dist/io/xlsb/read-styles.js +386 -0
- package/dist/io/xlsb/read-worksheet.d.ts +9 -0
- package/dist/io/xlsb/read-worksheet.js +301 -0
- package/dist/io/xlsb/read.d.ts +20 -0
- package/dist/io/xlsb/read.js +199 -0
- package/dist/io/xlsb/record-stream.d.ts +14 -0
- package/dist/io/xlsb/record-stream.js +56 -0
- package/dist/io/xlsb/record-types.d.ts +55 -0
- package/dist/io/xlsb/record-types.js +73 -0
- package/dist/io/xlsx/cell-accumulator.d.ts +25 -0
- package/dist/io/xlsx/cell-accumulator.js +172 -0
- package/dist/io/xlsx/cell-value.d.ts +32 -0
- package/dist/io/xlsx/cell-value.js +85 -0
- package/dist/io/xlsx/comments.d.ts +74 -0
- package/dist/io/xlsx/comments.js +243 -0
- package/dist/io/xlsx/conditional-formatting.d.ts +32 -0
- package/dist/io/xlsx/conditional-formatting.js +464 -0
- package/dist/io/xlsx/data-validation.d.ts +20 -0
- package/dist/io/xlsx/data-validation.js +258 -0
- package/dist/io/xlsx/edit-vba.d.ts +23 -0
- package/dist/io/xlsx/edit-vba.js +139 -0
- package/dist/io/xlsx/errors.d.ts +17 -0
- package/dist/io/xlsx/errors.js +17 -0
- package/dist/io/xlsx/hyperlinks.d.ts +42 -0
- package/dist/io/xlsx/hyperlinks.js +139 -0
- package/dist/io/xlsx/images.d.ts +34 -0
- package/dist/io/xlsx/images.js +218 -0
- package/dist/io/xlsx/namespaces.d.ts +55 -0
- package/dist/io/xlsx/namespaces.js +55 -0
- package/dist/io/xlsx/package-plan.d.ts +103 -0
- package/dist/io/xlsx/package-plan.js +168 -0
- package/dist/io/xlsx/pivot-read.d.ts +5 -0
- package/dist/io/xlsx/pivot-read.js +134 -0
- package/dist/io/xlsx/pivot.d.ts +12 -0
- package/dist/io/xlsx/pivot.js +141 -0
- package/dist/io/xlsx/read-rows.d.ts +85 -0
- package/dist/io/xlsx/read-rows.js +286 -0
- package/dist/io/xlsx/read-styles.d.ts +8 -0
- package/dist/io/xlsx/read-styles.js +551 -0
- package/dist/io/xlsx/read-worksheet.d.ts +4 -0
- package/dist/io/xlsx/read-worksheet.js +528 -0
- package/dist/io/xlsx/read.d.ts +32 -0
- package/dist/io/xlsx/read.js +680 -0
- package/dist/io/xlsx/relationships.d.ts +33 -0
- package/dist/io/xlsx/relationships.js +47 -0
- package/dist/io/xlsx/rich-runs.d.ts +13 -0
- package/dist/io/xlsx/rich-runs.js +59 -0
- package/dist/io/xlsx/rich-text.d.ts +7 -0
- package/dist/io/xlsx/rich-text.js +23 -0
- package/dist/io/xlsx/shared-formulas.d.ts +6 -0
- package/dist/io/xlsx/shared-formulas.js +52 -0
- package/dist/io/xlsx/shared-strings-read.d.ts +2 -0
- package/dist/io/xlsx/shared-strings-read.js +70 -0
- package/dist/io/xlsx/shared-strings.d.ts +17 -0
- package/dist/io/xlsx/shared-strings.js +50 -0
- package/dist/io/xlsx/sheet-properties.d.ts +13 -0
- package/dist/io/xlsx/sheet-properties.js +211 -0
- package/dist/io/xlsx/styles.d.ts +138 -0
- package/dist/io/xlsx/styles.js +821 -0
- package/dist/io/xlsx/tables.d.ts +9 -0
- package/dist/io/xlsx/tables.js +208 -0
- package/dist/io/xlsx/threaded-comments.d.ts +102 -0
- package/dist/io/xlsx/threaded-comments.js +308 -0
- package/dist/io/xlsx/workbook-xml.d.ts +12 -0
- package/dist/io/xlsx/workbook-xml.js +353 -0
- package/dist/io/xlsx/worksheet-xml.d.ts +86 -0
- package/dist/io/xlsx/worksheet-xml.js +643 -0
- package/dist/io/xlsx/write-stream.d.ts +171 -0
- package/dist/io/xlsx/write-stream.js +399 -0
- package/dist/io/xlsx/write.d.ts +81 -0
- package/dist/io/xlsx/write.js +396 -0
- package/dist/io/xlsx/x14-ext.d.ts +9 -0
- package/dist/io/xlsx/x14-ext.js +12 -0
- package/dist/vba/cfb-writer.d.ts +19 -0
- package/dist/vba/cfb-writer.js +277 -0
- package/dist/vba/cfb.d.ts +16 -0
- package/dist/vba/cfb.js +324 -0
- package/dist/vba/codepage.d.ts +18 -0
- package/dist/vba/codepage.js +87 -0
- package/dist/vba/errors.d.ts +24 -0
- package/dist/vba/errors.js +24 -0
- package/dist/vba/index.d.ts +5 -0
- package/dist/vba/index.js +15 -0
- package/dist/vba/ms-ovba.d.ts +12 -0
- package/dist/vba/ms-ovba.js +176 -0
- package/dist/vba/project-editor.d.ts +62 -0
- package/dist/vba/project-editor.js +377 -0
- package/dist/vba/project.d.ts +45 -0
- package/dist/vba/project.js +160 -0
- package/dist/vba/vba-encoding.d.ts +14 -0
- package/dist/vba/vba-encoding.js +39 -0
- package/dist/xml/errors.d.ts +15 -0
- package/dist/xml/errors.js +15 -0
- package/dist/xml/xml-read.d.ts +107 -0
- package/dist/xml/xml-read.js +283 -0
- package/dist/xml/xml.d.ts +41 -0
- package/dist/xml/xml.js +86 -0
- package/package.json +117 -0
|
@@ -0,0 +1,659 @@
|
|
|
1
|
+
// The `Ftab` built-in function table ([MS-XLS] 2.5.198.17, shared verbatim by BIFF12): the index a
|
|
2
|
+
// `PtgFunc`/`PtgFuncVar` token carries, mapped to the function name that index means.
|
|
3
|
+
//
|
|
4
|
+
// A binary formula names no function — it cites one by number — so this table is the whole difference
|
|
5
|
+
// between `SUM(A1:A5)` and an unreadable stream. It is transcribed from the normative table rather
|
|
6
|
+
// than assembled from Excel's UI, which matters at both ends: the low indices include the XLM macro
|
|
7
|
+
// functions (`GOTO`, `ADD.BAR`, …) that no modern sheet uses but a legacy file may still carry, and
|
|
8
|
+
// the table simply stops at `RTD`. Everything Microsoft added after that — the whole modern library,
|
|
9
|
+
// `TEXTJOIN` through `LAMBDA` — is *not* here and never will be: a post-2007 function is called
|
|
10
|
+
// through index 255 ("user defined") with an `_xlfn.`-prefixed name as its first operand, which is
|
|
11
|
+
// the same indirection the XML form spells out in the function name itself.
|
|
12
|
+
//
|
|
13
|
+
// The four gaps (0x00CA–CB, 0x00D9–DA, 0x00F9–FA, 0x014D) are gaps in the specification: those
|
|
14
|
+
// indices name no function, so a formula citing one is not decodable rather than decodable as
|
|
15
|
+
// something adjacent.
|
|
16
|
+
/** The index [MS-XLS] reserves for a call whose name is given by the token stream's first operand. */
|
|
17
|
+
export const FTAB_USER_DEFINED = 0x00ff;
|
|
18
|
+
/** Look up a built-in function name by its `iftab` index, or `undefined` if the index names none. */
|
|
19
|
+
export function functionNameFor(index) {
|
|
20
|
+
return FTAB[index];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* How many arguments a fixed-arity function takes, or `undefined` for one whose argument count varies.
|
|
24
|
+
*
|
|
25
|
+
* A `PtgFunc` token states only *which* function is called, never with how many arguments — it is the
|
|
26
|
+
* token Excel emits precisely because the count is implied by the function. So decoding `ROUND(A1,2)`
|
|
27
|
+
* back from its two operands and one call token is impossible without this: the arity is the only
|
|
28
|
+
* thing that says which operands on the stack belong to the call. (`PtgFuncVar` carries its own count
|
|
29
|
+
* and needs none of this; the two token forms partition the table between them.)
|
|
30
|
+
*
|
|
31
|
+
* Transcribed from the parameter grammar each function's [MS-XLS] 2.5.198.17 entry states.
|
|
32
|
+
*/
|
|
33
|
+
export function fixedArityFor(name) {
|
|
34
|
+
return FIXED_ARITY.get(name);
|
|
35
|
+
}
|
|
36
|
+
// Keyed by name rather than index: an arity belongs to the function, and a name is checkable at a
|
|
37
|
+
// glance where a hex index is not.
|
|
38
|
+
const FIXED_ARITY = new Map(Object.entries({
|
|
39
|
+
// "This function takes no parameters."
|
|
40
|
+
NA: 0,
|
|
41
|
+
PI: 0,
|
|
42
|
+
TRUE: 0,
|
|
43
|
+
FALSE: 0,
|
|
44
|
+
RAND: 0,
|
|
45
|
+
NOW: 0,
|
|
46
|
+
TODAY: 0,
|
|
47
|
+
STEP: 0,
|
|
48
|
+
CALLER: 0,
|
|
49
|
+
'ACTIVE.CELL': 0,
|
|
50
|
+
SELECTION: 0,
|
|
51
|
+
BREAK: 0,
|
|
52
|
+
NEXT: 0,
|
|
53
|
+
ELSE: 0,
|
|
54
|
+
'END.IF': 0,
|
|
55
|
+
'LAST.ERROR': 0,
|
|
56
|
+
GROUP: 0,
|
|
57
|
+
ABS: 1,
|
|
58
|
+
ACOS: 1,
|
|
59
|
+
ACOSH: 1,
|
|
60
|
+
AREAS: 1,
|
|
61
|
+
ASC: 1,
|
|
62
|
+
ASIN: 1,
|
|
63
|
+
ASINH: 1,
|
|
64
|
+
ATAN: 1,
|
|
65
|
+
ATANH: 1,
|
|
66
|
+
BAHTTEXT: 1,
|
|
67
|
+
CHAR: 1,
|
|
68
|
+
CLEAN: 1,
|
|
69
|
+
CODE: 1,
|
|
70
|
+
COLUMNS: 1,
|
|
71
|
+
COS: 1,
|
|
72
|
+
COSH: 1,
|
|
73
|
+
COUNTBLANK: 1,
|
|
74
|
+
DATESTRING: 1,
|
|
75
|
+
DATEVALUE: 1,
|
|
76
|
+
DAY: 1,
|
|
77
|
+
DBCS: 1,
|
|
78
|
+
'DELETE.BAR': 1,
|
|
79
|
+
'DELETE.TOOLBAR': 1,
|
|
80
|
+
DEGREES: 1,
|
|
81
|
+
DEREF: 1,
|
|
82
|
+
'DIALOG.BOX': 1,
|
|
83
|
+
'ELSE.IF': 1,
|
|
84
|
+
'ERROR.TYPE': 1,
|
|
85
|
+
EVALUATE: 1,
|
|
86
|
+
EVEN: 1,
|
|
87
|
+
EXP: 1,
|
|
88
|
+
FACT: 1,
|
|
89
|
+
FCLOSE: 1,
|
|
90
|
+
FISHER: 1,
|
|
91
|
+
FISHERINV: 1,
|
|
92
|
+
FREADLN: 1,
|
|
93
|
+
FSIZE: 1,
|
|
94
|
+
GAMMALN: 1,
|
|
95
|
+
'GET.FORMULA': 1,
|
|
96
|
+
'GET.WORKSPACE': 1,
|
|
97
|
+
GOTO: 1,
|
|
98
|
+
HOUR: 1,
|
|
99
|
+
INFO: 1,
|
|
100
|
+
INT: 1,
|
|
101
|
+
ISBLANK: 1,
|
|
102
|
+
ISERR: 1,
|
|
103
|
+
ISERROR: 1,
|
|
104
|
+
ISLOGICAL: 1,
|
|
105
|
+
ISNA: 1,
|
|
106
|
+
ISNONTEXT: 1,
|
|
107
|
+
ISNUMBER: 1,
|
|
108
|
+
ISREF: 1,
|
|
109
|
+
ISTEXT: 1,
|
|
110
|
+
ISTHAIDIGIT: 1,
|
|
111
|
+
LEN: 1,
|
|
112
|
+
LENB: 1,
|
|
113
|
+
LN: 1,
|
|
114
|
+
LOG10: 1,
|
|
115
|
+
LOWER: 1,
|
|
116
|
+
MDETERM: 1,
|
|
117
|
+
MINUTE: 1,
|
|
118
|
+
MINVERSE: 1,
|
|
119
|
+
MONTH: 1,
|
|
120
|
+
N: 1,
|
|
121
|
+
NORMSDIST: 1,
|
|
122
|
+
NORMSINV: 1,
|
|
123
|
+
NOT: 1,
|
|
124
|
+
ODD: 1,
|
|
125
|
+
'OPTIONS.LISTS.GET': 1,
|
|
126
|
+
PHONETIC: 1,
|
|
127
|
+
PROPER: 1,
|
|
128
|
+
RADIANS: 1,
|
|
129
|
+
'RESET.TOOLBAR': 1,
|
|
130
|
+
ROUNDBAHTDOWN: 1,
|
|
131
|
+
ROUNDBAHTUP: 1,
|
|
132
|
+
ROWS: 1,
|
|
133
|
+
SECOND: 1,
|
|
134
|
+
SIGN: 1,
|
|
135
|
+
SIN: 1,
|
|
136
|
+
SINH: 1,
|
|
137
|
+
SQRT: 1,
|
|
138
|
+
T: 1,
|
|
139
|
+
TAN: 1,
|
|
140
|
+
TANH: 1,
|
|
141
|
+
TERMINATE: 1,
|
|
142
|
+
THAIDAYOFWEEK: 1,
|
|
143
|
+
THAIDIGIT: 1,
|
|
144
|
+
THAIMONTHOFYEAR: 1,
|
|
145
|
+
THAINUMSOUND: 1,
|
|
146
|
+
THAINUMSTRING: 1,
|
|
147
|
+
THAISTRINGLENGTH: 1,
|
|
148
|
+
THAIYEAR: 1,
|
|
149
|
+
TIMEVALUE: 1,
|
|
150
|
+
TRANSPOSE: 1,
|
|
151
|
+
TRIM: 1,
|
|
152
|
+
TYPE: 1,
|
|
153
|
+
UNREGISTER: 1,
|
|
154
|
+
UPPER: 1,
|
|
155
|
+
VALUE: 1,
|
|
156
|
+
WHILE: 1,
|
|
157
|
+
YEAR: 1,
|
|
158
|
+
ABSREF: 2,
|
|
159
|
+
ATAN2: 2,
|
|
160
|
+
CEILING: 2,
|
|
161
|
+
CHIDIST: 2,
|
|
162
|
+
CHIINV: 2,
|
|
163
|
+
CHITEST: 2,
|
|
164
|
+
COMBIN: 2,
|
|
165
|
+
CORREL: 2,
|
|
166
|
+
COUNTIF: 2,
|
|
167
|
+
COVAR: 2,
|
|
168
|
+
EXACT: 2,
|
|
169
|
+
FLOOR: 2,
|
|
170
|
+
FREAD: 2,
|
|
171
|
+
FREQUENCY: 2,
|
|
172
|
+
FTEST: 2,
|
|
173
|
+
FWRITE: 2,
|
|
174
|
+
FWRITELN: 2,
|
|
175
|
+
INITIATE: 2,
|
|
176
|
+
INTERCEPT: 2,
|
|
177
|
+
LARGE: 2,
|
|
178
|
+
MMULT: 2,
|
|
179
|
+
MOD: 2,
|
|
180
|
+
NUMBERSTRING: 2,
|
|
181
|
+
PEARSON: 2,
|
|
182
|
+
PERCENTILE: 2,
|
|
183
|
+
PERMUT: 2,
|
|
184
|
+
POWER: 2,
|
|
185
|
+
QUARTILE: 2,
|
|
186
|
+
RELREF: 2,
|
|
187
|
+
REPT: 2,
|
|
188
|
+
REQUEST: 2,
|
|
189
|
+
ROUND: 2,
|
|
190
|
+
ROUNDDOWN: 2,
|
|
191
|
+
ROUNDUP: 2,
|
|
192
|
+
RSQ: 2,
|
|
193
|
+
'SET.VALUE': 2,
|
|
194
|
+
SLOPE: 2,
|
|
195
|
+
SMALL: 2,
|
|
196
|
+
STEYX: 2,
|
|
197
|
+
SUMX2MY2: 2,
|
|
198
|
+
SUMX2PY2: 2,
|
|
199
|
+
SUMXMY2: 2,
|
|
200
|
+
TEXT: 2,
|
|
201
|
+
TINV: 2,
|
|
202
|
+
TRIMMEAN: 2,
|
|
203
|
+
EXECUTE: 2,
|
|
204
|
+
CONFIDENCE: 3,
|
|
205
|
+
CRITBINOM: 3,
|
|
206
|
+
DATE: 3,
|
|
207
|
+
DATEDIF: 3,
|
|
208
|
+
DAVERAGE: 3,
|
|
209
|
+
DCOUNT: 3,
|
|
210
|
+
DCOUNTA: 3,
|
|
211
|
+
DGET: 3,
|
|
212
|
+
DMAX: 3,
|
|
213
|
+
DMIN: 3,
|
|
214
|
+
DPRODUCT: 3,
|
|
215
|
+
DSTDEV: 3,
|
|
216
|
+
DSTDEVP: 3,
|
|
217
|
+
DSUM: 3,
|
|
218
|
+
DVAR: 3,
|
|
219
|
+
DVARP: 3,
|
|
220
|
+
'ENABLE.TOOL': 3,
|
|
221
|
+
EXPONDIST: 3,
|
|
222
|
+
FDIST: 3,
|
|
223
|
+
FINV: 3,
|
|
224
|
+
FORECAST: 3,
|
|
225
|
+
GAMMAINV: 3,
|
|
226
|
+
LOGINV: 3,
|
|
227
|
+
LOGNORMDIST: 3,
|
|
228
|
+
MID: 3,
|
|
229
|
+
MIDB: 3,
|
|
230
|
+
MIRR: 3,
|
|
231
|
+
NEGBINOMDIST: 3,
|
|
232
|
+
NORMINV: 3,
|
|
233
|
+
POISSON: 3,
|
|
234
|
+
POKE: 3,
|
|
235
|
+
'PRESS.TOOL': 3,
|
|
236
|
+
SLN: 3,
|
|
237
|
+
STANDARDIZE: 3,
|
|
238
|
+
TDIST: 3,
|
|
239
|
+
TIME: 3,
|
|
240
|
+
BINOMDIST: 4,
|
|
241
|
+
GAMMADIST: 4,
|
|
242
|
+
HYPGEOMDIST: 4,
|
|
243
|
+
ISPMT: 4,
|
|
244
|
+
NORMDIST: 4,
|
|
245
|
+
REPLACE: 4,
|
|
246
|
+
REPLACEB: 4,
|
|
247
|
+
SYD: 4,
|
|
248
|
+
TTEST: 4,
|
|
249
|
+
WEIBULL: 4,
|
|
250
|
+
}));
|
|
251
|
+
// The table as contiguous runs, each `[first index, names in order]`. Written this way so the four
|
|
252
|
+
// specification gaps are visible as run boundaries instead of hiding as miscounted array entries.
|
|
253
|
+
const RUNS = [
|
|
254
|
+
[
|
|
255
|
+
0x0000,
|
|
256
|
+
[
|
|
257
|
+
'COUNT',
|
|
258
|
+
'IF',
|
|
259
|
+
'ISNA',
|
|
260
|
+
'ISERROR',
|
|
261
|
+
'SUM',
|
|
262
|
+
'AVERAGE',
|
|
263
|
+
'MIN',
|
|
264
|
+
'MAX',
|
|
265
|
+
'ROW',
|
|
266
|
+
'COLUMN',
|
|
267
|
+
'NA',
|
|
268
|
+
'NPV',
|
|
269
|
+
'STDEV',
|
|
270
|
+
'DOLLAR',
|
|
271
|
+
'FIXED',
|
|
272
|
+
'SIN',
|
|
273
|
+
'COS',
|
|
274
|
+
'TAN',
|
|
275
|
+
'ATAN',
|
|
276
|
+
'PI',
|
|
277
|
+
'SQRT',
|
|
278
|
+
'EXP',
|
|
279
|
+
'LN',
|
|
280
|
+
'LOG10',
|
|
281
|
+
'ABS',
|
|
282
|
+
'INT',
|
|
283
|
+
'SIGN',
|
|
284
|
+
'ROUND',
|
|
285
|
+
'LOOKUP',
|
|
286
|
+
'INDEX',
|
|
287
|
+
'REPT',
|
|
288
|
+
'MID',
|
|
289
|
+
'LEN',
|
|
290
|
+
'VALUE',
|
|
291
|
+
'TRUE',
|
|
292
|
+
'FALSE',
|
|
293
|
+
'AND',
|
|
294
|
+
'OR',
|
|
295
|
+
'NOT',
|
|
296
|
+
'MOD',
|
|
297
|
+
'DCOUNT',
|
|
298
|
+
'DSUM',
|
|
299
|
+
'DAVERAGE',
|
|
300
|
+
'DMIN',
|
|
301
|
+
'DMAX',
|
|
302
|
+
'DSTDEV',
|
|
303
|
+
'VAR',
|
|
304
|
+
'DVAR',
|
|
305
|
+
'TEXT',
|
|
306
|
+
'LINEST',
|
|
307
|
+
'TREND',
|
|
308
|
+
'LOGEST',
|
|
309
|
+
'GROWTH',
|
|
310
|
+
'GOTO',
|
|
311
|
+
'HALT',
|
|
312
|
+
'RETURN',
|
|
313
|
+
'PV',
|
|
314
|
+
'FV',
|
|
315
|
+
'NPER',
|
|
316
|
+
'PMT',
|
|
317
|
+
'RATE',
|
|
318
|
+
'MIRR',
|
|
319
|
+
'IRR',
|
|
320
|
+
'RAND',
|
|
321
|
+
'MATCH',
|
|
322
|
+
'DATE',
|
|
323
|
+
'TIME',
|
|
324
|
+
'DAY',
|
|
325
|
+
'MONTH',
|
|
326
|
+
'YEAR',
|
|
327
|
+
'WEEKDAY',
|
|
328
|
+
'HOUR',
|
|
329
|
+
'MINUTE',
|
|
330
|
+
'SECOND',
|
|
331
|
+
'NOW',
|
|
332
|
+
'AREAS',
|
|
333
|
+
'ROWS',
|
|
334
|
+
'COLUMNS',
|
|
335
|
+
'OFFSET',
|
|
336
|
+
'ABSREF',
|
|
337
|
+
'RELREF',
|
|
338
|
+
'ARGUMENT',
|
|
339
|
+
'SEARCH',
|
|
340
|
+
'TRANSPOSE',
|
|
341
|
+
'ERROR',
|
|
342
|
+
'STEP',
|
|
343
|
+
'TYPE',
|
|
344
|
+
'ECHO',
|
|
345
|
+
'SET.NAME',
|
|
346
|
+
'CALLER',
|
|
347
|
+
'DEREF',
|
|
348
|
+
'WINDOWS',
|
|
349
|
+
'SERIES',
|
|
350
|
+
'DOCUMENTS',
|
|
351
|
+
'ACTIVE.CELL',
|
|
352
|
+
'SELECTION',
|
|
353
|
+
'RESULT',
|
|
354
|
+
'ATAN2',
|
|
355
|
+
'ASIN',
|
|
356
|
+
'ACOS',
|
|
357
|
+
'CHOOSE',
|
|
358
|
+
'HLOOKUP',
|
|
359
|
+
'VLOOKUP',
|
|
360
|
+
'LINKS',
|
|
361
|
+
'INPUT',
|
|
362
|
+
'ISREF',
|
|
363
|
+
'GET.FORMULA',
|
|
364
|
+
'GET.NAME',
|
|
365
|
+
'SET.VALUE',
|
|
366
|
+
'LOG',
|
|
367
|
+
'EXEC',
|
|
368
|
+
'CHAR',
|
|
369
|
+
'LOWER',
|
|
370
|
+
'UPPER',
|
|
371
|
+
'PROPER',
|
|
372
|
+
'LEFT',
|
|
373
|
+
'RIGHT',
|
|
374
|
+
'EXACT',
|
|
375
|
+
'TRIM',
|
|
376
|
+
'REPLACE',
|
|
377
|
+
'SUBSTITUTE',
|
|
378
|
+
'CODE',
|
|
379
|
+
'NAMES',
|
|
380
|
+
'DIRECTORY',
|
|
381
|
+
'FIND',
|
|
382
|
+
'CELL',
|
|
383
|
+
'ISERR',
|
|
384
|
+
'ISTEXT',
|
|
385
|
+
'ISNUMBER',
|
|
386
|
+
'ISBLANK',
|
|
387
|
+
'T',
|
|
388
|
+
'N',
|
|
389
|
+
'FOPEN',
|
|
390
|
+
'FCLOSE',
|
|
391
|
+
'FSIZE',
|
|
392
|
+
'FREADLN',
|
|
393
|
+
'FREAD',
|
|
394
|
+
'FWRITELN',
|
|
395
|
+
'FWRITE',
|
|
396
|
+
'FPOS',
|
|
397
|
+
'DATEVALUE',
|
|
398
|
+
'TIMEVALUE',
|
|
399
|
+
'SLN',
|
|
400
|
+
'SYD',
|
|
401
|
+
'DDB',
|
|
402
|
+
'GET.DEF',
|
|
403
|
+
'REFTEXT',
|
|
404
|
+
'TEXTREF',
|
|
405
|
+
'INDIRECT',
|
|
406
|
+
'REGISTER',
|
|
407
|
+
'CALL',
|
|
408
|
+
'ADD.BAR',
|
|
409
|
+
'ADD.MENU',
|
|
410
|
+
'ADD.COMMAND',
|
|
411
|
+
'ENABLE.COMMAND',
|
|
412
|
+
'CHECK.COMMAND',
|
|
413
|
+
'RENAME.COMMAND',
|
|
414
|
+
'SHOW.BAR',
|
|
415
|
+
'DELETE.MENU',
|
|
416
|
+
'DELETE.COMMAND',
|
|
417
|
+
'GET.CHART.ITEM',
|
|
418
|
+
'DIALOG.BOX',
|
|
419
|
+
'CLEAN',
|
|
420
|
+
'MDETERM',
|
|
421
|
+
'MINVERSE',
|
|
422
|
+
'MMULT',
|
|
423
|
+
'FILES',
|
|
424
|
+
'IPMT',
|
|
425
|
+
'PPMT',
|
|
426
|
+
'COUNTA',
|
|
427
|
+
'CANCEL.KEY',
|
|
428
|
+
'FOR',
|
|
429
|
+
'WHILE',
|
|
430
|
+
'BREAK',
|
|
431
|
+
'NEXT',
|
|
432
|
+
'INITIATE',
|
|
433
|
+
'REQUEST',
|
|
434
|
+
'POKE',
|
|
435
|
+
'EXECUTE',
|
|
436
|
+
'TERMINATE',
|
|
437
|
+
'RESTART',
|
|
438
|
+
'HELP',
|
|
439
|
+
'GET.BAR',
|
|
440
|
+
'PRODUCT',
|
|
441
|
+
'FACT',
|
|
442
|
+
'GET.CELL',
|
|
443
|
+
'GET.WORKSPACE',
|
|
444
|
+
'GET.WINDOW',
|
|
445
|
+
'GET.DOCUMENT',
|
|
446
|
+
'DPRODUCT',
|
|
447
|
+
'ISNONTEXT',
|
|
448
|
+
'GET.NOTE',
|
|
449
|
+
'NOTE',
|
|
450
|
+
'STDEVP',
|
|
451
|
+
'VARP',
|
|
452
|
+
'DSTDEVP',
|
|
453
|
+
'DVARP',
|
|
454
|
+
'TRUNC',
|
|
455
|
+
'ISLOGICAL',
|
|
456
|
+
'DCOUNTA',
|
|
457
|
+
'DELETE.BAR',
|
|
458
|
+
'UNREGISTER',
|
|
459
|
+
],
|
|
460
|
+
],
|
|
461
|
+
[
|
|
462
|
+
0x00cc,
|
|
463
|
+
[
|
|
464
|
+
'USDOLLAR',
|
|
465
|
+
'FINDB',
|
|
466
|
+
'SEARCHB',
|
|
467
|
+
'REPLACEB',
|
|
468
|
+
'LEFTB',
|
|
469
|
+
'RIGHTB',
|
|
470
|
+
'MIDB',
|
|
471
|
+
'LENB',
|
|
472
|
+
'ROUNDUP',
|
|
473
|
+
'ROUNDDOWN',
|
|
474
|
+
'ASC',
|
|
475
|
+
'DBCS',
|
|
476
|
+
'RANK',
|
|
477
|
+
],
|
|
478
|
+
],
|
|
479
|
+
[
|
|
480
|
+
0x00db,
|
|
481
|
+
[
|
|
482
|
+
'ADDRESS',
|
|
483
|
+
'DAYS360',
|
|
484
|
+
'TODAY',
|
|
485
|
+
'VDB',
|
|
486
|
+
'ELSE',
|
|
487
|
+
'ELSE.IF',
|
|
488
|
+
'END.IF',
|
|
489
|
+
'FOR.CELL',
|
|
490
|
+
'MEDIAN',
|
|
491
|
+
'SUMPRODUCT',
|
|
492
|
+
'SINH',
|
|
493
|
+
'COSH',
|
|
494
|
+
'TANH',
|
|
495
|
+
'ASINH',
|
|
496
|
+
'ACOSH',
|
|
497
|
+
'ATANH',
|
|
498
|
+
'DGET',
|
|
499
|
+
'CREATE.OBJECT',
|
|
500
|
+
'VOLATILE',
|
|
501
|
+
'LAST.ERROR',
|
|
502
|
+
'CUSTOM.UNDO',
|
|
503
|
+
'CUSTOM.REPEAT',
|
|
504
|
+
'FORMULA.CONVERT',
|
|
505
|
+
'GET.LINK.INFO',
|
|
506
|
+
'TEXT.BOX',
|
|
507
|
+
'INFO',
|
|
508
|
+
'GROUP',
|
|
509
|
+
'GET.OBJECT',
|
|
510
|
+
'DB',
|
|
511
|
+
'PAUSE',
|
|
512
|
+
],
|
|
513
|
+
],
|
|
514
|
+
[
|
|
515
|
+
0x00fb,
|
|
516
|
+
[
|
|
517
|
+
'RESUME',
|
|
518
|
+
'FREQUENCY',
|
|
519
|
+
'ADD.TOOLBAR',
|
|
520
|
+
'DELETE.TOOLBAR',
|
|
521
|
+
'User Defined Function',
|
|
522
|
+
'RESET.TOOLBAR',
|
|
523
|
+
'EVALUATE',
|
|
524
|
+
'GET.TOOLBAR',
|
|
525
|
+
'GET.TOOL',
|
|
526
|
+
'SPELLING.CHECK',
|
|
527
|
+
'ERROR.TYPE',
|
|
528
|
+
'APP.TITLE',
|
|
529
|
+
'WINDOW.TITLE',
|
|
530
|
+
'SAVE.TOOLBAR',
|
|
531
|
+
'ENABLE.TOOL',
|
|
532
|
+
'PRESS.TOOL',
|
|
533
|
+
'REGISTER.ID',
|
|
534
|
+
'GET.WORKBOOK',
|
|
535
|
+
'AVEDEV',
|
|
536
|
+
'BETADIST',
|
|
537
|
+
'GAMMALN',
|
|
538
|
+
'BETAINV',
|
|
539
|
+
'BINOMDIST',
|
|
540
|
+
'CHIDIST',
|
|
541
|
+
'CHIINV',
|
|
542
|
+
'COMBIN',
|
|
543
|
+
'CONFIDENCE',
|
|
544
|
+
'CRITBINOM',
|
|
545
|
+
'EVEN',
|
|
546
|
+
'EXPONDIST',
|
|
547
|
+
'FDIST',
|
|
548
|
+
'FINV',
|
|
549
|
+
'FISHER',
|
|
550
|
+
'FISHERINV',
|
|
551
|
+
'FLOOR',
|
|
552
|
+
'GAMMADIST',
|
|
553
|
+
'GAMMAINV',
|
|
554
|
+
'CEILING',
|
|
555
|
+
'HYPGEOMDIST',
|
|
556
|
+
'LOGNORMDIST',
|
|
557
|
+
'LOGINV',
|
|
558
|
+
'NEGBINOMDIST',
|
|
559
|
+
'NORMDIST',
|
|
560
|
+
'NORMSDIST',
|
|
561
|
+
'NORMINV',
|
|
562
|
+
'NORMSINV',
|
|
563
|
+
'STANDARDIZE',
|
|
564
|
+
'ODD',
|
|
565
|
+
'PERMUT',
|
|
566
|
+
'POISSON',
|
|
567
|
+
'TDIST',
|
|
568
|
+
'WEIBULL',
|
|
569
|
+
'SUMXMY2',
|
|
570
|
+
'SUMX2MY2',
|
|
571
|
+
'SUMX2PY2',
|
|
572
|
+
'CHITEST',
|
|
573
|
+
'CORREL',
|
|
574
|
+
'COVAR',
|
|
575
|
+
'FORECAST',
|
|
576
|
+
'FTEST',
|
|
577
|
+
'INTERCEPT',
|
|
578
|
+
'PEARSON',
|
|
579
|
+
'RSQ',
|
|
580
|
+
'STEYX',
|
|
581
|
+
'SLOPE',
|
|
582
|
+
'TTEST',
|
|
583
|
+
'PROB',
|
|
584
|
+
'DEVSQ',
|
|
585
|
+
'GEOMEAN',
|
|
586
|
+
'HARMEAN',
|
|
587
|
+
'SUMSQ',
|
|
588
|
+
'KURT',
|
|
589
|
+
'SKEW',
|
|
590
|
+
'ZTEST',
|
|
591
|
+
'LARGE',
|
|
592
|
+
'SMALL',
|
|
593
|
+
'QUARTILE',
|
|
594
|
+
'PERCENTILE',
|
|
595
|
+
'PERCENTRANK',
|
|
596
|
+
'MODE',
|
|
597
|
+
'TRIMMEAN',
|
|
598
|
+
'TINV',
|
|
599
|
+
],
|
|
600
|
+
],
|
|
601
|
+
[
|
|
602
|
+
0x014e,
|
|
603
|
+
[
|
|
604
|
+
'MOVIE.COMMAND',
|
|
605
|
+
'GET.MOVIE',
|
|
606
|
+
'CONCATENATE',
|
|
607
|
+
'POWER',
|
|
608
|
+
'PIVOT.ADD.DATA',
|
|
609
|
+
'GET.PIVOT.TABLE',
|
|
610
|
+
'GET.PIVOT.FIELD',
|
|
611
|
+
'GET.PIVOT.ITEM',
|
|
612
|
+
'RADIANS',
|
|
613
|
+
'DEGREES',
|
|
614
|
+
'SUBTOTAL',
|
|
615
|
+
'SUMIF',
|
|
616
|
+
'COUNTIF',
|
|
617
|
+
'COUNTBLANK',
|
|
618
|
+
'SCENARIO.GET',
|
|
619
|
+
'OPTIONS.LISTS.GET',
|
|
620
|
+
'ISPMT',
|
|
621
|
+
'DATEDIF',
|
|
622
|
+
'DATESTRING',
|
|
623
|
+
'NUMBERSTRING',
|
|
624
|
+
'ROMAN',
|
|
625
|
+
'OPEN.DIALOG',
|
|
626
|
+
'SAVE.DIALOG',
|
|
627
|
+
'VIEW.GET',
|
|
628
|
+
'GETPIVOTDATA',
|
|
629
|
+
'HYPERLINK',
|
|
630
|
+
'PHONETIC',
|
|
631
|
+
'AVERAGEA',
|
|
632
|
+
'MAXA',
|
|
633
|
+
'MINA',
|
|
634
|
+
'STDEVPA',
|
|
635
|
+
'VARPA',
|
|
636
|
+
'STDEVA',
|
|
637
|
+
'VARA',
|
|
638
|
+
'BAHTTEXT',
|
|
639
|
+
'THAIDAYOFWEEK',
|
|
640
|
+
'THAIDIGIT',
|
|
641
|
+
'THAIMONTHOFYEAR',
|
|
642
|
+
'THAINUMSOUND',
|
|
643
|
+
'THAINUMSTRING',
|
|
644
|
+
'THAISTRINGLENGTH',
|
|
645
|
+
'ISTHAIDIGIT',
|
|
646
|
+
'ROUNDBAHTDOWN',
|
|
647
|
+
'ROUNDBAHTUP',
|
|
648
|
+
'THAIYEAR',
|
|
649
|
+
'RTD',
|
|
650
|
+
],
|
|
651
|
+
],
|
|
652
|
+
];
|
|
653
|
+
// Indexed by `iftab`; a hole is an index the specification does not define.
|
|
654
|
+
const FTAB = RUNS.reduce((table, [start, names]) => {
|
|
655
|
+
names.forEach((name, offset) => {
|
|
656
|
+
table[start + offset] = name;
|
|
657
|
+
});
|
|
658
|
+
return table;
|
|
659
|
+
}, []);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// The BIFF12 shared-string table: `xl/sharedStrings.bin` in, the pool a `BrtCellIsst` cell indexes.
|
|
2
|
+
//
|
|
3
|
+
// The binary table is a flat run of `BrtSSTItem` records between a Begin/End pair, each holding one
|
|
4
|
+
// `RichStr`. Only the text is taken: a pooled string's per-run formatting is not modelled in this cut,
|
|
5
|
+
// so the runs are left unread rather than half-decoded (see `primitives.ts`). Reading stops at the
|
|
6
|
+
// closing record, so trailing future-record blocks are never framed.
|
|
7
|
+
import { RecordReader } from "./primitives.js";
|
|
8
|
+
import { readRecords } from "./record-stream.js";
|
|
9
|
+
import { BRT } from "./record-types.js";
|
|
10
|
+
/** Parse `xl/sharedStrings.bin` into the pool, in index order. An absent part is an empty pool. */
|
|
11
|
+
export function parseSharedStrings(part) {
|
|
12
|
+
if (part === undefined)
|
|
13
|
+
return [];
|
|
14
|
+
const strings = [];
|
|
15
|
+
for (const record of readRecords(part)) {
|
|
16
|
+
if (record.type === BRT.SSTItem)
|
|
17
|
+
strings.push(new RecordReader(record.data).richString());
|
|
18
|
+
else if (record.type === BRT.EndSst)
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
return strings;
|
|
22
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type StyleTable, type XfStyle } from '../style/xf-style.ts';
|
|
2
|
+
/** Parse `xl/styles.bin` into the flat cell-format table a worksheet's style indices resolve against. */
|
|
3
|
+
export declare function parseStyleTable(part: Uint8Array | undefined): StyleTable;
|
|
4
|
+
export type { StyleTable, XfStyle };
|