@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/index.d.ts ADDED
@@ -0,0 +1,2282 @@
1
+ // The shared types the classes below take and give, by meaning in types/;
2
+ // written by `cargo xtask routes` from those files: do not edit.
3
+ import type { CalculateOptions, CalculatedCell, CalculationReport, EvaluateOptions, EvaluatedValue, Evaluated, TrustDisagreement, TrustReport, GoalSeekOptions, GoalSeekSpec, GoalSeekResult, Scenario, ScenarioSpec, ShowScenarioOptions, ShownScenario, ScenarioValue, ScenarioCase, ScenarioSummary } from './types/calc';
4
+ import type { ChartType, ChartSubType, ChartGalleryName, ChartLegendPosition, ChartTimeUnit, ChartAutoPlacement, ChartPalette, ChartProtection, ChartPrintSettings, ChartPictureOptions, ChartOfTable, ChartRecommendation, ChartArrangement, ChartProperties, PivotChartProperties } from './types/chart';
5
+ import type { ChartExType, ChartExShape, ChartExDataLabels, ChartExAxis, ChartExSeries, ChartExProperties, ChartConfig, ChartDesign, ChartsheetChart, ChartsheetOptions, ChartsheetPageSetup } from './types/chart_ex';
6
+ import type { ChartColor, ChartFont, ChartFill, ChartOutline, ChartLine, ChartEffects, ChartShapeFormat, ChartLayout, ChartTextRun, ChartTitle, ChartLegend, ChartSurface, ChartDisplayUnit, ChartAxis } from './types/chart_format';
7
+ import type { ChartSeries, ChartTrendlineType, ChartTrendline, ChartErrorBarValueType, ChartErrorBars, ChartMarkerSymbol, ChartMarker, ChartPoint, ChartPointLabel, ChartDataLabelPosition, ChartDataLabelField, ChartDataLabelRun, ChartDataLabelFormat, ChartDataLabels } from './types/chart_series';
8
+ import type { Anchor, ImageRange, ImagePosition, ImageHyperlinkValue, ImagePlacement, DrawingRange, SheetImage, Image, ShapeLine, ShapeOptions, ConnectorEnd, ConnectorOptions, SparklineColor, SparklineColors, SparklineSettings, AddSparklinesOptions } from './types/drawings';
9
+ import type { XlsxReadOptions, ZipOptions, XlsxWriteOptions, WorkbookWriterOptions, WorksheetWriterOptions, WorkbookReaderOptions, CsvReadOptions, CsvWriteOptions, CsvParserOptions, CsvFormatterOptions, QuoteColumnMap, QuoteColumns, HeaderArray } from './types/files';
10
+ import type { CellIsOperators, ContainsTextOperators, TimePeriodTypes, IconSetTypes, CfvoTypes, Cvfo, ConditionalFormattingBaseRule, ExpressionRuleType, CellIsRuleType, Top10RuleType, AboveAverageRuleType, ValuesRuleType, ColorScaleRuleType, IconSetRuleType, ContainsTextRuleType, TimePeriodRuleType, DataBarRuleType, ConditionalFormattingRule, ConditionalFormattingOptions, ConditionalFormatIntent, ConditionalFormatOptions } from './types/formats';
11
+ import type { PaperSize, Margins, PageSetup, HeaderFooter, HeaderFooterPosition, HeaderFooterPictureOptions, HeaderFooterPicture, PrintPage, PrintPages } from './types/page';
12
+ import type { SheetChoice, PdfFonts, RenderContent, PdfWriteOptions, HtmlFile, HtmlWriteOptions, OfficeWriteOptions, PngOptions, SheetPictureOptions, SheetPngOptions } from './types/render';
13
+ import type { WorksheetViewCommon, WorksheetViewNormal, WorksheetViewFrozen, WorksheetViewSplit, WorksheetView, WorkbookView, WorksheetState, WorksheetProperties, ColumnDefinition, AddWorksheetOptions, WorksheetProtection, SheetProtectionModel, AutoFilter, CalculationProperties, WorkbookProperties } from './types/sheet';
14
+ import type { Color, Font, FillPatterns, FillPattern, GradientStop, FillGradientAngle, FillGradientPath, Fill, BorderStyle, Border, BorderDiagonal, Borders, Alignment, Protection, Style, CellStyle } from './types/styles';
15
+ import type { TableStyleProperties, TableColumnProperties, TableProperties, TableStyleElementType, TableStyleFormat, TableStyleDefinition, TableStyleOptions, PivotFunction, PivotShowAs, PivotValueOptions, PivotTableOptions, TableSlicerOptions, PivotSlicerOptions, PivotTimelineOptions, PivotFields, PivotGroupOptions, PivotLabelFilter, PivotValueFilter, PivotFilter, PivotCell } from './types/tables';
16
+ import type { DataValidationOperator, DataValidation, TableColumnTarget, IntentTarget, ValidationIntent, ValidationOptions } from './types/validation';
17
+ import type { CellErrorValue, RichText, CellRichTextValue, CellHyperlinkValue, CellFormulaValue, CellSharedFormulaValue, CellValue, RowValues, CommentMargins, CommentProtection, CommentEditAs, Comment, DefinedNamesRanges, DefinedNamesModel, SheetHyperlink, CellRange } from './types/values';
18
+ export * from './types/calc';
19
+ export * from './types/chart';
20
+ export * from './types/chart_ex';
21
+ export * from './types/chart_format';
22
+ export * from './types/chart_series';
23
+ export * from './types/drawings';
24
+ export * from './types/files';
25
+ export * from './types/formats';
26
+ export * from './types/page';
27
+ export * from './types/render';
28
+ export * from './types/sheet';
29
+ export * from './types/styles';
30
+ export * from './types/tables';
31
+ export * from './types/validation';
32
+ export * from './types/values';
33
+
34
+ /**
35
+ * Which binding artifact the generated loader actually loaded: `'native'` for
36
+ * a native addon, otherwise the `platformArchABI` of the WASI flavor. Every
37
+ * flavor napi-rs can build is listed, because `NAPI_RS_NATIVE_LIBRARY_PATH`
38
+ * can point the loader at a WASI artifact this package does not build itself.
39
+ */
40
+ export declare const __napiBindingTarget: 'native' | 'wasm32-wasi' | 'wasm32-wasip1'
41
+
42
+ /** A cell of a worksheet. */
43
+ export declare class Cell {
44
+ /** Its address, `B2`. */
45
+ get address(): string
46
+ /** Its row's number, from 1. */
47
+ get row(): number
48
+ /** Its column's number, from 1. */
49
+ get col(): number
50
+ /** Its worksheet. */
51
+ get worksheet(): Worksheet
52
+ /** Its workbook. */
53
+ get workbook(): Workbook
54
+ /**
55
+ * Its value: nothing, a number, text, a boolean, a date, or one of
56
+ * the shapes with keys (`formula` and `result`, `text` and
57
+ * `hyperlink`, `richText`, `error`), a formula's result current. A
58
+ * cell a merge covers gives the merge's first cell's.
59
+ */
60
+ get value(): CellValue
61
+ /**
62
+ * Sets its value; one Excel would not open the file with is
63
+ * refused. A cell a merge covers sets the merge's first cell's.
64
+ */
65
+ set value(value: CellValue)
66
+ /** Its kind of value, a number of `ValueType`. */
67
+ get type(): number
68
+ /** The kind of value it shows: a formula's is its current result's. */
69
+ get effectiveType(): number
70
+ /** Its text, as it is shown, a formula's result current. */
71
+ get text(): string
72
+ /**
73
+ * Its formula's text, with no `=`; nothing for a cell with no
74
+ * formula.
75
+ */
76
+ get formula(): string | undefined
77
+ /**
78
+ * Its formula's result, as its value gives it (a date where its
79
+ * format is one), current: under the workbook's calcMode `auto`,
80
+ * what changed since is worked out first; `undefined` where it holds
81
+ * no formula.
82
+ */
83
+ get result(): number | string | boolean | Date | CellErrorValue | undefined
84
+ /**
85
+ * How its formula is held, a number of `FormulaType`: 1 its own, 2
86
+ * shared from another cell, 0 neither; `undefined` where it holds no
87
+ * formula.
88
+ */
89
+ get formulaType(): number | undefined
90
+ /**
91
+ * The serial its date, or its formula's date result, was read as,
92
+ * where no Date holds it exactly; `undefined` otherwise.
93
+ */
94
+ get serial(): number | undefined
95
+ /** Where it is: `{sheetName, address, row, col}`. */
96
+ get fullAddress(): {sheetName: string; address: string; row: number; col: number}
97
+ /**
98
+ * Its text, as it is shown, with HTML's special characters escaped,
99
+ * a formula's result current.
100
+ */
101
+ get html(): string
102
+ /** Its text, as it is shown (`toString`). */
103
+ toString(): string
104
+ /**
105
+ * Its value as a CSV field: text quoted, a date as its ISO text, a
106
+ * formula's current result; a boolean as the number 1 or 0, as the
107
+ * fork's BooleanValue gives it.
108
+ */
109
+ toCsvString(): string | number
110
+ /** Whether it is merged: covered by a merge, or the first cell of one. */
111
+ get isMerged(): boolean
112
+ /** The first cell of the merge covering it; itself where none does. */
113
+ get master(): Cell
114
+ /**
115
+ * Takes it out of the merge covering it, alone: the value it held
116
+ * under the merge, read from its file, shows again, and it takes its
117
+ * row's and column's style. A cell covered by none is left as it is.
118
+ */
119
+ unmerge(): void
120
+ /** The first of the names holding it; none where none does. */
121
+ get name(): string | undefined
122
+ /**
123
+ * Makes `name` its one name: it is taken out of every name, then put
124
+ * in `name`. A name Excel refuses is refused.
125
+ */
126
+ set name(name: string)
127
+ /** The names holding it, in the order the names were first given. */
128
+ get names(): Array<string>
129
+ /**
130
+ * Makes `names` its names: it is taken out of every name, then put
131
+ * in each given. A name Excel refuses is refused, those before it
132
+ * set.
133
+ */
134
+ set names(names: string[])
135
+ /** Puts it in the name `name`; a name Excel refuses is refused. */
136
+ addName(name: string): void
137
+ /** Takes it out of the name `name`. */
138
+ removeName(name: string): void
139
+ /** Takes it out of every name. */
140
+ removeAllNames(): void
141
+ /** Its note: its text, or the note in full; `undefined` where none. */
142
+ get note(): string | Comment | undefined
143
+ /**
144
+ * Gives it the note `note`, text or a note in full; `undefined` or
145
+ * `null` takes its note off.
146
+ */
147
+ set note(note: string | Comment | null | undefined)
148
+ /** Whether its value is a link. */
149
+ get isHyperlink(): boolean
150
+ /**
151
+ * Where its link goes, a link's or a formula's; none where it has
152
+ * none.
153
+ */
154
+ get hyperlink(): string | undefined
155
+ /**
156
+ * Its style: `{numFmt, font, alignment, border, fill, protection,
157
+ * namedStyle}`, each part only where it has one. A copy: changing it
158
+ * changes nothing; set `style` or a part.
159
+ */
160
+ get style(): Partial<Style>
161
+ /**
162
+ * Replaces its style with `style`, in a style object of its own;
163
+ * `undefined` gives it none of the parts.
164
+ */
165
+ set style(style: Partial<Style> | undefined)
166
+ /** Its number format's code (`0.00`, `d-mmm-yy`); none for General. */
167
+ get numFmt(): string | undefined
168
+ /** Sets its number format's code; none for General. */
169
+ set numFmt(code: string | undefined | null)
170
+ /**
171
+ * Its font: `{name, size, family, scheme, color, bold, italic,
172
+ * underline, strike, outline, vertAlign}`; `undefined` where none.
173
+ */
174
+ get font(): Partial<Font> | undefined
175
+ /** Sets its font; `undefined` takes it off. */
176
+ set font(font: Partial<Font> | undefined)
177
+ /**
178
+ * Its alignment: `{horizontal, vertical, wrapText, shrinkToFit,
179
+ * indent, readingOrder, textRotation}`; `undefined` where none.
180
+ */
181
+ get alignment(): Partial<Alignment> | undefined
182
+ /** Sets its alignment; `undefined` takes it off. */
183
+ set alignment(alignment: Partial<Alignment> | undefined)
184
+ /**
185
+ * Its border: `{top, left, bottom, right, diagonal}`, each `{style,
186
+ * color}`; `undefined` where none.
187
+ */
188
+ get border(): Partial<Borders> | undefined
189
+ /** Sets its border; `undefined` takes it off. */
190
+ set border(border: Partial<Borders> | undefined)
191
+ /**
192
+ * Its fill: `{type: 'pattern', pattern, fgColor, bgColor}` or
193
+ * `{type: 'gradient', gradient, degree, center, stops}`; `undefined`
194
+ * where none.
195
+ */
196
+ get fill(): Fill | undefined
197
+ /** Sets its fill; `undefined` takes it off. */
198
+ set fill(fill: Fill | undefined)
199
+ /** Its protection: `{locked, hidden}`; `undefined` where none. */
200
+ get protection(): Partial<Protection> | undefined
201
+ /** Sets its protection; `undefined` takes it off. */
202
+ set protection(protection: Partial<Protection> | undefined)
203
+ /**
204
+ * The named style it is based on (Home > Cell Styles); none for
205
+ * Normal.
206
+ */
207
+ get namedStyle(): string | undefined
208
+ /**
209
+ * Applies the named style `name`: its formatting in each category it
210
+ * includes, the cell's own in the rest; a built-in style named is
211
+ * added to the workbook.
212
+ */
213
+ set namedStyle(name: string)
214
+ /**
215
+ * Its data validation: its own, else that of a range holding it;
216
+ * `undefined` where none.
217
+ */
218
+ get dataValidation(): DataValidation | undefined
219
+ /**
220
+ * Gives it the validation `validation`, cut out of a range's holding
221
+ * it; `undefined` takes its own off. A list's or a prompt's text
222
+ * longer than Excel takes is refused.
223
+ */
224
+ set dataValidation(validation: DataValidation | undefined)
225
+ }
226
+
227
+ /**
228
+ * A chart of a worksheet: its sheet and the key the sheet tells it from
229
+ * its other charts by, so the handle finds it after charts before it are
230
+ * removed.
231
+ */
232
+ export declare class Chart {
233
+ /** Its type: a family (`bar`, `line`, `pie`, `waterfall`, ...). */
234
+ get type(): string | undefined
235
+ /** The settings it was made or last set with. */
236
+ get config(): ChartConfig
237
+ /** Its series: `{name, values, categories, ...}` each. */
238
+ get series(): ChartSeries[]
239
+ /** Where it is: `{tl, br, ext, editAs}`, each corner as an image's. */
240
+ get range(): DrawingRange
241
+ /**
242
+ * The model it is written from, its cache of its cells' current
243
+ * values.
244
+ */
245
+ get model(): Record<string, unknown>
246
+ /**
247
+ * Makes it again of `config`, as addChart takes one. The chart, to
248
+ * chain.
249
+ */
250
+ set(config: ChartConfig): Chart
251
+ /**
252
+ * Adds `series`, `{name, values, categories, ...}`; refused on a
253
+ * chart read from a file. The chart, to chain.
254
+ */
255
+ addSeries(series: ChartSeries): Chart
256
+ /** Takes off the series at `index`, from 0. The chart, to chain. */
257
+ removeSeries(index: number): Chart
258
+ /**
259
+ * Works out the values it shows from its cells again. The chart, to
260
+ * chain.
261
+ */
262
+ refreshCache(): Chart
263
+ /**
264
+ * The design it is drawn in, as Excel's Chart Styles gallery names
265
+ * it; `undefined` where it has none.
266
+ */
267
+ get design(): ChartDesign | undefined
268
+ /**
269
+ * What Excel would show differently from the settings, in words:
270
+ * labels slanted or thinned out, legend entries dropped, a title cut
271
+ * short; at its drawing's size or `size`.
272
+ */
273
+ layoutWarnings(size?: {width: number; height: number}): Array<string>
274
+ /**
275
+ * Places its title, legend and plot area by hand where Excel places
276
+ * them on its own, so the chart keeps that layout. The chart, to
277
+ * chain.
278
+ */
279
+ pinLayout(size?: {width: number; height: number}): Chart
280
+ /**
281
+ * Fixes where it goes, where it places itself: the cells it covers,
282
+ * `J2:Q16`; none for one held by a corner and a size.
283
+ */
284
+ place(): string | undefined
285
+ /** Its name on the sheet, `Chart 1`; nothing where it has none. */
286
+ get name(): string | undefined
287
+ /**
288
+ * The chart drawn as an SVG picture where Excel lays out its
289
+ * elements, at its drawing's size or `size` (`{width, height}` in
290
+ * points).
291
+ */
292
+ toSVG(size?: {width: number; height: number}): string
293
+ /**
294
+ * The same picture as a PNG, drawn by the engine's own rasterizer;
295
+ * options as a worksheet's `toPNG` takes them.
296
+ */
297
+ toPNG(size?: {width: number; height: number} | null, options?: PngOptions): Buffer
298
+ }
299
+
300
+ /** A chart sheet. */
301
+ export declare class Chartsheet {
302
+ /** Its id, which it shares the count of with the worksheets. */
303
+ get id(): number
304
+ /** Its name on its tab. */
305
+ get name(): string
306
+ /**
307
+ * Renames it: `Chart<id>` where no name is given; a name Excel does
308
+ * not take, or another sheet has, is refused.
309
+ */
310
+ set name(name: string | undefined | null)
311
+ /** Whether its tab shows: `visible`, `hidden` or `veryHidden`. */
312
+ get state(): string | undefined
313
+ /**
314
+ * Its chart, as the settings it was made with; `undefined` where it
315
+ * has none.
316
+ */
317
+ get chart(): ChartsheetChart | undefined
318
+ /**
319
+ * Gives it a chart of `config`, as addChart takes one, every
320
+ * reference naming its worksheet, in place of any it had: the chart.
321
+ */
322
+ setChart(config: ChartsheetChart): ChartsheetChart
323
+ }
324
+
325
+ /** A column of a worksheet. */
326
+ export declare class Column {
327
+ /** Its number, from 1. */
328
+ get number(): number
329
+ /** Its letters, `C`. */
330
+ get letter(): string
331
+ /** Its worksheet. */
332
+ get worksheet(): Worksheet
333
+ /**
334
+ * The key that names it for `addRow`'s objects; none where it has
335
+ * none.
336
+ */
337
+ get key(): string | undefined
338
+ /**
339
+ * Sets its key, taken from any column it named before; none lets
340
+ * its key go.
341
+ */
342
+ set key(key: string | undefined | null)
343
+ /**
344
+ * Its header: one value, or a list of them down from row 1;
345
+ * `undefined` where it has none.
346
+ */
347
+ get header(): CellValue | CellValue[] | undefined
348
+ /**
349
+ * Sets its header, its values written to its cells from row 1;
350
+ * `undefined` lets the header go and leaves the cells as they are.
351
+ */
352
+ set header(header: CellValue | CellValue[] | undefined)
353
+ /** Its header as a list, of one where it is one value. */
354
+ get headers(): CellValue[]
355
+ /** Its width in characters; `undefined` for the sheet's default. */
356
+ get width(): number | undefined
357
+ /**
358
+ * Sets its width in characters, 0 to 255; none for the sheet's
359
+ * default.
360
+ */
361
+ set width(width: number | undefined | null)
362
+ /** Whether its width is set, not the sheet's default. */
363
+ get isCustomWidth(): boolean
364
+ /** Whether it is hidden. */
365
+ get hidden(): boolean
366
+ /** Hides it, or shows it. */
367
+ set hidden(hidden: boolean)
368
+ /** Its outline level, 0 to 7. */
369
+ get outlineLevel(): number
370
+ /** Sets its outline level: a whole number 0 to 7, none for 0. */
371
+ set outlineLevel(level: number | undefined | null)
372
+ /** Whether it is the summary of a collapsed group. */
373
+ get collapsed(): boolean
374
+ /** Marks it the summary of a collapsed group, or not. */
375
+ set collapsed(collapsed: boolean)
376
+ /**
377
+ * Calls `callback` with its cell in each row holding a value and the
378
+ * row's number; with `{includeEmpty: true}`, in every row to the last
379
+ * made. Each cell is made where it is not, as the fork's `eachRow`
380
+ * and `getCell` make it.
381
+ */
382
+ eachCell(options: {includeEmpty?: boolean} | ((cell: Cell, rowNumber: number) => void), callback?: (cell: Cell, rowNumber: number) => void): void
383
+ /**
384
+ * Its values by row: a list whose item at a row's number is the
385
+ * value of its cell in this column, the places of cells holding none
386
+ * left empty, the first always. Its cell is made in each row that
387
+ * holds a value, as the fork's `eachCell` makes it.
388
+ */
389
+ get values(): CellValue[]
390
+ /**
391
+ * Sets its cells from a list: from row 1 where its first item is
392
+ * given, else from where its items start. An item left `undefined`
393
+ * leaves its cell as it is; anything but a list sets nothing.
394
+ */
395
+ set values(values: CellValue[])
396
+ /**
397
+ * A page break after it, from row `top` to `bottom` (from 1), every
398
+ * row by default.
399
+ */
400
+ addPageBreak(top?: number | undefined | null, bottom?: number | undefined | null): void
401
+ /** Takes off the page break after it; whether there was one. */
402
+ removePageBreak(): boolean
403
+ /**
404
+ * Its own style, which the cells made in it after take: `{numFmt,
405
+ * font, alignment, border, fill, protection}`, each part only where
406
+ * it has one. A copy: changing it changes nothing.
407
+ */
408
+ get style(): Partial<Style>
409
+ /**
410
+ * Replaces its own style, its cells' as they are; `undefined` gives
411
+ * it none of the parts.
412
+ */
413
+ set style(style: Partial<Style> | undefined)
414
+ /** Its number format's code; none for General. */
415
+ get numFmt(): string | undefined
416
+ /** Sets its number format's code and its cells'; none for General. */
417
+ set numFmt(code: string | undefined | null)
418
+ /** Its font; `undefined` where none. */
419
+ get font(): Partial<Font> | undefined
420
+ /** Sets its font and its cells'; `undefined` takes it off. */
421
+ set font(font: Partial<Font> | undefined)
422
+ /** Its alignment; `undefined` where none. */
423
+ get alignment(): Partial<Alignment> | undefined
424
+ /** Sets its alignment and its cells'; `undefined` takes it off. */
425
+ set alignment(alignment: Partial<Alignment> | undefined)
426
+ /** Its border; `undefined` where none. */
427
+ get border(): Partial<Borders> | undefined
428
+ /** Sets its border and its cells'; `undefined` takes it off. */
429
+ set border(border: Partial<Borders> | undefined)
430
+ /** Its fill; `undefined` where none. */
431
+ get fill(): Fill | undefined
432
+ /** Sets its fill and its cells'; `undefined` takes it off. */
433
+ set fill(fill: Fill | undefined)
434
+ /** Its protection; `undefined` where none. */
435
+ get protection(): Partial<Protection> | undefined
436
+ /** Sets its protection and its cells'; `undefined` takes it off. */
437
+ set protection(protection: Partial<Protection> | undefined)
438
+ }
439
+
440
+ /** Reading and writing a workbook's sheets as CSV (`workbook.csv`). */
441
+ export declare class Csv {
442
+ /**
443
+ * A new sheet of the CSV `data`, named `options.sheetName`: each field
444
+ * a number, a date (ISO 8601, or one of `options.dateFormats`),
445
+ * TRUE or FALSE, an error, or text; `options.parserOptions` fast-csv's.
446
+ */
447
+ read(data: Buffer, options?: Partial<CsvReadOptions>): Promise<Worksheet>
448
+ /** A new sheet of the CSV file at `filename`, as read takes it. */
449
+ readFile(filename: string, options?: Partial<CsvReadOptions>): Promise<Worksheet>
450
+ /**
451
+ * The sheet `options.sheetName` (else `options.sheetId`, else the
452
+ * first) as CSV: each cell as the text it shows, a date in
453
+ * `options.dateFormat` (UTC where `options.dateUTC`), text read as a
454
+ * formula after a `'` where `options.escapeFormulas`, empty rows
455
+ * unless `options.includeEmptyRows` is false;
456
+ * `options.formatterOptions` fast-csv's. No such sheet writes
457
+ * nothing.
458
+ */
459
+ writeBuffer(options?: Partial<CsvWriteOptions>): Promise<Buffer>
460
+ /**
461
+ * Writes the sheet as writeBuffer does to the file at `filename`, in
462
+ * `options.encoding` (`utf8`, `latin1`, `ascii` or `utf16le`).
463
+ */
464
+ writeFile(filename: string, options?: Partial<CsvWriteOptions>): Promise<void>
465
+ }
466
+
467
+ /** A worksheet's data validations. */
468
+ export declare class DataValidations {
469
+ /**
470
+ * Gives the cell or range `address` the validation `validation`, a
471
+ * cell's cut out of a range holding it: the validation.
472
+ */
473
+ add(address: string, validation: DataValidation): DataValidation | undefined
474
+ /**
475
+ * The validation of `address`: its own, else, for a cell, that of a
476
+ * range holding it; `undefined` where none.
477
+ */
478
+ find(address: string): DataValidation | undefined
479
+ /**
480
+ * Takes the validation of `address` off, a cell's cut out of a range
481
+ * holding it.
482
+ */
483
+ remove(address: string): void
484
+ /** Every validation, by its address: `{B2: {...}, 'C1:C9': {...}}`. */
485
+ get model(): Record<string, DataValidation>
486
+ }
487
+
488
+ /** A workbook's defined names. */
489
+ export declare class DefinedNames {
490
+ /**
491
+ * Puts the cells at `location` in the name `name`. The name is held to
492
+ * Excel's rules unless `{asRead: true}`, which takes a name another
493
+ * workbook holds as it is; a sheet's name with a space or an
494
+ * apostrophe is refused unquoted.
495
+ */
496
+ add(location: string, name: string, options?: {asRead?: boolean}): void
497
+ /** Takes the cells at `location` out of the name `name`. */
498
+ remove(location: string, name: string): void
499
+ /** Takes away the name `name` where it is a formula, not cells. */
500
+ removeFormula(name: string): void
501
+ /**
502
+ * Takes the cell at `location` out of every name: `Sheet!$A$1`, or
503
+ * `{sheetName, row, col}` as a cell's `fullAddress` gives it. (The
504
+ * fork's takes the object alone and passes over text without a
505
+ * word.)
506
+ */
507
+ removeAllNames(location: string | {sheetName?: string; row: number; col: number}): void
508
+ /** The names holding the cell at `address`, `Sheet!$A$1`. */
509
+ getNames(address: string): Array<string>
510
+ /**
511
+ * The ranges the name `name` holds, `{name, ranges}`; no ranges for a
512
+ * name not held by cells.
513
+ */
514
+ getRanges(name: string): {name: string; ranges: string[]}
515
+ /**
516
+ * Every name, as a file writes it: `{name, ranges, localSheetId,
517
+ * hidden, comment}` for a name held by cells, `{name, formula}` for
518
+ * the rest.
519
+ */
520
+ get model(): DefinedNamesModel
521
+ /**
522
+ * Replaces every name with those of `model`, as the getter gives
523
+ * them. A comment or formula Excel refuses the file over is refused,
524
+ * the names as they were.
525
+ */
526
+ set model(model: DefinedNamesModel)
527
+ }
528
+
529
+ /** The Word document of the workbook (`workbook.docx`). */
530
+ export declare class Docx {
531
+ /**
532
+ * The sheets as a Word document, each its section, table, charts
533
+ * and pictures. Options: `sheets` (names or ids), `now`; past the
534
+ * fork, `range` (ranges, each its table, in place of the print
535
+ * areas), `content` (`cells` or `drawings` alone) and `pageSetup`
536
+ * (each section's paper and margins, laid over each sheet's).
537
+ */
538
+ writeBuffer(options?: Partial<OfficeWriteOptions>): Promise<Buffer>
539
+ /**
540
+ * Writes the Word document to the file at `path`, as `writeBuffer`
541
+ * makes it.
542
+ */
543
+ writeFile(path: string, options?: Partial<OfficeWriteOptions>): Promise<void>
544
+ }
545
+
546
+ /** The HTML page of the workbook (`workbook.html`). */
547
+ export declare class Html {
548
+ /**
549
+ * The sheets as one HTML page, UTF-8; in Excel's dialect the first
550
+ * sheet's page, the rest in `files`. Options: `sheets`, `range` (of
551
+ * the first sheet), `source` (`sheet` or `printArea`), `title`,
552
+ * `gridlines`, `formulas`, `now`, `dialect` (`clean` or `excel`).
553
+ */
554
+ writeBuffer(options?: Partial<HtmlWriteOptions>): Promise<Buffer>
555
+ /**
556
+ * Writes the page to the file at `path`, and in Excel's dialect its
557
+ * supporting files beside it, named after it.
558
+ */
559
+ writeFile(path: string, options?: Partial<HtmlWriteOptions>): Promise<void>
560
+ /** After a write, what the page does not hold, each with where. */
561
+ get unsupported(): Array<string>
562
+ /**
563
+ * After a write, the supporting files beside the page, each
564
+ * `{name, data}`.
565
+ */
566
+ get files(): HtmlFile[]
567
+ }
568
+
569
+ /** The PDF document of the workbook (`workbook.pdf`). */
570
+ export declare class Pdf {
571
+ /**
572
+ * The sheets printed, each on the pages its page setup lays out, as
573
+ * a PDF document. Options: `sheets` (names or ids), `fonts` (false
574
+ * for the standard fonts, or folders), `now`, `dateFormat`,
575
+ * `timeFormat`, `fileName` and `path` (what the header and footer
576
+ * fields show); past the fork, `range` (ranges printed in place of
577
+ * the print areas), `pageSetup` (laid over each sheet's) and
578
+ * `content` (`cells` or `drawings` alone).
579
+ */
580
+ writeBuffer(options?: Partial<PdfWriteOptions>): Promise<Buffer>
581
+ /**
582
+ * Writes the PDF document to the file at `path`, as `writeBuffer`
583
+ * makes it.
584
+ */
585
+ writeFile(path: string, options?: Partial<PdfWriteOptions>): Promise<void>
586
+ /**
587
+ * After a write, what its pages hold that was not drawn, each with
588
+ * its page.
589
+ */
590
+ get unsupported(): Array<string>
591
+ }
592
+
593
+ /** A pivot table. */
594
+ export declare class PivotTable {
595
+ /** Its name. */
596
+ get name(): string | undefined
597
+ /** The range it fills, its page fields apart. */
598
+ get ref(): string | undefined
599
+ /**
600
+ * The cells its page fields take above it, `{top, left, bottom,
601
+ * right}`; `undefined` where it has none.
602
+ */
603
+ get filterArea(): {top: number; left: number; bottom: number; right: number} | undefined
604
+ /** The fields of its source, by their headers. */
605
+ get fields(): string[]
606
+ /** The fields down its rows; `Values` the values' pseudo-field. */
607
+ get rows(): string[]
608
+ /** The fields across its columns. */
609
+ get columns(): string[]
610
+ /** Its page fields, `{field, item}` each; no item where it shows all. */
611
+ get filters(): PivotFilter[]
612
+ /** Its values, `{name, field, function, showAs}` each. */
613
+ get values(): Array<{name?: string; field: string; function: string; showAs: string}>
614
+ /** The cells it shows, `{address, value}` each. */
615
+ cells(): PivotCell[]
616
+ /**
617
+ * The cells of its values as laid out now, `{sheet, top, left,
618
+ * bottom, right}`: from the first data row and column to the last
619
+ * line before the grand totals.
620
+ */
621
+ valueCells(): {sheet: string; top: number; left: number; bottom: number; right: number}
622
+ /**
623
+ * Lays it out over its cache at `at` (its top left, page fields
624
+ * above it) or where it is, and writes its cells into its sheet.
625
+ */
626
+ layOut(at?: string): PivotTable
627
+ /** The report layout: `compact`, `outline` or `tabular`. */
628
+ setLayout(form: 'compact' | 'outline' | 'tabular'): PivotTable
629
+ /**
630
+ * Subtotals at the `top` of each group, at the `bottom`, or none
631
+ * (`false`).
632
+ */
633
+ setSubtotals(where: 'top' | 'bottom' | false): PivotTable
634
+ /**
635
+ * The grand totals shown or not, `{rows, columns}`, each left as it
636
+ * is where it is not given.
637
+ */
638
+ setGrandTotals(totals?: {rows?: boolean; columns?: boolean}): PivotTable
639
+ /**
640
+ * Its style, by one of Excel's names or the workbook's (none leaves
641
+ * it), and `{rowHeaders, columnHeaders, rowStripes, columnStripes,
642
+ * lastColumn}`.
643
+ */
644
+ setStyle(name?: string, options?: Record<string, boolean>): PivotTable
645
+ /** A blank row after each item (where `on` is not false), or none. */
646
+ setBlankRows(onRows?: boolean | undefined | null): PivotTable
647
+ /**
648
+ * Each item's label on every row of its group (where `on` is not
649
+ * false), in outline and tabular form: for `fields`, or for every
650
+ * field and those added later.
651
+ */
652
+ setRepeatLabels(on?: boolean, fields?: Array<string | number>): PivotTable
653
+ /** Reads its source again and lays it out over what it holds now. */
654
+ refresh(): PivotTable
655
+ /**
656
+ * A pivot chart of it: a chart whose series are its columns of values
657
+ * over its row labels. `options` are addChart's but series and
658
+ * categories; `sheet` the name of the worksheet it goes on, its own
659
+ * where none is given.
660
+ */
661
+ addChart(options?: PivotChartProperties & {sheet?: string}): Chart
662
+ /**
663
+ * Puts the field `name` down the rows, at `position` among them or
664
+ * last.
665
+ */
666
+ addRowField(name: string | number, position?: number): PivotTable
667
+ /** Puts the field `name` across the columns, at `position` or last. */
668
+ addColumnField(name: string | number, position?: number): PivotTable
669
+ /** Makes the field `name` a page field, showing `item` or all. */
670
+ addFilter(name: string | number, item?: CellValue): PivotTable
671
+ /** Shows `item` of the page field `name`, or all where none is given. */
672
+ setFilterItem(name: string | number, item?: CellValue): PivotTable
673
+ /**
674
+ * Adds a value: a field, summed, or `{field, function, name, showAs,
675
+ * baseField, baseItem, numFmt}`.
676
+ */
677
+ addValue(value: string | number | PivotValueOptions): PivotTable
678
+ /** Takes the field `name` off the table, wherever it is. */
679
+ removeField(name: string | number): PivotTable
680
+ /**
681
+ * Sets the areas given, `{rows, columns, filters, values}`, each left
682
+ * as it is where it is not given.
683
+ */
684
+ setFields(fields?: PivotFields): PivotTable
685
+ /** Hides the items `values` of the field `name`. */
686
+ hideItems(name: string | number, values: CellValue[]): PivotTable
687
+ /** Shows the items `values` of the field `name` again. */
688
+ showItems(name: string | number, values: CellValue[]): PivotTable
689
+ /**
690
+ * Sorts the field's items by their labels: `ascending` (where none is
691
+ * given), `descending`, or `manual`, the order they are in kept.
692
+ */
693
+ sortField(name: string | number, order?: 'ascending' | 'descending' | 'manual'): PivotTable
694
+ /**
695
+ * Groups the field's items, `{by, start, end}`: numbers by a size,
696
+ * dates by units of time (`months` where none is given).
697
+ */
698
+ groupField(name: string | number, options?: PivotGroupOptions): PivotTable
699
+ /** Takes the field's groups off. */
700
+ ungroupField(name: string | number): PivotTable
701
+ /**
702
+ * Adds a field worked out by `formula` of the others, summed as a
703
+ * value unless `options.value` is false; `options.numFmt` its format.
704
+ */
705
+ addCalculatedField(name: string, formula: string, options?: {value?: boolean; numFmt?: string}): PivotTable
706
+ /**
707
+ * Adds an item `name` to the field, worked out by `formula` of its
708
+ * other items.
709
+ */
710
+ addCalculatedItem(field: string | number, name: string, formula: string): PivotTable
711
+ /**
712
+ * Keeps the field's items whose labels pass: `type` one of the label
713
+ * filters (`equals`, `beginsWith`, `contains`, `between`, ...), a
714
+ * second value for between and notBetween.
715
+ */
716
+ addLabelFilter(field: string | number, type: PivotLabelFilter, value?: CellValue, value2?: CellValue): PivotTable
717
+ /**
718
+ * Keeps the field's items whose `value` (a value's name, its field's,
719
+ * or its place) passes: `type` one of the value filters, `n` and `n2`
720
+ * what it is measured against.
721
+ */
722
+ addValueFilter(field: string | number, value: string | number, type: PivotValueFilter, n?: number, n2?: number): PivotTable
723
+ /**
724
+ * Excel's Top 10: the field's items ranked first (or last) by
725
+ * `value`, `{count, by, bottom}`: `count` 10, `by` `items`, `percent`
726
+ * or `sum`.
727
+ */
728
+ addTopFilter(field: string | number, value: string | number, options?: {count?: number; by?: string; bottom?: boolean}): PivotTable
729
+ /**
730
+ * Keeps the items of a date field on or before, after or between
731
+ * dates, or in a period around today: `type` one of the date filters.
732
+ */
733
+ addDateFilter(field: string | number, type: string, date?: Date, date2?: Date): PivotTable
734
+ /** Takes the field's label, value and date filters off. */
735
+ clearFilters(field: string | number): PivotTable
736
+ /** Takes every filter of the field off, its hidden items shown again. */
737
+ clearAllFilters(field: string | number): PivotTable
738
+ }
739
+
740
+ /** The PowerPoint presentation of the workbook (`workbook.pptx`). */
741
+ export declare class Pptx {
742
+ /**
743
+ * The sheets as a PowerPoint presentation, its tables, charts and
744
+ * pictures on 16:9 slides. Options: `sheets` (names or ids), `now`;
745
+ * past the fork, `range` (ranges, each its table, in place of the
746
+ * print areas) and `content` (`cells` or `drawings` alone). Slides
747
+ * take no page setup: `pageSetup` is refused.
748
+ */
749
+ writeBuffer(options?: Partial<OfficeWriteOptions>): Promise<Buffer>
750
+ /**
751
+ * Writes the presentation to the file at `path`, as `writeBuffer`
752
+ * makes it.
753
+ */
754
+ writeFile(path: string, options?: Partial<OfficeWriteOptions>): Promise<void>
755
+ }
756
+
757
+ /** A row of a worksheet. */
758
+ export declare class Row {
759
+ /** Its number, from 1. */
760
+ get number(): number
761
+ /** Its worksheet. */
762
+ get worksheet(): Worksheet
763
+ /**
764
+ * Its cell in column `col`: a number from 1, a column's key, or its
765
+ * letters (`C`). It is made where it is not.
766
+ */
767
+ getCell(col: number | string): Cell
768
+ /**
769
+ * Its cell in column `col`, from 1, where it is made; none where it
770
+ * is not.
771
+ */
772
+ findCell(col: number): Cell | undefined
773
+ /**
774
+ * Calls `callback` with each of its cells holding a value and its
775
+ * column's number; with `{includeEmpty: true}`, with every cell to
776
+ * its last, each made where it is not.
777
+ */
778
+ eachCell(options: {includeEmpty?: boolean} | ((cell: Cell, colNumber: number) => void), callback?: (cell: Cell, colNumber: number) => void): void
779
+ /**
780
+ * Its values by column: a list whose item at a column's number is
781
+ * the value of its cell, the places of cells holding none left
782
+ * empty, the first always; formulas' results current.
783
+ */
784
+ get values(): CellValue[]
785
+ /**
786
+ * Replaces its cells with `values`: a list from column A where its
787
+ * first item is given (else from column B, as a sparse array's),
788
+ * or an object by the columns' keys.
789
+ */
790
+ set values(values: CellValue[] | Record<string, CellValue>)
791
+ /** Whether a cell of it holds a value. */
792
+ get hasValues(): boolean
793
+ /**
794
+ * The number of its last column holding a cell, styled empty ones
795
+ * counted.
796
+ */
797
+ get cellCount(): number
798
+ /** How many of its cells hold a value. */
799
+ get actualCellCount(): number
800
+ /**
801
+ * The first and last columns of its cells holding a value, `{min,
802
+ * max}`; `null` where none does.
803
+ */
804
+ get dimensions(): {min: number; max: number} | null
805
+ /** Its height in points; `undefined` for the sheet's default. */
806
+ get height(): number | undefined
807
+ /** Sets its height in points, 0 to 409; none for the sheet's default. */
808
+ set height(height: number | undefined | null)
809
+ /** Whether it is hidden. */
810
+ get hidden(): boolean
811
+ /** Hides it, or shows it. */
812
+ set hidden(hidden: boolean)
813
+ /** Its outline level, 0 to 7. */
814
+ get outlineLevel(): number
815
+ /** Sets its outline level: a whole number 0 to 7, none for 0. */
816
+ set outlineLevel(level: number | undefined | null)
817
+ /** Whether it is the summary of a collapsed group. */
818
+ get collapsed(): boolean
819
+ /** Marks it the summary of a collapsed group, or not. */
820
+ set collapsed(collapsed: boolean)
821
+ /**
822
+ * Takes `count` of its cells out at column `start` and puts the
823
+ * values of `inserts` in their place; the cells to the right move.
824
+ */
825
+ splice(start: number, count: number, ...inserts: CellValue[]): void
826
+ /**
827
+ * Tells a streaming writer the row is complete; a workbook held
828
+ * whole has nothing to do.
829
+ */
830
+ commit(): void
831
+ /**
832
+ * A page break after it, across columns `left` to `right` (from 1),
833
+ * every column by default.
834
+ */
835
+ addPageBreak(left?: number | undefined | null, right?: number | undefined | null): void
836
+ /** Takes off the page break after it; whether there was one. */
837
+ removePageBreak(): boolean
838
+ /**
839
+ * Its own style, which the cells made in it after take: `{numFmt,
840
+ * font, alignment, border, fill, protection}`, each part only where
841
+ * it has one. A copy: changing it changes nothing.
842
+ */
843
+ get style(): Partial<Style>
844
+ /**
845
+ * Replaces its own style, its cells' as they are; `undefined` gives
846
+ * it none of the parts.
847
+ */
848
+ set style(style: Partial<Style> | undefined)
849
+ /** Its number format's code; none for General. */
850
+ get numFmt(): string | undefined
851
+ /**
852
+ * Sets its number format's code and each of its cells'; none for
853
+ * General.
854
+ */
855
+ set numFmt(code: string | undefined | null)
856
+ /** Its font; `undefined` where none. */
857
+ get font(): Partial<Font> | undefined
858
+ /** Sets its font and each of its cells'; `undefined` takes it off. */
859
+ set font(font: Partial<Font> | undefined)
860
+ /** Its alignment; `undefined` where none. */
861
+ get alignment(): Partial<Alignment> | undefined
862
+ /**
863
+ * Sets its alignment and each of its cells'; `undefined` takes it
864
+ * off.
865
+ */
866
+ set alignment(alignment: Partial<Alignment> | undefined)
867
+ /** Its border; `undefined` where none. */
868
+ get border(): Partial<Borders> | undefined
869
+ /** Sets its border and each of its cells'; `undefined` takes it off. */
870
+ set border(border: Partial<Borders> | undefined)
871
+ /** Its fill; `undefined` where none. */
872
+ get fill(): Fill | undefined
873
+ /** Sets its fill and each of its cells'; `undefined` takes it off. */
874
+ set fill(fill: Fill | undefined)
875
+ /** Its protection; `undefined` where none. */
876
+ get protection(): Partial<Protection> | undefined
877
+ /**
878
+ * Sets its protection and each of its cells'; `undefined` takes it
879
+ * off.
880
+ */
881
+ set protection(protection: Partial<Protection> | undefined)
882
+ }
883
+
884
+ /** A row of a streamed sheet, until it is committed. */
885
+ export declare class RowWriter {
886
+ /** Its number, from 1. */
887
+ get number(): number
888
+ /** Its values, a list from column A at 1; refused once committed. */
889
+ get values(): CellValue[]
890
+ /** Replaces its cells with `values`, as a worksheet's row takes them. */
891
+ set values(values: CellValue[] | Record<string, CellValue>)
892
+ /** Commits it: it and every row before it are written and let go. */
893
+ commit(): void
894
+ }
895
+
896
+ /** A drawn shape. */
897
+ export declare class Shape {
898
+ /** Its id, the number its sheet's drawing finds it by. */
899
+ get id(): number | undefined
900
+ /** Its name, which no other shape of the sheet has in any case. */
901
+ get name(): string | undefined
902
+ /**
903
+ * What it is: `shape`, `textBox`, `connector`, `group`, `picture` or
904
+ * `frame` (a grouped chart).
905
+ */
906
+ get kind(): string
907
+ /**
908
+ * Its preset geometry (`rect`, `ellipse`, ...); none for a group or a
909
+ * freeform.
910
+ */
911
+ get type(): string | undefined
912
+ /**
913
+ * The cells it lies over, `B2:D6`; a group's member has none of its
914
+ * own.
915
+ */
916
+ get range(): string | undefined
917
+ /**
918
+ * Its frame in EMUs from the sheet's top left, `{x, y, cx, cy}`; a
919
+ * group's member has none of its own.
920
+ */
921
+ get bounds(): {x: number; y: number; cx: number; cy: number} | undefined
922
+ /** The number of its connection sites. */
923
+ get siteCount(): number
924
+ /**
925
+ * Where a connector's end, `stCxn` or `endCxn`, is joined: `{id,
926
+ * idx}`; `undefined` where it is joined to none.
927
+ */
928
+ joint(tag: 'stCxn' | 'endCxn'): {id: number; idx: number} | undefined
929
+ /** A group's members, as shapes; `undefined` for one that is no group. */
930
+ get members(): Array<Shape> | undefined
931
+ /** Its text, a line a paragraph; none where it holds none. */
932
+ get text(): string | undefined
933
+ /**
934
+ * Its fill: a colour as `RRGGBB`, `none`, or none where the theme's
935
+ * style or a fill other than a solid colour gives it.
936
+ */
937
+ get fill(): string | undefined
938
+ /**
939
+ * Its line: `{color, width}` as set, `none`, or `undefined` where the
940
+ * theme's style gives it.
941
+ */
942
+ get line(): {color?: string; width?: number} | 'none' | undefined
943
+ /**
944
+ * Renames it; a name another shape of the sheet has, in any case, is
945
+ * refused.
946
+ */
947
+ set name(name: string)
948
+ /** Moves and sizes it over the cells given, its anchor's kind kept. */
949
+ set range(range: string)
950
+ /** Moves and sizes it to the frame given in EMUs, `{x, y, cx, cy}`. */
951
+ set bounds(bounds: {x: number; y: number; cx: number; cy: number})
952
+ /**
953
+ * Its text replaced, a paragraph a line, each run given the first
954
+ * run's character properties as read; one that holds none is
955
+ * refused.
956
+ */
957
+ set text(text: string)
958
+ /** Its fill: a colour as `RRGGBB`, or `none`. */
959
+ set fill(fill: string)
960
+ /** Its line: `none`, or `{color, width}`, the width in points. */
961
+ set line(line: {color?: string; width?: number} | 'none')
962
+ /**
963
+ * Its frame and its anchor set apart, each `{x, y, cx, cy}` in EMUs:
964
+ * a turned shape's anchor holds the box it covers.
965
+ */
966
+ placeApart(frame: {x: number; y: number; cx: number; cy: number}, anchor: {x: number; y: number; cx: number; cy: number}): void
967
+ /**
968
+ * Joins a connector's end, `stCxn` or `endCxn`, to the shape named
969
+ * `target` at its site `idx`, laid again to meet it; with none, lets
970
+ * it go where it lies.
971
+ */
972
+ join(tag: 'stCxn' | 'endCxn', target?: string, idx?: number): void
973
+ /** Takes it off the sheet; a group's member out of its group. */
974
+ remove(): void
975
+ /**
976
+ * Puts a group's members each on an anchor of its own over where it
977
+ * is drawn, as Excel's Ungroup leaves them: their shapes.
978
+ */
979
+ ungroup(): Array<Shape>
980
+ }
981
+
982
+ /** A slicer or timeline. */
983
+ export declare class Slicer {
984
+ /** Its name; none given, its field's or column's when it is written. */
985
+ get name(): string | undefined
986
+ /** The caption it shows. */
987
+ get caption(): string | undefined
988
+ /** Its style, by name. */
989
+ get style(): string | undefined
990
+ /** A slicer's columns of buttons. */
991
+ get columns(): number | undefined
992
+ /** A slicer's settings, each only where it is not Excel's default. */
993
+ get settings(): Record<string, unknown> | undefined
994
+ /** Where its frame sits: `{tl, br, ext, editAs}`, as a chart's. */
995
+ get range(): DrawingRange
996
+ /**
997
+ * The table a table's slicer is on; `undefined` where the workbook no
998
+ * longer has it.
999
+ */
1000
+ get table(): Table | undefined
1001
+ /** The column of its table a table's slicer is on. */
1002
+ get column(): TableColumn | undefined
1003
+ /** The pivot table a pivot table's slicer or a timeline is on. */
1004
+ get pivot(): PivotTable | undefined
1005
+ /** The field it is on, by its place among its pivot table's. */
1006
+ get field(): number | undefined
1007
+ /** A timeline's time level: `years`, `quarters`, `months` or `days`. */
1008
+ get level(): string | undefined
1009
+ /** A timeline's parts not shown, as addTimeline names them. */
1010
+ get hidden(): string[] | undefined
1011
+ /**
1012
+ * The days a timeline selects, `{start, end}`; `undefined` where it
1013
+ * selects none.
1014
+ */
1015
+ get selection(): {start: Date; end: Date} | undefined
1016
+ /**
1017
+ * Filters its pivot table to the days from `start` to `end`, both
1018
+ * kept: two dates, the first not after the second.
1019
+ */
1020
+ setFilterDateRange(start: Date, end: Date): Slicer
1021
+ /** Takes its pivot table's filters on its field off. */
1022
+ clearDateFilter(): Slicer
1023
+ }
1024
+
1025
+ /** A group of sparklines. */
1026
+ export declare class SparklineGroup {
1027
+ /** `line`, `column` or `winLoss`. */
1028
+ get type(): string
1029
+ /** How empty cells are shown: `gap`, `zero` or `span`. */
1030
+ get emptyCells(): string
1031
+ /** Its lines' weight in points. */
1032
+ get lineWeight(): number
1033
+ /** Its axis' least: `individual`, `group`, or a number. */
1034
+ get min(): 'individual' | 'group' | number
1035
+ /** Its axis' most, as min. */
1036
+ get max(): 'individual' | 'group' | number
1037
+ /** The cells of the dates its points stand at; none for evenly. */
1038
+ get dateRange(): string | undefined
1039
+ /**
1040
+ * Its colours by part, `{series, negative, axis, markers, first,
1041
+ * last, high, low}`, those it has.
1042
+ */
1043
+ get colors(): SparklineColors
1044
+ /**
1045
+ * The item of Excel's Sparkline Style gallery whose colours it has,
1046
+ * 1 to 36; none for another's.
1047
+ */
1048
+ get style(): number | undefined
1049
+ /** Its sparklines, `{location, data}` each. */
1050
+ get sparklines(): Array<{location?: string; data?: string}>
1051
+ /** `line`, `column` or `winLoss`. */
1052
+ set type(kind: string)
1053
+ /** `gap`, `zero` or `span`. */
1054
+ set emptyCells(shown: string)
1055
+ /** Its lines' weight in points. */
1056
+ set lineWeight(weight: number)
1057
+ /** Its axis' least: `individual`, `group`, or a number. */
1058
+ set min(value: 'individual' | 'group' | number)
1059
+ /** Its axis' most, as min. */
1060
+ set max(value: 'individual' | 'group' | number)
1061
+ /** The cells of the dates its points stand at; none to take them off. */
1062
+ set dateRange(range: string | undefined | null)
1063
+ /**
1064
+ * Colours by part set over those it has: one given `null` taken off,
1065
+ * one left out kept.
1066
+ */
1067
+ set colors(colors: SparklineColors)
1068
+ /**
1069
+ * The colours of Excel's Sparkline Style gallery item `n`, 1 to 36,
1070
+ * set over its own.
1071
+ */
1072
+ set style(n: number)
1073
+ /**
1074
+ * Its sparklines replaced, `{location, data}` each; the handle then
1075
+ * finds the group by the first of them.
1076
+ */
1077
+ set sparklines(lines: Array<{location: string; data?: string}>)
1078
+ /** Every point marked (a line's). */
1079
+ get markers(): boolean
1080
+ /** Every point marked, or not. */
1081
+ set markers(on: boolean)
1082
+ /** The highest point marked. */
1083
+ get high(): boolean
1084
+ /** The highest point marked, or not. */
1085
+ set high(on: boolean)
1086
+ /** The lowest point marked. */
1087
+ get low(): boolean
1088
+ /** The lowest point marked, or not. */
1089
+ set low(on: boolean)
1090
+ /** The first point marked. */
1091
+ get first(): boolean
1092
+ /** The first point marked, or not. */
1093
+ set first(on: boolean)
1094
+ /** The last point marked. */
1095
+ get last(): boolean
1096
+ /** The last point marked, or not. */
1097
+ set last(on: boolean)
1098
+ /** The negative points marked. */
1099
+ get negative(): boolean
1100
+ /** The negative points marked, or not. */
1101
+ set negative(on: boolean)
1102
+ /** The horizontal axis shown. */
1103
+ get axis(): boolean
1104
+ /** The horizontal axis shown, or not. */
1105
+ set axis(on: boolean)
1106
+ /** The data in hidden rows and columns shown. */
1107
+ get hidden(): boolean
1108
+ /** The data in hidden rows and columns shown, or not. */
1109
+ set hidden(on: boolean)
1110
+ /** Drawn right to left. */
1111
+ get rightToLeft(): boolean
1112
+ /** Drawn right to left, or not. */
1113
+ set rightToLeft(on: boolean)
1114
+ }
1115
+
1116
+ /** A row of a sheet read as a stream. */
1117
+ export declare class StreamedRow {
1118
+ /** Its number, from 1. */
1119
+ get number(): number
1120
+ /** Its values, a list from column A at 1, the cells with none left out. */
1121
+ get values(): CellValue[]
1122
+ /** Its height in points, where it has one. */
1123
+ get height(): number | undefined
1124
+ /** Whether a cell of it holds a value. */
1125
+ get hasValues(): boolean
1126
+ /** The column of its last cell, a value or not. */
1127
+ get cellCount(): number
1128
+ /** How many of its cells hold a value. */
1129
+ get actualCellCount(): number
1130
+ /**
1131
+ * The first and last of its columns holding a value, `{min, max}`;
1132
+ * null where none does.
1133
+ */
1134
+ get dimensions(): {min: number, max: number} | null
1135
+ }
1136
+
1137
+ /** A table on a worksheet. */
1138
+ export declare class Table {
1139
+ /** Its name, the one the sheet finds it by. */
1140
+ get name(): string
1141
+ /**
1142
+ * Renames it, held to addTable's rules: a displayName that was its
1143
+ * name follows.
1144
+ */
1145
+ set name(name: string)
1146
+ /** The name formulas and Excel know it by. */
1147
+ get displayName(): string
1148
+ /** Sets the name formulas know it by; the formulas naming it follow. */
1149
+ set displayName(name: string)
1150
+ /**
1151
+ * Its top-left cell (`ref`); `undefined` for a table read from a
1152
+ * file until a change reads it, as the fork's.
1153
+ */
1154
+ get ref(): string | undefined
1155
+ /** Moves it to begin at `top_left`, on commit. */
1156
+ set ref(topLeft: string)
1157
+ /** Whether it has a header row. */
1158
+ get headerRow(): boolean
1159
+ /** Gives it a header row or takes it off, on commit. */
1160
+ set headerRow(on: boolean)
1161
+ /** Whether it has a totals row. */
1162
+ get totalsRow(): boolean
1163
+ /** Gives it a totals row or takes it off, on commit. */
1164
+ set totalsRow(on: boolean)
1165
+ /** Its column at `index`, from 0; refused where it has none there. */
1166
+ getColumn(index: number): TableColumn
1167
+ /**
1168
+ * Adds a data row of `values`, at data row `row_number` (from 0) or
1169
+ * last.
1170
+ */
1171
+ addRow(values: CellValue[], rowNumber?: number): void
1172
+ /** Takes away `count` data rows (1 where not given) from `row_index`. */
1173
+ removeRows(rowIndex?: number | undefined | null, count?: number | undefined | null): void
1174
+ /**
1175
+ * Adds `column`, `{name, totalsRowFunction, ...}`, with `values`, one
1176
+ * for each data row, at column `col_index` (from 0) or last.
1177
+ */
1178
+ addColumn(column: TableColumnProperties, values?: CellValue[], colIndex?: number): void
1179
+ /**
1180
+ * Takes away `count` columns (1 where not given) from `col_index`,
1181
+ * with their data.
1182
+ */
1183
+ removeColumns(colIndex?: number | undefined | null, count?: number | undefined | null): void
1184
+ /**
1185
+ * Lays it over `range`, its header and totals rows included, at once;
1186
+ * refused, the sheet as it was, where Excel would refuse it.
1187
+ */
1188
+ resize(range: string): void
1189
+ /**
1190
+ * Writes its changes into its sheet: its cells, header, totals and
1191
+ * range.
1192
+ */
1193
+ commit(): void
1194
+ /**
1195
+ * The style it is drawn in, `TableStyleMedium2`; none where it names
1196
+ * none.
1197
+ */
1198
+ get theme(): string | undefined
1199
+ /**
1200
+ * Draws it in the style `theme`, one Excel or the workbook has; none
1201
+ * names none.
1202
+ */
1203
+ set theme(theme: string | undefined | null)
1204
+ /** Whether its style marks its first column. */
1205
+ get showFirstColumn(): boolean | undefined
1206
+ /** Marks its first column or not. */
1207
+ set showFirstColumn(on: boolean | undefined | null)
1208
+ /** Whether its style marks its last column. */
1209
+ get showLastColumn(): boolean | undefined
1210
+ /** Marks its last column or not. */
1211
+ set showLastColumn(on: boolean | undefined | null)
1212
+ /** Whether its style bands its rows. */
1213
+ get showRowStripes(): boolean | undefined
1214
+ /** Bands its rows or not. */
1215
+ set showRowStripes(on: boolean | undefined | null)
1216
+ /** Whether its style bands its columns. */
1217
+ get showColumnStripes(): boolean | undefined
1218
+ /** Bands its columns or not. */
1219
+ set showColumnStripes(on: boolean | undefined | null)
1220
+ /** Its number of columns. */
1221
+ get width(): number
1222
+ /** Its number of data rows. */
1223
+ get height(): number
1224
+ /** Its data rows and its header row: the rows its filter covers. */
1225
+ get filterHeight(): number
1226
+ /** All its rows, header and totals with its data. */
1227
+ get tableHeight(): number
1228
+ }
1229
+
1230
+ /** A table's column. */
1231
+ export declare class TableColumn {
1232
+ /** Its name, its header cell's text. */
1233
+ get name(): string
1234
+ /**
1235
+ * Renames it: the references to it follow, its header cell taking
1236
+ * the name on commit.
1237
+ */
1238
+ set name(name: string)
1239
+ /**
1240
+ * Whether its header shows a filter button; `undefined` where it
1241
+ * says nothing.
1242
+ */
1243
+ get filterButton(): boolean | undefined
1244
+ /** Shows its filter button or not. */
1245
+ set filterButton(on: boolean | undefined | null)
1246
+ /**
1247
+ * The style its data cells take, `{numFmt, font, ...}`; `undefined`
1248
+ * where it has none.
1249
+ */
1250
+ get style(): Partial<Style> | undefined
1251
+ /** Sets the style its data cells take, on commit; `undefined` none. */
1252
+ set style(style: Partial<Style> | undefined)
1253
+ /**
1254
+ * The formula each of its data cells holds, a calculated column's;
1255
+ * none where it is not one.
1256
+ */
1257
+ get formula(): string | undefined
1258
+ /**
1259
+ * Makes it a calculated column of `formula`, its data cells filled at
1260
+ * once; none leaves the cells and makes it no longer calculated.
1261
+ * Refused where the table has a change not committed, or the formula
1262
+ * is not one.
1263
+ */
1264
+ set formula(formula: string | undefined | null)
1265
+ /** The text its total shows where it has no function. */
1266
+ get totalsRowLabel(): string | undefined
1267
+ /** Sets the text its total shows, on commit. */
1268
+ set totalsRowLabel(label: string | undefined | null)
1269
+ /**
1270
+ * The function its total is: `sum`, `average`, `count`, `custom`,
1271
+ * `none`, ...
1272
+ */
1273
+ get totalsRowFunction(): string | undefined
1274
+ /** Sets the function its total is, on commit. */
1275
+ set totalsRowFunction(functionName: string | undefined | null)
1276
+ /** The formula of a `custom` total. */
1277
+ get totalsRowFormula(): string | undefined
1278
+ /** Sets the formula of a `custom` total, on commit. */
1279
+ set totalsRowFormula(formula: string | undefined | null)
1280
+ /** The result its total shows, as Excel cached it. */
1281
+ get totalsRowResult(): CellValue
1282
+ /** Sets the result its total shows, written with its formula. */
1283
+ set totalsRowResult(result: CellValue)
1284
+ }
1285
+
1286
+ /** A workbook. */
1287
+ export declare class Workbook {
1288
+ /**
1289
+ * Adds an image, `{extension, buffer}`, or `base64` or a `filename`
1290
+ * for the bytes, read when the workbook is written: its id, which a
1291
+ * sheet shows it by.
1292
+ */
1293
+ addImage(image: Image): number
1294
+ /**
1295
+ * The image of id `id`: `{type, extension, buffer}`, or as it was
1296
+ * given; `undefined` where it has none so.
1297
+ */
1298
+ getImage(id: number): Image | undefined
1299
+ /** Its author. */
1300
+ get creator(): string | undefined
1301
+ /** Sets its author. */
1302
+ set creator(creator: string | undefined | null)
1303
+ /** Who saved it last. */
1304
+ get lastModifiedBy(): string | undefined
1305
+ /** Sets who saved it last. */
1306
+ set lastModifiedBy(name: string | undefined | null)
1307
+ /** Its title. */
1308
+ get title(): string | undefined
1309
+ /** Sets its title. */
1310
+ set title(title: string | undefined | null)
1311
+ /** Its subject. */
1312
+ get subject(): string | undefined
1313
+ /** Sets its subject. */
1314
+ set subject(subject: string | undefined | null)
1315
+ /** Its keywords. */
1316
+ get keywords(): string | undefined
1317
+ /** Sets its keywords. */
1318
+ set keywords(keywords: string | undefined | null)
1319
+ /** Its category. */
1320
+ get category(): string | undefined
1321
+ /** Sets its category. */
1322
+ set category(category: string | undefined | null)
1323
+ /** Its description (Info's Comments). */
1324
+ get description(): string | undefined
1325
+ /** Sets its description. */
1326
+ set description(description: string | undefined | null)
1327
+ /** Its language, `en-US`. */
1328
+ get language(): string | undefined
1329
+ /** Sets its language. */
1330
+ set language(language: string | undefined | null)
1331
+ /** Its status, `Draft` or `Final`. */
1332
+ get contentStatus(): string | undefined
1333
+ /** Sets its status. */
1334
+ set contentStatus(status: string | undefined | null)
1335
+ /** Its company. */
1336
+ get company(): string | undefined
1337
+ /** Sets its company. */
1338
+ set company(company: string | undefined | null)
1339
+ /** Its manager. */
1340
+ get manager(): string | undefined
1341
+ /** Sets its manager. */
1342
+ set manager(manager: string | undefined | null)
1343
+ /** When it was made. */
1344
+ get created(): Date | undefined
1345
+ /** Sets when it was made: a Date, or text a date is read from. */
1346
+ set created(date: Date | string | undefined)
1347
+ /** When it was changed last. */
1348
+ get modified(): Date | undefined
1349
+ /** Sets when it was changed last. */
1350
+ set modified(date: Date | string | undefined)
1351
+ /** When it was printed last. */
1352
+ get lastPrinted(): Date | undefined
1353
+ /** Sets when it was printed last. */
1354
+ set lastPrinted(date: Date | string | undefined)
1355
+ /** Its revision number; `''` where its file gave none in the element. */
1356
+ get revision(): number | '' | undefined
1357
+ /** Sets its revision number; `undefined` takes it off. */
1358
+ set revision(revision: number | undefined)
1359
+ /**
1360
+ * Protects it: `options.structure` (true where not given) locks its
1361
+ * sheets from being added, removed, renamed, moved, hidden or shown,
1362
+ * `options.windows` its windows, under `password` where one is given,
1363
+ * hashed over `options.spinCount` rounds (100,000 where none). The
1364
+ * workbook, to chain.
1365
+ */
1366
+ protect(password?: string, options?: {structure?: boolean; windows?: boolean; spinCount?: number}): Workbook
1367
+ /** Takes its protection off. The workbook, to chain. */
1368
+ unprotect(): Workbook
1369
+ /**
1370
+ * What its protection locks, `{structure, windows, password}`,
1371
+ * `password` whether it has one; `undefined` where it is not
1372
+ * protected.
1373
+ */
1374
+ get protection(): {structure: boolean; windows: boolean; password: boolean} | undefined
1375
+ /**
1376
+ * Whether `password` unprotects it: by its hash or, in a file of
1377
+ * Excel 2010 or before, its 16-bit one.
1378
+ */
1379
+ checkPassword(password?: string | undefined | null): boolean
1380
+ /**
1381
+ * Its named cell styles (Home > Cell Styles): those its file holds
1382
+ * and those added, Normal where it holds none; each `{name,
1383
+ * builtinId, iLevel, customBuiltin, custom, style, includes}`.
1384
+ */
1385
+ getCellStyles(): CellStyle[]
1386
+ /** The names of Excel's built-in cell styles, in its gallery's order. */
1387
+ getCellStyleGallery(): Array<string>
1388
+ /**
1389
+ * Adds a cell style of its own (New Cell Style): the formatting of
1390
+ * `style`, each part given included and the rest not, a font given in
1391
+ * part Normal's with those parts. Refused where `name` is empty or
1392
+ * taken, by the workbook or Excel. The workbook, to chain.
1393
+ */
1394
+ addCellStyle(name: string, style?: Partial<Style>): Workbook
1395
+ /**
1396
+ * The names of Excel's built-in table, pivot table, slicer and
1397
+ * timeline styles, by kind.
1398
+ */
1399
+ getTableStyleGallery(): {table: string[]; pivot: string[]; slicer: string[]; timeline: string[]}
1400
+ /**
1401
+ * The table or pivot table style `name`, Excel's or its own, as
1402
+ * `{name, builtIn, table, pivot, elements}`; `undefined` where none.
1403
+ */
1404
+ getTableStyle(name: string): TableStyleDefinition | undefined
1405
+ /** Its own table styles: those its file holds and those added. */
1406
+ getTableStyles(): TableStyleDefinition[]
1407
+ /**
1408
+ * Adds a table style of its own (New Table Style): `{elements:
1409
+ * {headerRow: {font, fill, border}, firstRowStripe: {fill, size}},
1410
+ * table, pivot, slicer, timeline}`. Refused where the name is empty or
1411
+ * taken, an element is not one of its kind's, or a stripe's size is
1412
+ * not 1 to 9. The workbook, to chain.
1413
+ */
1414
+ addTableStyle(name: string, options?: TableStyleOptions): Workbook
1415
+ /**
1416
+ * The style a new table takes: the one set, else its file's, else
1417
+ * TableStyleMedium2.
1418
+ */
1419
+ get defaultTableStyle(): string
1420
+ /**
1421
+ * Sets the style a new table takes; refused where no table style is
1422
+ * named `name`.
1423
+ */
1424
+ set defaultTableStyle(name: string)
1425
+ /**
1426
+ * The style a new pivot table takes: the one set, else its file's,
1427
+ * else PivotStyleLight16.
1428
+ */
1429
+ get defaultPivotStyle(): string
1430
+ /**
1431
+ * Sets the style a new pivot table takes; refused where no pivot
1432
+ * table style is named `name`.
1433
+ */
1434
+ set defaultPivotStyle(name: string)
1435
+ /**
1436
+ * Its windows: each `{x, y, width, height, firstSheet, activeTab,
1437
+ * visibility}`.
1438
+ */
1439
+ get views(): Array<Partial<WorkbookView>>
1440
+ /**
1441
+ * Sets its windows; one not a window is refused, the windows as they
1442
+ * were.
1443
+ */
1444
+ set views(views: Array<Partial<WorkbookView>>)
1445
+ /** Its properties: `{date1904, codeName, ...}`. */
1446
+ get properties(): Partial<WorkbookProperties>
1447
+ /** Sets its properties whole; ones not its properties are refused. */
1448
+ set properties(properties: Partial<WorkbookProperties>)
1449
+ /** Its calculation properties: `{fullCalcOnLoad, calcMode, ...}`. */
1450
+ get calcProperties(): Partial<CalculationProperties>
1451
+ /**
1452
+ * Sets its calculation properties whole; ones not such properties
1453
+ * are refused.
1454
+ */
1455
+ set calcProperties(properties: Partial<CalculationProperties>)
1456
+ /**
1457
+ * The options of the calculations a read of results makes, as
1458
+ * given (`calculationOptions`): `now`, `random` or `seed`, and
1459
+ * `iterate`, as `calculate` takes them.
1460
+ */
1461
+ get calculationOptions(): CalculateOptions | undefined
1462
+ /**
1463
+ * Sets the options of the calculations a read of results makes:
1464
+ * `{now}` fixes the moment NOW and TODAY give, `{random}` or
1465
+ * `{seed}` what RAND draws, `{iterate}` cycles worked out round.
1466
+ * `undefined` takes them away.
1467
+ */
1468
+ set calculationOptions(options: CalculateOptions | undefined)
1469
+ /**
1470
+ * Works every formula out, each after the cells it reads, and writes
1471
+ * each result that changes its cell; a formula it cannot work out
1472
+ * keeps its result. Options: `now` (the moment TODAY and NOW give),
1473
+ * `random` (the number RAND gives) or `seed`, `iterate`, and
1474
+ * `incremental` with `edited` (`[[sheet, address], ...]`): only what
1475
+ * those cells, or the cells set since the last calculation, reach.
1476
+ * The report, kept as `calculation`.
1477
+ */
1478
+ calculate(options?: CalculateOptions): CalculationReport
1479
+ /**
1480
+ * The report of the workbook's last calculation, of a call, a save
1481
+ * that asked for one or a result read; none before the first.
1482
+ */
1483
+ get calculation(): CalculationReport | undefined
1484
+ /**
1485
+ * The charts Excel offers for a block of cells: `'Data!A1:D13'` (a
1486
+ * sheet's name with spaces in single quotes), `{sheet, range}`, or a
1487
+ * table's, `{table}`; as a worksheet's recommendCharts gives them.
1488
+ */
1489
+ recommendCharts(range: string | {sheet: string; range: string} | {table: string}, options?: {count?: number}): ChartRecommendation[]
1490
+ /**
1491
+ * Adds a chart sheet named `name` (`Chart<id>` where none is given)
1492
+ * after every sheet, of `chart`, as addChart takes one with every
1493
+ * reference naming its worksheet; `options`: tabColor, state,
1494
+ * zoomToFit, zoomScale, pageMargins, pageSetup, headerFooter,
1495
+ * protection, properties.
1496
+ */
1497
+ addChartsheet(name?: string, chart?: ChartsheetChart, options?: Partial<ChartsheetOptions>): Chartsheet
1498
+ /** The chart sheet of an id or a name; none such, `undefined`. */
1499
+ getChartsheet(idOrName: number | string): Chartsheet | undefined
1500
+ /** Takes out the chart sheet of an id or a name; none such, nothing. */
1501
+ removeChartsheet(idOrName: number | string): void
1502
+ /** Its chart sheets, in tab order. */
1503
+ get chartsheets(): Array<Chartsheet>
1504
+ /** Reading and writing the workbook's sheets as CSV. */
1505
+ get csv(): Csv
1506
+ /** Its defined names. */
1507
+ get definedNames(): DefinedNames
1508
+ /**
1509
+ * An expression worked out over the cells as they stand, no cell
1510
+ * written: its references on `sheet` (the first sheet else), worked
1511
+ * out as at `cell` (A1 else), so ROW() and relative references read
1512
+ * from there; with `kept: false` each formula it reads is worked out
1513
+ * first. A range or an array comes back as `{rows}`, an error as
1514
+ * `{error}`.
1515
+ */
1516
+ evaluate(expression: string, options?: EvaluateOptions): Evaluated
1517
+ /**
1518
+ * The workbook's sheets printed to PDF, as Excel's Save As PDF
1519
+ * prints a workbook whole.
1520
+ */
1521
+ get pdf(): Pdf
1522
+ /**
1523
+ * The workbook's sheets as one HTML page: a div a sheet, its cells
1524
+ * a table, its charts, pictures and shapes as SVG.
1525
+ */
1526
+ get html(): Html
1527
+ /**
1528
+ * The workbook's sheets as a Word document: each sheet a section on
1529
+ * its paper, its cells a Word table, its charts Word's own with
1530
+ * their data embedded.
1531
+ */
1532
+ get docx(): Docx
1533
+ /**
1534
+ * The workbook's sheets as a PowerPoint presentation: each sheet's
1535
+ * cells a table on as many slides as its rows need, each chart and
1536
+ * picture a slide of its own.
1537
+ */
1538
+ get pptx(): Pptx
1539
+ /**
1540
+ * Goal Seek: the value of the cell `changing` that makes the formula
1541
+ * of `set` give `to`, set in the cell and the workbook calculated
1542
+ * when found, unless `calculate: false`; the options a
1543
+ * calculation's besides. `{found, value, result, evaluations,
1544
+ * calculation}`.
1545
+ */
1546
+ goalSeek(spec: GoalSeekSpec, options?: GoalSeekOptions): GoalSeekResult
1547
+ /**
1548
+ * Checks the results a file keeps: each formula, of the sheets
1549
+ * `{sheets}` names or of every sheet, is worked out again from those
1550
+ * results and compared with the result Excel saved, to 15
1551
+ * significant digits. Nothing is written.
1552
+ */
1553
+ trust(options?: {sheets?: string[]}): TrustReport
1554
+ /** A new workbook with no sheets. */
1555
+ constructor()
1556
+ /** The worksheets, in tab order. */
1557
+ get worksheets(): Array<Worksheet>
1558
+ /** Reading and writing the workbook as an .xlsx file. */
1559
+ get xlsx(): Xlsx
1560
+ /**
1561
+ * Adds a worksheet, named `sheet<id>` where no name is given. A
1562
+ * name Excel does not take, or another sheet has, is refused.
1563
+ */
1564
+ addWorksheet(name?: string, options?: Partial<AddWorksheetOptions>): Worksheet
1565
+ /**
1566
+ * The worksheet with the id or the name given, or the first where
1567
+ * neither is; nothing where the workbook has no such sheet.
1568
+ */
1569
+ getWorksheet(indexOrName?: number | string | undefined | null): Worksheet | undefined
1570
+ /**
1571
+ * Removes the worksheet with the id or the name given; one the
1572
+ * workbook has not is no error.
1573
+ */
1574
+ removeWorksheet(indexOrName: number | string): void
1575
+ /** Calls `callback` with each worksheet and its id, in tab order. */
1576
+ eachSheet(callback: (arg0: Worksheet, arg1: number) => unknown): void
1577
+ }
1578
+
1579
+ /** A workbook read as a stream. */
1580
+ export declare class WorkbookReader {
1581
+ /**
1582
+ * A reader of the workbook `input`, a file's name or its bytes;
1583
+ * `options` `{worksheets, sharedStrings, hyperlinks, styles}` as the
1584
+ * fork takes them, and `password` for one encrypted with it.
1585
+ */
1586
+ constructor(input: Buffer | string, options?: Partial<WorkbookReaderOptions>)
1587
+ /**
1588
+ * The next sheet, a reader of its rows; none once every sheet is
1589
+ * met. The rows of a sheet not read through are passed over.
1590
+ */
1591
+ nextWorksheet(): WorksheetReader | undefined
1592
+ }
1593
+
1594
+ /** A workbook written as a stream. */
1595
+ export declare class WorkbookWriter {
1596
+ /**
1597
+ * A writer of a new workbook: `{filename, useStyles,
1598
+ * useSharedStrings, created, modified, creator, lastModifiedBy,
1599
+ * lastPrinted, date1904}`.
1600
+ */
1601
+ constructor(options?: Partial<WorkbookWriterOptions>)
1602
+ /**
1603
+ * Adds a sheet, named `sheet<id>` where no name is given; `options`
1604
+ * as a workbook's addWorksheet takes them, and `useSharedStrings`,
1605
+ * the sheet's own.
1606
+ */
1607
+ addWorksheet(name?: string, options?: Partial<WorksheetWriterOptions>): WorksheetWriter
1608
+ /**
1609
+ * The sheet with the id or the name given, or the first where
1610
+ * neither is; none where it has no such sheet.
1611
+ */
1612
+ getWorksheet(indexOrName?: number | string): WorksheetWriter | undefined
1613
+ /**
1614
+ * Commits each sheet not yet committed, then the package's own
1615
+ * parts: the file's bytes, written to `filename` where one was given.
1616
+ */
1617
+ commit(): Promise<Buffer>
1618
+ }
1619
+
1620
+ /** A worksheet of a workbook. */
1621
+ export declare class Worksheet {
1622
+ /**
1623
+ * The charts Excel offers for the block `range` of this sheet's
1624
+ * cells (`B2:E14`), or for a table's, `{table}`, wherever it is; the
1625
+ * first `options.count` of them where a count is given.
1626
+ */
1627
+ recommendCharts(range: string | {table: string}, options?: {count?: number}): ChartRecommendation[]
1628
+ /** Its data validations. */
1629
+ get dataValidations(): DataValidations
1630
+ /**
1631
+ * Gives `target`, a range (`B2:B20`) or a table's column (`{table,
1632
+ * column}`, its data rows), the validation of `intent` (`list`,
1633
+ * `wholeNumber`, `date`, ...) with `options`: the validation. A
1634
+ * formula it holds is checked against the workbook first, and one
1635
+ * naming no sheet, name, table column or function there is refused.
1636
+ */
1637
+ addValidation(target: IntentTarget, intent: ValidationIntent, options?: ValidationOptions): DataValidation
1638
+ /**
1639
+ * The sheet's cells drawn as an SVG picture, as Excel draws them at
1640
+ * 100%: fills, gridlines, borders, and each value as its number
1641
+ * format shows it in its font. Options: `range` (`A1:H20`; from A1
1642
+ * to the last cell in use by default), `gridlines`.
1643
+ */
1644
+ toSVG(options?: SheetPictureOptions): string
1645
+ /**
1646
+ * The same picture as a PNG, drawn by the engine's own rasterizer.
1647
+ * Options as `toSVG`'s, and `scale` (pixels a point, 2 by default),
1648
+ * `fonts` (false, or folders) and `background` (`{hex, alpha}`, null
1649
+ * for none).
1650
+ */
1651
+ toPNG(options?: SheetPngOptions): Buffer
1652
+ /**
1653
+ * The pages the sheet prints on, as its page setup lays them out:
1654
+ * `{paper: {width, height}, scale, pages}`, each page `{range,
1655
+ * titleRows, titleColumns}` with the titles printed with it.
1656
+ */
1657
+ getPrintPages(): PrintPages
1658
+ /**
1659
+ * The chart at a place among the sheet's charts (from 0) or of a
1660
+ * name; nothing where the sheet has none such.
1661
+ */
1662
+ getChart(indexOrName: number | string): Chart | undefined
1663
+ /**
1664
+ * The sheet's scenarios, Excel's Scenario Manager: `{name, cells,
1665
+ * locked, hidden, user, comment}` each, its cells by address.
1666
+ */
1667
+ get scenarios(): Scenario[]
1668
+ /**
1669
+ * Adds a scenario, `{name, cells: {address: value}, comment, user,
1670
+ * locked, hidden}`, each changing cell of the sheet with the value
1671
+ * it takes (a number, text or a date): the scenario. Refused where
1672
+ * the sheet has a scenario of the name.
1673
+ */
1674
+ addScenario(spec: ScenarioSpec): Scenario
1675
+ /**
1676
+ * Takes away the scenario named `name`, in any case: false where the
1677
+ * sheet has none so named.
1678
+ */
1679
+ removeScenario(name: string): boolean
1680
+ /**
1681
+ * Shows the scenario named `name`: its values set in its cells and
1682
+ * the workbook calculated, unless `calculate: false`; the options a
1683
+ * calculation's besides. `{scenario, calculation}`.
1684
+ */
1685
+ showScenario(name: string, options?: ShowScenarioOptions): ShownScenario
1686
+ /**
1687
+ * What the result cells give as the workbook stands and under each
1688
+ * of the sheet's scenarios, the workbook unchanged:
1689
+ * `resultCells` cells or ranges, as text apart by spaces or a list,
1690
+ * or those of the last summary where none are given.
1691
+ */
1692
+ scenarioSummary(resultCells?: string | string[]): ScenarioSummary
1693
+ /**
1694
+ * Makes a chart of `config`: `{type, series: [{name, values,
1695
+ * categories}], title, legend, range, ...}`, `{table, x, y}` for a
1696
+ * table's columns, or `{pivotTable}` for a pivot chart. Refused where
1697
+ * its type or settings are not a chart's.
1698
+ */
1699
+ addChart(config: ChartConfig): Chart
1700
+ /** Its charts, in the order they were made. */
1701
+ getCharts(): Array<Chart>
1702
+ /**
1703
+ * Takes off the chart at a place among its charts (from 0) or of a
1704
+ * name; none such, nothing.
1705
+ */
1706
+ removeChart(indexOrName: number | string): void
1707
+ /**
1708
+ * Lays charts out in a grid, for a dashboard: `{columns (2), size
1709
+ * ({width, height} in points, or {cols, rows}), gap (1), start (a
1710
+ * cell), charts}`, `charts` the places or names of those to lay out,
1711
+ * all where none are given. The range each takes, in order.
1712
+ */
1713
+ arrangeCharts(options?: ChartArrangement): Array<string>
1714
+ /**
1715
+ * Column `c`: a number from 1, a column's key, or its letters (`C`);
1716
+ * made, with every column before it, where it is not.
1717
+ */
1718
+ getColumn(c: number | string): Column
1719
+ /** Its columns made, from column 1; none where none is made. */
1720
+ get columns(): Array<Column> | undefined
1721
+ /**
1722
+ * Defines its columns anew from column 1, one for each item of
1723
+ * `columns`: `{header, key, width, style, hidden, outlineLevel}`, a
1724
+ * header's values written down from row 1.
1725
+ */
1726
+ set columns(columns: ColumnDefinition[])
1727
+ /**
1728
+ * Takes `count` columns out at column `start` and puts a column in
1729
+ * their place for each of `inserts`, a list of its values from row 1;
1730
+ * the columns to the right move, and what refers to them with them.
1731
+ */
1732
+ spliceColumns(start: number, count: number, ...inserts: CellValue[][]): void
1733
+ /** The column `key` names; none where it names none. */
1734
+ getColumnKey(key: string): Column | undefined
1735
+ /** Lets the key `key` go: it names no column after. */
1736
+ deleteColumnKey(key: string): void
1737
+ /**
1738
+ * Its conditional formats, in the order they were added. A copy:
1739
+ * set the list, or add and remove, to change them.
1740
+ */
1741
+ get conditionalFormattings(): ConditionalFormattingOptions[]
1742
+ /**
1743
+ * Replaces its conditional formats with `formats`; one not a format
1744
+ * is refused, the formats as they were.
1745
+ */
1746
+ set conditionalFormattings(formats: ConditionalFormattingOptions[])
1747
+ /**
1748
+ * Adds the conditional format `format`, `{ref, rules}`, after those
1749
+ * it has; one not a format is refused.
1750
+ */
1751
+ addConditionalFormatting(format: ConditionalFormattingOptions): void
1752
+ /**
1753
+ * Takes away conditional formats: the one at `filter`, counted from
1754
+ * 0 (from the last where negative); those whose place in `filter`, a
1755
+ * list of one mark for each format, is false; every one where
1756
+ * `filter` is not given. In Node a function is taken as the fork
1757
+ * takes it, each format kept where it returns true.
1758
+ */
1759
+ removeConditionalFormatting(filter?: number | boolean[] | ((format: ConditionalFormattingOptions, index: number) => boolean)): void
1760
+ /**
1761
+ * Adds the conditional format of `intent` (`greaterThan`,
1762
+ * `colorScale`, `textContains`, `duplicates`, `formula`, ...) with
1763
+ * `options` over `target`, a range or a table's column: its rule.
1764
+ */
1765
+ addConditionalFormat(target: IntentTarget, intent: ConditionalFormatIntent, options?: ConditionalFormatOptions): ConditionalFormattingRule
1766
+ /**
1767
+ * A data table over `range`, its first row and column the inputs'
1768
+ * values and its top left the formula's: `{rowInput, columnInput}`,
1769
+ * one cell each outside the range, one or both. `{ref, formula}`,
1770
+ * the formula `TABLE(row input, column input)`.
1771
+ */
1772
+ addDataTable(range: string, options: {rowInput?: string; columnInput?: string}): {ref: string; formula: string}
1773
+ /**
1774
+ * Shows the workbook's image `image_id` over `range`: cells
1775
+ * (`B2:D6`), or `{tl, br}`, or `{tl, ext: {width, height}}`, a corner
1776
+ * an address, `{col, row}` from 0, or `{nativeCol, nativeColOff,
1777
+ * nativeRow, nativeRowOff}`; `editAs` and `hyperlinks` with them.
1778
+ */
1779
+ addImage(imageId: number, range: string | ImagePlacement): void
1780
+ /**
1781
+ * Its pictures: `{type, imageId, range: {tl, br, ext, editAs}}`
1782
+ * each, a corner `{nativeCol, nativeColOff, nativeRow, nativeRowOff,
1783
+ * col, row}`, `col` and `row` fractional from 0.
1784
+ */
1785
+ getImages(): SheetImage[]
1786
+ /**
1787
+ * Takes off the pictures whose top-left cell is `address`, and one
1788
+ * placed in that cell with its value, as Delete of a picture: how
1789
+ * many were taken.
1790
+ */
1791
+ removeImage(address: string): number
1792
+ /** Shows the workbook's image `image_id` behind its cells. */
1793
+ addBackgroundImage(imageId: number): void
1794
+ /** The image behind its cells; `undefined` where it has none. */
1795
+ getBackgroundImageId(): number | undefined
1796
+ /**
1797
+ * Its links, row by row: each `{address, range, target, tooltip,
1798
+ * text}`, a formula's text its current result.
1799
+ */
1800
+ getHyperlinks(): SheetHyperlink[]
1801
+ /**
1802
+ * A link to `target` on the cell or over the range `range`, held by
1803
+ * its top-left cell, any link there before taken off; `{tooltip,
1804
+ * text}`, the cell's value staying its text unless `text` is given.
1805
+ * The link as listed.
1806
+ */
1807
+ addHyperlink(range: string, target: string, options?: {tooltip?: string; text?: CellValue}): SheetHyperlink | undefined
1808
+ /**
1809
+ * Takes off the link holding or covering the cell `address`, the
1810
+ * cell keeping its value; whether there was one.
1811
+ */
1812
+ removeHyperlink(address: string): boolean
1813
+ /**
1814
+ * Merges the range into its first cell, which shows its value; the
1815
+ * covered cells take its style. Refused where the range meets a
1816
+ * merge, a table, or an array formula entered as one.
1817
+ */
1818
+ mergeCells(...range: Array<string | number>): void
1819
+ /**
1820
+ * Merges the range as [`Worksheet::merge_cells`] does, each covered
1821
+ * cell keeping its own style.
1822
+ */
1823
+ mergeCellsWithoutStyle(...range: Array<string | number>): void
1824
+ /** Whether it lists a merge. */
1825
+ get hasMerges(): boolean
1826
+ /** Unmerges every merge a cell of the range is part of, whole. */
1827
+ unMergeCells(...range: Array<string | number>): void
1828
+ /**
1829
+ * The ranges its built-in name `kind` refers to, `D1:D2` or
1830
+ * `D1:D2,F1:G1`; none where it has none. A kind not one of the five
1831
+ * is refused.
1832
+ */
1833
+ getBuiltInName(kind: string): string | undefined
1834
+ /**
1835
+ * Sets its built-in name `kind` to `range`: `D1:D2`, `D1:D2,F1:G1` or
1836
+ * a list of ranges; `null` or `undefined` takes it away.
1837
+ */
1838
+ setBuiltInName(kind: string, range: string | string[] | null | undefined): void
1839
+ /**
1840
+ * Every built-in name of its own it has, by kind: `{Criteria:
1841
+ * 'D1:D2', ...}`.
1842
+ */
1843
+ get builtInNames(): Record<string, string>
1844
+ /**
1845
+ * How it is printed: `{orientation, paperSize, fitToPage, fitToWidth,
1846
+ * fitToHeight, scale, margins: {left, right, top, bottom, header,
1847
+ * footer}, printArea, printTitlesRow, printTitlesColumn, ...}`.
1848
+ */
1849
+ get pageSetup(): Partial<PageSetup>
1850
+ /** Sets how it is printed, whole; one not a page setup is refused. */
1851
+ set pageSetup(setup: Partial<PageSetup>)
1852
+ /**
1853
+ * Its printed headers and footers: `{oddHeader, oddFooter,
1854
+ * evenHeader, evenFooter, firstHeader, firstFooter, differentFirst,
1855
+ * differentOddEven}`.
1856
+ */
1857
+ get headerFooter(): Partial<HeaderFooter>
1858
+ /**
1859
+ * Sets its printed headers and footers, whole; `undefined` takes them
1860
+ * away. Ones not headers and footers are refused.
1861
+ */
1862
+ set headerFooter(headerFooter: Partial<HeaderFooter> | undefined)
1863
+ /**
1864
+ * The rows and columns its pages end after, in order: `{rows,
1865
+ * columns}`.
1866
+ */
1867
+ getPageBreaks(): {rows: number[]; columns: number[]}
1868
+ /**
1869
+ * Places the workbook's image `image_id` in the cell at `address`,
1870
+ * as Place in Cell, with `{altText}`; the cell's value is the
1871
+ * `#VALUE!` Excel stores it as. `{address, imageId, altText}`.
1872
+ */
1873
+ addPictureInCell(address: string, imageId: number, options?: {altText?: string}): {address: string; imageId: number; altText?: string}
1874
+ /**
1875
+ * Its pictures in cells, read and placed here, row by row:
1876
+ * `{address, imageId, altText}` each.
1877
+ */
1878
+ getPicturesInCells(): Array<{address: string; imageId?: number; altText?: string}>
1879
+ /**
1880
+ * Puts the workbook's image into a header or footer section, as
1881
+ * Insert Picture: `{imageId, position (leftHeader ... rightFooter),
1882
+ * page (odd, first, even), width, height (points; the image's own
1883
+ * where not given), title}`, `&G` put in the section's text. What was
1884
+ * placed, with its shape's id.
1885
+ */
1886
+ addHeaderFooterPicture(options: HeaderFooterPictureOptions): HeaderFooterPicture
1887
+ /**
1888
+ * Takes off the picture in the header or footer place `position` on
1889
+ * `page` (odd where not given), and its `&G`: whether there was one.
1890
+ */
1891
+ removeHeaderFooterPicture(position: string, page?: string | undefined | null): boolean
1892
+ /**
1893
+ * Its header and footer pictures: `{position, page, imageId, width,
1894
+ * height, title}` each.
1895
+ */
1896
+ getHeaderFooterPictures(): HeaderFooterPicture[]
1897
+ /**
1898
+ * Makes a pivot table over a source, laid out with its cells written
1899
+ * on this sheet: `{source, rows, columns, filters, values, valuesOn,
1900
+ * ref, name, layout, subtotals, grandTotals, repeatLabels, style}`,
1901
+ * `source` as `'Data'!A1:D9`, `{sheet, ref}`, `{table}` or `{name}`.
1902
+ */
1903
+ addPivotTable(options: PivotTableOptions): PivotTable
1904
+ /** Its pivot tables, those read with it first. */
1905
+ getPivotTables(): Array<PivotTable>
1906
+ /** Its pivot table named `name`, in any case; none such, `undefined`. */
1907
+ getPivotTable(name: string): PivotTable | undefined
1908
+ /**
1909
+ * Takes out its pivot table named `name`, as Excel takes one out when
1910
+ * the whole table is selected and deleted; none such is refused.
1911
+ */
1912
+ removePivotTable(name: string): void
1913
+ /**
1914
+ * Protects it: what may still be done in `options` (`selectLockedCells`,
1915
+ * `formatCells`, `insertRows`, `sort`, `autoFilter`, ...), under
1916
+ * `password` where one is given, hashed over `options.spinCount`
1917
+ * rounds (100,000 where none). Done when the call returns; the
1918
+ * Promise is the fork's.
1919
+ */
1920
+ protect(password?: string, options?: WorksheetProtection): Promise<void>
1921
+ /** Takes its protection off. */
1922
+ unprotect(): void
1923
+ /**
1924
+ * Whether `password` unprotects it: by its hash or, in a file of
1925
+ * Excel 2010 or before, its 16-bit one.
1926
+ */
1927
+ checkPassword(password?: string | undefined | null): boolean
1928
+ /**
1929
+ * Its protection as the file holds it: `{sheet, algorithmName,
1930
+ * hashValue, saltValue, spinCount, formatCells, ...}`; `null` where it
1931
+ * is not protected.
1932
+ */
1933
+ get sheetProtection(): SheetProtectionModel | null
1934
+ /**
1935
+ * Sets its protection as given, a password's hash with it; `null`
1936
+ * takes it off. One not a protection is refused.
1937
+ */
1938
+ set sheetProtection(protection: SheetProtectionModel | null)
1939
+ /**
1940
+ * Adds a range its protection lets be edited, `{name, range,
1941
+ * password, spinCount}`: `range` cells or ranges by spaces or commas,
1942
+ * or a list of them. Refused where the title is not one Excel takes or
1943
+ * is the sheet's already. The sheet, to chain.
1944
+ */
1945
+ addProtectedRange(options: {name: string; range: string | string[]; password?: string; spinCount?: number}): Worksheet
1946
+ /**
1947
+ * Its protected ranges, those read and those added: `{name, range,
1948
+ * password}` each, `password` whether it has one.
1949
+ */
1950
+ getProtectedRanges(): Array<{name: string; range: string; password: boolean}>
1951
+ /**
1952
+ * Takes off the protected range titled `name`, in any case; refused
1953
+ * where it has none so titled.
1954
+ */
1955
+ removeProtectedRange(name: string): void
1956
+ /** Row `number`, from 1; made where it is not. */
1957
+ getRow(number: number): Row
1958
+ /** Row `number`, from 1, where it is made; none where it is not. */
1959
+ findRow(number: number): Row | undefined
1960
+ /**
1961
+ * The `length` rows from row `start`, each made where it is not;
1962
+ * none where `length` is under 1.
1963
+ */
1964
+ getRows(start: number, length: number): Array<Row> | undefined
1965
+ /**
1966
+ * The `length` rows from row `start` up to the last made, each where
1967
+ * it is made and a hole where it is not.
1968
+ */
1969
+ findRows(start: number, length: number): Array<Row | undefined>
1970
+ /**
1971
+ * Calls `callback` with each row holding a value and its number; with
1972
+ * `{includeEmpty: true}`, with every row to the last made, each made
1973
+ * where it is not.
1974
+ */
1975
+ eachRow(options: {includeEmpty?: boolean} | ((row: Row, rowNumber: number) => void), callback?: (row: Row, rowNumber: number) => void): void
1976
+ /** Its last row made; none where it has none. */
1977
+ get lastRow(): Row | undefined
1978
+ /**
1979
+ * Adds a row of `values` after the last: a list from column A, or an
1980
+ * object by the columns' keys. `style` `'i'` gives it the row
1981
+ * before's style, its cells with values; `'i+'` every cell's.
1982
+ */
1983
+ addRow(values: CellValue[] | Record<string, CellValue>, style?: string): Row
1984
+ /**
1985
+ * Adds a row for each item of `rows`, as [`Worksheet::add_row`]
1986
+ * adds one.
1987
+ */
1988
+ addRows(rows: Array<CellValue[] | Record<string, CellValue>>, style?: string): Array<Row>
1989
+ /**
1990
+ * Inserts a row of `values` at row `pos`, the rows from there moved
1991
+ * down one. `style` `'i'`/`'i+'` takes the row before's style, `'o'`/
1992
+ * `'o+'` the row after's.
1993
+ */
1994
+ insertRow(pos: number, values: CellValue[] | Record<string, CellValue>, style?: string): Row
1995
+ /**
1996
+ * Inserts a row for each item of `rows` from row `pos`, as
1997
+ * [`Worksheet::insert_row`] inserts one; the rows inserted, none
1998
+ * where `rows` is empty.
1999
+ */
2000
+ insertRows(pos: number, rows: Array<CellValue[] | Record<string, CellValue>>, style?: string): Array<Row> | undefined
2001
+ /**
2002
+ * Takes `count` rows out at row `start` and puts a row in their place
2003
+ * for each of `inserts`, a list from column A or an object by the
2004
+ * columns' keys; the rows below move up or down, and what refers to
2005
+ * them with them.
2006
+ */
2007
+ spliceRows(start: number, count: number, ...inserts: Array<CellValue[] | Record<string, CellValue>>): void
2008
+ /**
2009
+ * Copies row `number` `count` times below it, over the rows there,
2010
+ * or moving them down where `insert` is true; each copy with its
2011
+ * style and height.
2012
+ */
2013
+ duplicateRow(number: number, count: number, insert?: boolean | undefined | null): void
2014
+ /**
2015
+ * Every made row's values, at its number: each a list as
2016
+ * `row.values` gives it, formulas' results current.
2017
+ */
2018
+ getSheetValues(): CellValue[][]
2019
+ /**
2020
+ * The range its cells holding values span: `{top, left, bottom,
2021
+ * right, tl, br, range, shortRange, count}`, `A1` for a sheet
2022
+ * with none.
2023
+ */
2024
+ get dimensions(): CellRange
2025
+ /**
2026
+ * A shape over a range of cells: `{type, range, text, name, fill,
2027
+ * line, font}`, `type` a preset geometry (`rect` where none is
2028
+ * given), `line` `none` or `{color, width}`, `font` `{size, bold,
2029
+ * italic, color}`.
2030
+ */
2031
+ addShape(options?: ShapeOptions): Shape
2032
+ /** A text box, as addShape takes it, its type a rectangle. */
2033
+ addTextBox(options?: Omit<ShapeOptions, 'type'>): Shape
2034
+ /**
2035
+ * A connector: `{type, range, arrow, line, from, to, name}`, `from`
2036
+ * and `to` the shapes it joins, by name or `{shape, site}`.
2037
+ */
2038
+ addConnector(options?: ConnectorOptions): Shape
2039
+ /** The shapes named made one group, `{name}`; two or more. */
2040
+ groupShapes(members: string[], options?: {name?: string}): Shape
2041
+ /**
2042
+ * Its shapes, connectors and groups, read and made, each on an anchor
2043
+ * of its own; a group's members are its `members`.
2044
+ */
2045
+ getShapes(): Array<Shape>
2046
+ /** The shape named `name`, in a group or not; none such, `undefined`. */
2047
+ getShape(name: string): Shape | undefined
2048
+ /**
2049
+ * A slicer on a table's column, `{table, column, range, name,
2050
+ * caption, style, columns, crossFilter, hideItemsWithNoData, sort,
2051
+ * customListSort, header, lockedPosition}`; or on a pivot table's
2052
+ * field, `{pivotTable, field, ...}`, the pivot table by its name.
2053
+ */
2054
+ addSlicer(options: TableSlicerOptions | PivotSlicerOptions): Slicer
2055
+ /**
2056
+ * A timeline on a pivot table's field of dates, `{pivotTable, field,
2057
+ * range, name, caption, style, level, header, selectionLabel,
2058
+ * timeLevel, scrollbar}`, the pivot table by its name.
2059
+ */
2060
+ addTimeline(options: PivotTimelineOptions): Slicer
2061
+ /** Its slicers and timelines made here. */
2062
+ getSlicers(): Array<Slicer>
2063
+ /**
2064
+ * Takes out a slicer or timeline: by its name, one made here named
2065
+ * exactly so, else one read from the file by that name in any case;
2066
+ * or by its place among those getSlicers lists.
2067
+ */
2068
+ removeSlicer(slicer: string | number): void
2069
+ /**
2070
+ * A group of sparklines in the cells of `location`, drawing `data`
2071
+ * (cells, a table, a name of one range, or `{pivotTable}` by name):
2072
+ * `{location, data, type, dateRange, emptyCells, lineWeight, min,
2073
+ * max, style, colors}` and the flags (markers, high, low, first, last,
2074
+ * negative, axis, hidden, rightToLeft); the rest as Excel gives a
2075
+ * group it adds.
2076
+ */
2077
+ addSparklines(options: AddSparklinesOptions): SparklineGroup
2078
+ /** Its groups of sparklines, read and made. */
2079
+ get sparklineGroups(): Array<SparklineGroup>
2080
+ /**
2081
+ * Takes a group off the sheet: by its place among sparklineGroups,
2082
+ * or by a cell one of its sparklines stands in.
2083
+ */
2084
+ removeSparklines(group: number | string): void
2085
+ /**
2086
+ * The style of the cell at (`row`, `col`), from 1, read without
2087
+ * making it, a styled empty cell's of a run too; `undefined` where
2088
+ * no cell is made.
2089
+ */
2090
+ styleOf(row: number, col: number): Partial<Style> | undefined
2091
+ /**
2092
+ * Applies the named style `name` to each cell of `range` (`A1:C3`),
2093
+ * as Home > Cell Styles applies it, a cell made where there is none;
2094
+ * the range, as `dimensions` gives one.
2095
+ */
2096
+ applyCellStyle(range: string, name: string): CellRange
2097
+ /**
2098
+ * Makes a table of `model`, `{name, displayName, ref, headerRow,
2099
+ * totalsRow, style: {theme, showRowStripes, ...}, columns: [{name,
2100
+ * totalsRowLabel, totalsRowFunction, ...}], rows}`, its cells written
2101
+ * at `ref`. Refused where its name is not one Excel takes or is
2102
+ * taken, or it would meet another table or a merge.
2103
+ */
2104
+ addTable(model: TableProperties): Table
2105
+ /** The table the sheet holds by `name`; none where it holds none so. */
2106
+ getTable(name: string): Table | undefined
2107
+ /** Its tables, in the order the sheet holds them. */
2108
+ getTables(): Array<Table>
2109
+ /**
2110
+ * Takes off the table it holds by `name`, the slicers on it with it;
2111
+ * none so held, nothing. With `{toRange: true}`, as Convert to Range,
2112
+ * the formulas naming it name its cells; with `{deleted: true}`, as a
2113
+ * table deleted with its cells, they are `#REF!`; else they are left
2114
+ * naming it.
2115
+ */
2116
+ removeTable(name: string, options?: {toRange?: boolean; deleted?: boolean}): void
2117
+ /**
2118
+ * Its windows: each `{state, xSplit, ySplit, topLeftCell,
2119
+ * activeCell, showGridLines, zoomScale, rightToLeft, ...}`, `state`
2120
+ * `frozen` or `split` for panes.
2121
+ */
2122
+ get views(): Array<Partial<WorksheetView>>
2123
+ /**
2124
+ * Sets its windows; `undefined` gives it none. One not a view is
2125
+ * refused, the windows as they were.
2126
+ */
2127
+ set views(views: Array<Partial<WorksheetView>> | undefined)
2128
+ /**
2129
+ * Its properties: `{defaultRowHeight, dyDescent, outlineLevelCol,
2130
+ * outlineLevelRow, tabColor, outlineProperties, ...}`.
2131
+ */
2132
+ get properties(): Partial<WorksheetProperties>
2133
+ /** Sets its properties whole; ones not its properties are refused. */
2134
+ set properties(properties: Partial<WorksheetProperties>)
2135
+ /**
2136
+ * The colour of its tab, `{argb}` or `{theme, tint}`; `undefined`
2137
+ * where it has none.
2138
+ */
2139
+ get tabColor(): Partial<Color> | undefined
2140
+ /** Sets the colour of its tab; `undefined` takes it off. */
2141
+ set tabColor(color: Partial<Color> | undefined)
2142
+ /** Its code name, which VBA knows it by; none where it has none. */
2143
+ get codeName(): string | undefined
2144
+ /**
2145
+ * Sets its code name: a letter, then letters, digits or underscores,
2146
+ * 31 at most; none takes it away. One not a code name is refused.
2147
+ */
2148
+ set codeName(name: string | undefined | null)
2149
+ /** Its id, which a rename or a move of its tab leaves as it was. */
2150
+ get id(): number
2151
+ /** Its name. */
2152
+ get name(): string
2153
+ /**
2154
+ * Renames it: `sheet<id>` where no name is given. A name Excel
2155
+ * does not take, or another sheet has, is refused; every reference
2156
+ * to the sheet follows its new name.
2157
+ */
2158
+ set name(name: string | undefined | null)
2159
+ /** Whether it is shown: `visible`, `hidden` or `veryHidden`. */
2160
+ get state(): string
2161
+ /** Shows or hides it; any other word is refused. */
2162
+ set state(state: string)
2163
+ /**
2164
+ * The cell at an address (`B2`), or at a row and a column's
2165
+ * number, each from 1. It is made where it is not.
2166
+ */
2167
+ getCell(r: string | number, c?: number): Cell
2168
+ /** The number of its last row holding a cell. */
2169
+ get rowCount(): number
2170
+ /** How many of its rows hold a value. */
2171
+ get actualRowCount(): number
2172
+ /** The number of its last column holding a cell. */
2173
+ get columnCount(): number
2174
+ /** How many of its columns hold a value. */
2175
+ get actualColumnCount(): number
2176
+ }
2177
+
2178
+ /**
2179
+ * A sheet of a workbook read as a stream: its rows, read as they are
2180
+ * asked for.
2181
+ */
2182
+ export declare class WorksheetReader {
2183
+ /**
2184
+ * Its id in the workbook; its part's number, as text, where the
2185
+ * workbook names no such part.
2186
+ */
2187
+ get id(): number | string
2188
+ /** Its name. */
2189
+ get name(): string
2190
+ /** `hidden` or `veryHidden`, as the workbook says; none where shown. */
2191
+ get state(): string | undefined
2192
+ /**
2193
+ * The cells holding a value among the rows read so far, as a range:
2194
+ * `{top, left, bottom, right, ...}`.
2195
+ */
2196
+ get dimensions(): CellRange
2197
+ /**
2198
+ * The next row; none once its rows are read, or once the next sheet
2199
+ * is asked for.
2200
+ */
2201
+ nextRow(): StreamedRow | undefined
2202
+ }
2203
+
2204
+ /** A sheet of a workbook written as a stream. */
2205
+ export declare class WorksheetWriter {
2206
+ /** Its id. */
2207
+ get id(): number
2208
+ /** Its name. */
2209
+ get name(): string
2210
+ /**
2211
+ * Its columns as defined, each `{number, key, width, hidden,
2212
+ * outlineLevel, header}`; none where none is.
2213
+ */
2214
+ get columns(): ColumnDefinition[] | undefined
2215
+ /** Its views. */
2216
+ get views(): Array<Partial<WorksheetView>>
2217
+ /**
2218
+ * Adds a row of `values` after the last, as a worksheet's addRow
2219
+ * takes them.
2220
+ */
2221
+ addRow(values: CellValue[] | Record<string, CellValue>): RowWriter
2222
+ /** Row `number`; refused once it has been committed. */
2223
+ getRow(number: number): RowWriter
2224
+ /**
2225
+ * Merges `range` into its first cell; refused where it meets a merge
2226
+ * or its first row has been committed.
2227
+ */
2228
+ mergeCells(range: string): void
2229
+ /**
2230
+ * Defines its columns, `{header, key, width, style, hidden,
2231
+ * outlineLevel}` each, as a worksheet's `columns =`.
2232
+ */
2233
+ set columns(columns: ColumnDefinition[])
2234
+ /** Its views; refused once its first row is written, which they lead. */
2235
+ set views(views: Array<Partial<WorksheetView>>)
2236
+ /** Adds a table, as a worksheet's addTable takes one: its name. */
2237
+ addTable(model: TableProperties): string
2238
+ /** Adds a conditional format, as a worksheet's takes one. */
2239
+ addConditionalFormatting(format: ConditionalFormattingOptions): void
2240
+ /**
2241
+ * Commits it: its rows still held are written, then what follows
2242
+ * them. A sheet committed takes no more.
2243
+ */
2244
+ commit(): void
2245
+ }
2246
+
2247
+ /** Reading and writing a workbook as an .xlsx file. */
2248
+ export declare class Xlsx {
2249
+ /**
2250
+ * Reads the file at `filename` into the workbook, in place of what
2251
+ * it held; the workbook. With `{password}` a workbook encrypted with
2252
+ * that password is opened.
2253
+ */
2254
+ readFile(filename: string, options?: Partial<XlsxReadOptions>): Promise<Workbook>
2255
+ /**
2256
+ * Reads the file `data` holds into the workbook, in place of what
2257
+ * it held; the workbook. With `{base64: true}` the data is the file
2258
+ * in Base64; with `{password}` a workbook encrypted with that
2259
+ * password is opened.
2260
+ */
2261
+ load(data: Buffer, options?: Partial<XlsxReadOptions>): Promise<Workbook>
2262
+ /**
2263
+ * The workbook as an .xlsx file's bytes; with `{password}` the file
2264
+ * is encrypted with it, with `{calculate: true}` (or a calculation's
2265
+ * options) the workbook is calculated first, on the caller's thread.
2266
+ */
2267
+ writeBuffer(options?: Partial<XlsxWriteOptions>): Promise<Buffer>
2268
+ /**
2269
+ * Writes the workbook to the file at `filename`, whose extension
2270
+ * names the kind of file. The file is written beside its target and
2271
+ * put in its place when it is whole; with `{password}` it is
2272
+ * encrypted with it, with `{calculate: true}` (or a calculation's
2273
+ * options) the workbook is calculated first, on the caller's thread.
2274
+ */
2275
+ writeFile(filename: string, options?: Partial<XlsxWriteOptions>): Promise<void>
2276
+ }
2277
+
2278
+ /**
2279
+ * The engine's version: the one every crate of the workspace, the npm
2280
+ * package, the wheel and `lexax --version` carry.
2281
+ */
2282
+ export declare function version(): string