@lexaxai/spreadsheet-engine 0.0.0-stage → 0.1.0-dryrun.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 +202 -0
- package/index.d.ts +2282 -0
- package/index.js +865 -0
- package/lexax.darwin-arm64.node +0 -0
- package/package.json +24 -4
- package/types/calc.d.ts +260 -0
- package/types/chart.d.ts +479 -0
- package/types/chart_ex.d.ts +379 -0
- package/types/chart_format.d.ts +440 -0
- package/types/chart_series.d.ts +336 -0
- package/types/drawings.d.ts +383 -0
- package/types/files.d.ts +367 -0
- package/types/formats.d.ts +380 -0
- package/types/page.d.ts +352 -0
- package/types/render.d.ts +137 -0
- package/types/sheet.d.ts +432 -0
- package/types/styles.d.ts +383 -0
- package/types/tables.d.ts +420 -0
- package/types/validation.d.ts +151 -0
- package/types/values.d.ts +280 -0
- package/README.md +0 -3
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
// The formatting of a cell, row or column: colours, fonts, fills, borders,
|
|
2
|
+
// alignment, protection, and the named cell styles.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A colour, given as an ARGB hex string such as `FF00FF00` or as an index into the workbook's theme colours.
|
|
6
|
+
* Used by fonts, fills and borders.
|
|
7
|
+
*/
|
|
8
|
+
export interface Color {
|
|
9
|
+
/**
|
|
10
|
+
* Hex string for alpha-red-green-blue for example FF00FF00
|
|
11
|
+
*/
|
|
12
|
+
argb: string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Choose a theme by index
|
|
16
|
+
*/
|
|
17
|
+
theme: number;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* How much lighter (up to 1) or darker (down to -1) than the theme colour or the RGB value.
|
|
21
|
+
*/
|
|
22
|
+
tint?: number;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* An index into the legacy palette of 64 colours, as older files give a colour.
|
|
26
|
+
*/
|
|
27
|
+
indexed?: number;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The automatic colour, which the application chooses.
|
|
31
|
+
*/
|
|
32
|
+
auto?: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* A font of a cell's style: its name, size, style and colour.
|
|
37
|
+
*/
|
|
38
|
+
export interface Font {
|
|
39
|
+
/**
|
|
40
|
+
* The name of the font, such as `Calibri`.
|
|
41
|
+
*/
|
|
42
|
+
name: string;
|
|
43
|
+
/**
|
|
44
|
+
* The size of the font in points.
|
|
45
|
+
*/
|
|
46
|
+
size: number;
|
|
47
|
+
/**
|
|
48
|
+
* The font family class, as the file holds it: a number such as 2 for a sans serif font.
|
|
49
|
+
*/
|
|
50
|
+
family: number;
|
|
51
|
+
/**
|
|
52
|
+
* Whether the font is the theme's body font (`minor`), its heading font (`major`), or set by hand (`none`).
|
|
53
|
+
*/
|
|
54
|
+
scheme: 'minor' | 'major' | 'none';
|
|
55
|
+
/**
|
|
56
|
+
* The character set of the font, as the file holds it, such as 0 for the ANSI set.
|
|
57
|
+
*/
|
|
58
|
+
charset: number;
|
|
59
|
+
/**
|
|
60
|
+
* The colour of the text.
|
|
61
|
+
*/
|
|
62
|
+
color: Partial<Color>;
|
|
63
|
+
/**
|
|
64
|
+
* Whether the text is bold.
|
|
65
|
+
*/
|
|
66
|
+
bold: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Whether the text is italic.
|
|
69
|
+
*/
|
|
70
|
+
italic: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* The underline of the text: `true` or `single` for a single underline, `double`, `singleAccounting` or
|
|
73
|
+
* `doubleAccounting` for the others, and `none` or `false` for no underline.
|
|
74
|
+
*/
|
|
75
|
+
underline: boolean | 'none' | 'single' | 'double' | 'singleAccounting' | 'doubleAccounting';
|
|
76
|
+
/**
|
|
77
|
+
* Whether the text is a `superscript` or a `subscript`, or neither when the property is absent.
|
|
78
|
+
*/
|
|
79
|
+
vertAlign: 'superscript' | 'subscript';
|
|
80
|
+
/**
|
|
81
|
+
* Whether the text has a line through it.
|
|
82
|
+
*/
|
|
83
|
+
strike: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Whether the text is drawn as an outline.
|
|
86
|
+
*/
|
|
87
|
+
outline: boolean;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* The pattern styles a fill can take, as Format Cells lists them: `none` and `solid`, then the hatch and grey
|
|
92
|
+
* patterns.
|
|
93
|
+
*/
|
|
94
|
+
export type FillPatterns =
|
|
95
|
+
| 'none' | 'solid'
|
|
96
|
+
| 'darkVertical' | 'darkHorizontal' | 'darkGrid' | 'darkTrellis' | 'darkDown' | 'darkUp'
|
|
97
|
+
| 'lightVertical' | 'lightHorizontal' | 'lightGrid' | 'lightTrellis' | 'lightDown' | 'lightUp'
|
|
98
|
+
| 'darkGray' | 'mediumGray' | 'lightGray' | 'gray125' | 'gray0625';
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* A fill of a cell with a solid colour or a pattern. Used by `Fill`.
|
|
102
|
+
*/
|
|
103
|
+
export interface FillPattern {
|
|
104
|
+
/**
|
|
105
|
+
* The type of fill, always `pattern` for this fill.
|
|
106
|
+
*/
|
|
107
|
+
type: 'pattern';
|
|
108
|
+
/**
|
|
109
|
+
* The pattern: `none`, `solid` for a solid colour, or one of the hatch and grey patterns, such as
|
|
110
|
+
* `darkGrid`.
|
|
111
|
+
*/
|
|
112
|
+
pattern: FillPatterns;
|
|
113
|
+
/**
|
|
114
|
+
* The colour of the pattern's foreground. For a solid fill, this is the fill's colour.
|
|
115
|
+
*/
|
|
116
|
+
fgColor?: Partial<Color>;
|
|
117
|
+
/**
|
|
118
|
+
* The colour of the pattern's background.
|
|
119
|
+
*/
|
|
120
|
+
bgColor?: Partial<Color>;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* A colour at a position along a gradient. Used by `FillGradientAngle` and `FillGradientPath`.
|
|
125
|
+
*/
|
|
126
|
+
export interface GradientStop {
|
|
127
|
+
/**
|
|
128
|
+
* The position of the colour along the gradient, from 0 for the first colour to 1 for the last.
|
|
129
|
+
*/
|
|
130
|
+
position: number;
|
|
131
|
+
/**
|
|
132
|
+
* The colour at the position.
|
|
133
|
+
*/
|
|
134
|
+
color: Partial<Color>;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* A gradient fill that runs in a straight line across the cell at an angle. Used by `Fill`.
|
|
139
|
+
*/
|
|
140
|
+
export interface FillGradientAngle {
|
|
141
|
+
/**
|
|
142
|
+
* The type of fill, always `gradient` for this fill.
|
|
143
|
+
*/
|
|
144
|
+
type: 'gradient';
|
|
145
|
+
/**
|
|
146
|
+
* The type of gradient, always `angle` for this fill.
|
|
147
|
+
*/
|
|
148
|
+
gradient: 'angle';
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* For 'angle' gradient, specifies the direction of the gradient. 0 is from the left to the right.
|
|
152
|
+
* Values from 1 - 359 rotates the direction clockwise
|
|
153
|
+
*/
|
|
154
|
+
degree: number;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Specifies the gradient colour sequence. Is an array of objects containing position and
|
|
158
|
+
* color starting with position 0 and ending with position 1.
|
|
159
|
+
* Intermediary positions may be used to specify other colours on the path.
|
|
160
|
+
*/
|
|
161
|
+
stops: GradientStop[];
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* A gradient fill that radiates from a point in the cell. Used by `Fill`.
|
|
166
|
+
*/
|
|
167
|
+
export interface FillGradientPath {
|
|
168
|
+
/**
|
|
169
|
+
* The type of fill, always `gradient` for this fill.
|
|
170
|
+
*/
|
|
171
|
+
type: 'gradient';
|
|
172
|
+
/**
|
|
173
|
+
* The type of gradient, always `path` for this fill.
|
|
174
|
+
*/
|
|
175
|
+
gradient: 'path';
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* For 'path' gradient. Specifies the relative coordinates for the start of the path.
|
|
179
|
+
* 'left' and 'top' values range from 0 to 1
|
|
180
|
+
*/
|
|
181
|
+
center: { left: number; top: number };
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Specifies the gradient colour sequence. Is an array of objects containing position and
|
|
185
|
+
* color starting with position 0 and ending with position 1.
|
|
186
|
+
* Intermediary positions may be used to specify other colours on the path.
|
|
187
|
+
*/
|
|
188
|
+
stops: GradientStop[];
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* The fill of a cell: a pattern, a gradient at an angle, or a gradient from a path.
|
|
193
|
+
*/
|
|
194
|
+
export type Fill = FillPattern | FillGradientAngle | FillGradientPath;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* The line style of a border: from the finest, `hair`, through `thin`, `medium` and `thick`, to `double`, and
|
|
198
|
+
* the dashed and dotted styles.
|
|
199
|
+
*/
|
|
200
|
+
export type BorderStyle =
|
|
201
|
+
| 'thin' | 'dotted' | 'hair' | 'medium' | 'double' | 'thick' | 'dashed' | 'dashDot'
|
|
202
|
+
| 'dashDotDot' | 'slantDashDot' | 'mediumDashed' | 'mediumDashDotDot' | 'mediumDashDot';
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* One edge of a border: its line style and colour. Used by `Borders`.
|
|
206
|
+
*/
|
|
207
|
+
export interface Border {
|
|
208
|
+
/**
|
|
209
|
+
* The line style of the edge.
|
|
210
|
+
*/
|
|
211
|
+
style: BorderStyle;
|
|
212
|
+
/**
|
|
213
|
+
* The colour of the edge.
|
|
214
|
+
*/
|
|
215
|
+
color: Partial<Color>;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* The diagonal border of a cell: its line style and colour, and which diagonal it draws. Used by `Borders`.
|
|
220
|
+
*/
|
|
221
|
+
export interface BorderDiagonal extends Border {
|
|
222
|
+
/**
|
|
223
|
+
* Whether the diagonal runs from the bottom left corner of the cell to the top right.
|
|
224
|
+
*/
|
|
225
|
+
up: boolean;
|
|
226
|
+
/**
|
|
227
|
+
* Whether the diagonal runs from the top left corner of the cell to the bottom right.
|
|
228
|
+
*/
|
|
229
|
+
down: boolean;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* The borders of a cell: each edge, the diagonal, and whether the border is on the outline of a range. Used
|
|
234
|
+
* by `Style`.
|
|
235
|
+
*/
|
|
236
|
+
export interface Borders {
|
|
237
|
+
/**
|
|
238
|
+
* The top edge of the border.
|
|
239
|
+
*/
|
|
240
|
+
top: Partial<Border>;
|
|
241
|
+
/**
|
|
242
|
+
* The left edge of the border.
|
|
243
|
+
*/
|
|
244
|
+
left: Partial<Border>;
|
|
245
|
+
/**
|
|
246
|
+
* The bottom edge of the border.
|
|
247
|
+
*/
|
|
248
|
+
bottom: Partial<Border>;
|
|
249
|
+
/**
|
|
250
|
+
* The right edge of the border.
|
|
251
|
+
*/
|
|
252
|
+
right: Partial<Border>;
|
|
253
|
+
/**
|
|
254
|
+
* The diagonal border of the cell.
|
|
255
|
+
*/
|
|
256
|
+
diagonal: Partial<BorderDiagonal>;
|
|
257
|
+
/**
|
|
258
|
+
* Whether the border is on the outline of a range. `false` marks a border that is not, such as one from a
|
|
259
|
+
* table style or a conditional formatting rule.
|
|
260
|
+
*/
|
|
261
|
+
outline?: boolean;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* How the content of a cell is aligned within the cell, and how it is indented and rotated. Used by `Style`.
|
|
266
|
+
*/
|
|
267
|
+
export interface Alignment {
|
|
268
|
+
/**
|
|
269
|
+
* The horizontal alignment: `general` aligns numbers to the right and text to the left. The others are
|
|
270
|
+
* `left`, `center`, `right`, `fill`, `justify`, `centerContinuous` (Center Across Selection) and
|
|
271
|
+
* `distributed`.
|
|
272
|
+
*/
|
|
273
|
+
horizontal: 'general' | 'left' | 'center' | 'right' | 'fill' | 'justify' | 'centerContinuous' | 'distributed';
|
|
274
|
+
/**
|
|
275
|
+
* The vertical alignment: `top`, `middle`, `bottom`, `distributed` or `justify`.
|
|
276
|
+
*/
|
|
277
|
+
vertical: 'top' | 'middle' | 'bottom' | 'distributed' | 'justify';
|
|
278
|
+
/**
|
|
279
|
+
* Whether the text wraps onto more lines within the cell.
|
|
280
|
+
*/
|
|
281
|
+
wrapText: boolean;
|
|
282
|
+
/**
|
|
283
|
+
* Whether the text shrinks to fit the width of the cell.
|
|
284
|
+
*/
|
|
285
|
+
shrinkToFit: boolean;
|
|
286
|
+
/**
|
|
287
|
+
* The indent of the text, as a whole number of steps, 0 or more.
|
|
288
|
+
*/
|
|
289
|
+
indent: number;
|
|
290
|
+
/**
|
|
291
|
+
* The indent added to the cell's own indent, which may be negative. Conditional formatting sets it.
|
|
292
|
+
*/
|
|
293
|
+
relativeIndent?: number;
|
|
294
|
+
/**
|
|
295
|
+
* Whether the last line of justified text is justified as well, for East Asian text.
|
|
296
|
+
*/
|
|
297
|
+
justifyLastLine?: boolean;
|
|
298
|
+
/**
|
|
299
|
+
* The reading order of the text: `ltr` for left to right, `rtl` for right to left, or `context` for the
|
|
300
|
+
* text's own direction.
|
|
301
|
+
*/
|
|
302
|
+
readingOrder: 'rtl' | 'ltr' | 'context';
|
|
303
|
+
/**
|
|
304
|
+
* The rotation of the text, from -90 to 90 degrees, with positive values turning the text counterclockwise,
|
|
305
|
+
* or `vertical` to stack the characters.
|
|
306
|
+
*/
|
|
307
|
+
textRotation: number | 'vertical';
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* How a cell is protected when its worksheet is protected. Used by `Style`.
|
|
312
|
+
*/
|
|
313
|
+
export interface Protection {
|
|
314
|
+
/**
|
|
315
|
+
* Whether the cell is locked when the worksheet is protected.
|
|
316
|
+
*/
|
|
317
|
+
locked: boolean;
|
|
318
|
+
/**
|
|
319
|
+
* Whether the cell's formula is hidden when the worksheet is protected.
|
|
320
|
+
*/
|
|
321
|
+
hidden: boolean;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* The formatting of a cell, row or column: its number format, font, alignment, protection, border and fill.
|
|
326
|
+
*/
|
|
327
|
+
export interface Style {
|
|
328
|
+
/**
|
|
329
|
+
* The number format code, such as `0.00` or `General`.
|
|
330
|
+
*/
|
|
331
|
+
numFmt: string;
|
|
332
|
+
/**
|
|
333
|
+
* The font of the cell.
|
|
334
|
+
*/
|
|
335
|
+
font: Partial<Font>;
|
|
336
|
+
/**
|
|
337
|
+
* The alignment of the cell's content.
|
|
338
|
+
*/
|
|
339
|
+
alignment: Partial<Alignment>;
|
|
340
|
+
/**
|
|
341
|
+
* The protection of the cell when its worksheet is protected.
|
|
342
|
+
*/
|
|
343
|
+
protection: Partial<Protection>;
|
|
344
|
+
/**
|
|
345
|
+
* The borders of the cell.
|
|
346
|
+
*/
|
|
347
|
+
border: Partial<Borders>;
|
|
348
|
+
/**
|
|
349
|
+
* The fill of the cell.
|
|
350
|
+
*/
|
|
351
|
+
fill: Fill;
|
|
352
|
+
/** the text is text, though it starts as a formula or a number would (an apostrophe typed first) */
|
|
353
|
+
quotePrefix?: boolean;
|
|
354
|
+
/** the cell shows a PivotTable field's button (a heading of its labels, a page field's name) */
|
|
355
|
+
pivotButton?: boolean;
|
|
356
|
+
/**
|
|
357
|
+
* the named cell style the cell is based on (Home > Cell Styles); set on a cell, the style's
|
|
358
|
+
* formatting replaces the cell's in each category the style includes
|
|
359
|
+
*/
|
|
360
|
+
namedStyle?: string;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* A cell style, as `Workbook.getCellStyles` lists it and `addCellStyle` makes it.
|
|
365
|
+
*/
|
|
366
|
+
export interface CellStyle {
|
|
367
|
+
/**
|
|
368
|
+
* The style's name, such as `Good` or `Input cell`.
|
|
369
|
+
*/
|
|
370
|
+
name: string;
|
|
371
|
+
/** Excel's number for a built-in style (Good 26), whatever its name in the workbook's language */
|
|
372
|
+
builtinId?: number;
|
|
373
|
+
/** the outline level of a RowLevel_n or ColLevel_n style */
|
|
374
|
+
iLevel?: number;
|
|
375
|
+
/** whether the style is the workbook's own, not one of Excel's */
|
|
376
|
+
custom: boolean;
|
|
377
|
+
/**
|
|
378
|
+
* The formatting the style sets, in the categories its `includes` names.
|
|
379
|
+
*/
|
|
380
|
+
style: Partial<Style>;
|
|
381
|
+
/** the categories the style sets on a cell it is applied to */
|
|
382
|
+
includes: {number: boolean; font: boolean; fill: boolean; border: boolean; alignment: boolean; protection: boolean};
|
|
383
|
+
}
|