@rosperitus/excelerate 0.14.0 → 0.16.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/README.md +161 -9
- package/excelerate.d.ts +339 -8
- package/excelerate.js +343 -4
- package/excelerate_bg.wasm +0 -0
- package/index.d.ts +161 -0
- package/index.js +411 -0
- package/package.json +25 -5
- package/web/excelerate.d.ts +1508 -0
- package/web/excelerate.js +2681 -0
- package/web/excelerate_bg.wasm +0 -0
- package/web/excelerate_bg.wasm.d.ts +160 -0
- package/web/index.d.ts +162 -0
- package/web/index.js +408 -0
- package/web/package.json +4 -0
package/excelerate.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* A style to write, as `setCellStyle` takes it. Every field is optional and
|
|
6
|
-
* what is left out keeps the value the cell had, so `{ font: { bold: true } }`
|
|
7
|
-
* makes a cell bold without touching its number format.
|
|
8
|
-
*/
|
|
9
4
|
/**
|
|
10
5
|
* What `setDocumentProperties` takes: a named field is set, `null` clears it,
|
|
11
6
|
* a missing one stays. `custom` replaces the whole list; `type` is optional.
|
|
@@ -15,6 +10,11 @@ Record<Exclude<keyof DocumentProperties, "custom">, string | null>
|
|
|
15
10
|
> & {
|
|
16
11
|
custom?: { name: string; value: string | number | boolean; type?: CustomProperty["type"] }[];
|
|
17
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* A style to write, as `setCellStyle` takes it. Every field is optional and
|
|
15
|
+
* what is left out keeps the value the cell had, so `{ font: { bold: true } }`
|
|
16
|
+
* makes a cell bold without touching its number format.
|
|
17
|
+
*/
|
|
18
18
|
export interface CellStylePatch {
|
|
19
19
|
numberFormat?: string;
|
|
20
20
|
font?: Partial<{
|
|
@@ -63,6 +63,103 @@ export interface RangeStylesPatch {
|
|
|
63
63
|
styles: CellStylePatch[];
|
|
64
64
|
grid: (number | null)[][];
|
|
65
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* A colour to draw with: `#RRGGBB`, `#AARRGGBB` (the alpha is the opacity) or
|
|
68
|
+
* a theme colour by name - `accent1` to `accent6`, `tx1`, `tx2`, `bg1`,
|
|
69
|
+
* `bg2`, `hlink`, `folHlink` - which follows the workbook's theme.
|
|
70
|
+
*/
|
|
71
|
+
export type DrawingColorInput = string;
|
|
72
|
+
/** A fill to write: the form `shapes` reads, without `other`. */
|
|
73
|
+
export type DrawingFillInput =
|
|
74
|
+
| { type: "none" }
|
|
75
|
+
| { type: "solid"; color: DrawingColorInput }
|
|
76
|
+
| {
|
|
77
|
+
type: "gradient";
|
|
78
|
+
stops: { position: number; color: DrawingColorInput }[];
|
|
79
|
+
angle?: number | null;
|
|
80
|
+
path?: "shape" | "circle" | "rect" | null;
|
|
81
|
+
}
|
|
82
|
+
| { type: "pattern"; preset?: string | null; foreground?: DrawingColorInput; background?: DrawingColorInput };
|
|
83
|
+
/**
|
|
84
|
+
* Fill and outline to lay over an object's own: a field left out stays,
|
|
85
|
+
* `null` gives it back to the style. `line.width` is in points.
|
|
86
|
+
*/
|
|
87
|
+
export interface DrawingFormatPatch {
|
|
88
|
+
fill?: DrawingFillInput | null;
|
|
89
|
+
line?: { fill?: DrawingFillInput | null; width?: number | null } | null;
|
|
90
|
+
}
|
|
91
|
+
/** What `setShapeFormat` takes. `rotation` is in degrees clockwise. */
|
|
92
|
+
export interface ShapeFormatPatch extends DrawingFormatPatch {
|
|
93
|
+
font?: Pick<RunFont, "name" | "size" | "bold" | "italic" | "color">;
|
|
94
|
+
rotation?: number;
|
|
95
|
+
flipH?: boolean;
|
|
96
|
+
flipV?: boolean;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* What a table column keeps, as `setTableFilter` takes it: the shown values,
|
|
100
|
+
* one or two comparisons, or the largest or smallest few.
|
|
101
|
+
*/
|
|
102
|
+
export type TableFilter =
|
|
103
|
+
| { values: (string | number)[]; blank?: boolean }
|
|
104
|
+
| { custom: { op: "=" | "<>" | ">" | ">=" | "<" | "<="; value: string | number }[]; and?: boolean }
|
|
105
|
+
| { top: number; percent?: boolean }
|
|
106
|
+
| { bottom: number; percent?: boolean };
|
|
107
|
+
/** What `setChartFormat` takes: the chart area and the plot area. */
|
|
108
|
+
export interface ChartFormatPatch {
|
|
109
|
+
format?: DrawingFormatPatch | null;
|
|
110
|
+
plotFormat?: DrawingFormatPatch | null;
|
|
111
|
+
}
|
|
112
|
+
/** What `removeDuplicates` did. */
|
|
113
|
+
export interface DuplicatesRemoved {
|
|
114
|
+
/** Rows dropped as repeats of a row above them. */
|
|
115
|
+
removed: number;
|
|
116
|
+
/** Data rows left, the header not counted. */
|
|
117
|
+
remaining: number;
|
|
118
|
+
}
|
|
119
|
+
/** How `removeDuplicates` compares rows. */
|
|
120
|
+
export interface RemoveDuplicatesOptions {
|
|
121
|
+
/** 1-based sheet columns to compare; every column of the range when left out. */
|
|
122
|
+
columns?: number[];
|
|
123
|
+
/** The first row is a header: it stays and is not compared. */
|
|
124
|
+
header?: boolean;
|
|
125
|
+
}
|
|
126
|
+
/** How `textToColumns` cuts text: by `delimiters` or, when given, by `widths`. */
|
|
127
|
+
export interface TextToColumnsOptions {
|
|
128
|
+
/** Delimiter characters, each one a delimiter: `";"`, `",\t"`. A tab when left out. */
|
|
129
|
+
delimiters?: string;
|
|
130
|
+
/** Character positions to cut before, for fixed width. */
|
|
131
|
+
widths?: number[];
|
|
132
|
+
/** A run of delimiters counts as one. */
|
|
133
|
+
mergeConsecutive?: boolean;
|
|
134
|
+
/** The quote inside which delimiters are text; `"` when left out, `null` for none. */
|
|
135
|
+
qualifier?: string | null;
|
|
136
|
+
/** The first cell written; the range's own first cell when left out. */
|
|
137
|
+
destination?: string;
|
|
138
|
+
}
|
|
139
|
+
/** A rule for `addDataValidation`. Formulas are written for the first cell of `sqref`. */
|
|
140
|
+
export interface NewDataValidation {
|
|
141
|
+
/** The cells, space-separated: `"B2:B100"`, `"B2:B9 D2:D9"`. */
|
|
142
|
+
sqref: string;
|
|
143
|
+
type: "whole" | "decimal" | "list" | "date" | "time" | "textLength" | "custom";
|
|
144
|
+
operator?:
|
|
145
|
+
| "between" | "notBetween" | "equal" | "notEqual"
|
|
146
|
+
| "greaterThan" | "lessThan" | "greaterThanOrEqual" | "lessThanOrEqual";
|
|
147
|
+
/** First bound, the list (`"\"Yes,No\""` or `"$E$1:$E$5"`) or the custom formula. */
|
|
148
|
+
formula1?: string;
|
|
149
|
+
/** Second bound, for `between` and `notBetween`. */
|
|
150
|
+
formula2?: string;
|
|
151
|
+
/** Empty cells pass. On when left out. */
|
|
152
|
+
allowBlank?: boolean;
|
|
153
|
+
/** The in-cell arrow of a list. On when left out. */
|
|
154
|
+
showDropDown?: boolean;
|
|
155
|
+
showInputMessage?: boolean;
|
|
156
|
+
showErrorMessage?: boolean;
|
|
157
|
+
errorStyle?: "stop" | "warning" | "information";
|
|
158
|
+
errorTitle?: string;
|
|
159
|
+
error?: string;
|
|
160
|
+
promptTitle?: string;
|
|
161
|
+
prompt?: string;
|
|
162
|
+
}
|
|
66
163
|
|
|
67
164
|
|
|
68
165
|
|
|
@@ -194,6 +291,10 @@ export interface SheetChart {
|
|
|
194
291
|
kinds: string[];
|
|
195
292
|
seriesCount: number;
|
|
196
293
|
anchor: ObjectAnchor;
|
|
294
|
+
/** The chart area's fill and outline; `null` leaves them to the chart style. */
|
|
295
|
+
format: DrawingFormat | null;
|
|
296
|
+
/** The plot area's, the same way. */
|
|
297
|
+
plotFormat: DrawingFormat | null;
|
|
197
298
|
}
|
|
198
299
|
/** A picture on the sheet, as `images` returns it. Bytes come from `imageData`. */
|
|
199
300
|
export interface SheetImage {
|
|
@@ -210,6 +311,45 @@ export interface SheetShape {
|
|
|
210
311
|
geometry: string | null;
|
|
211
312
|
text: string;
|
|
212
313
|
anchor: ObjectAnchor;
|
|
314
|
+
/** Degrees clockwise about the centre. */
|
|
315
|
+
rotation: number;
|
|
316
|
+
/** Mirrored left to right, before it is turned. */
|
|
317
|
+
flipH: boolean;
|
|
318
|
+
/** Mirrored top to bottom, before it is turned. */
|
|
319
|
+
flipV: boolean;
|
|
320
|
+
/** What Excel fills it with: its own, else its style's. */
|
|
321
|
+
fill: DrawingFill;
|
|
322
|
+
/** Its outline, the same way. */
|
|
323
|
+
line: DrawingLine;
|
|
324
|
+
/** The font of its text as the first run states it, the colour from the style if not. */
|
|
325
|
+
font: RunFont;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* A colour of a drawing, resolved through the workbook theme to `#AARRGGBB` (`FF` for opaque);
|
|
329
|
+
* `null` for one no theme defines.
|
|
330
|
+
*/
|
|
331
|
+
export type DrawingColor = string | null;
|
|
332
|
+
/** How a drawing object or chart area is filled. `position` is in percent, `angle` in degrees. */
|
|
333
|
+
export type DrawingFill =
|
|
334
|
+
| { type: "none" }
|
|
335
|
+
| { type: "solid"; color: DrawingColor }
|
|
336
|
+
| {
|
|
337
|
+
type: "gradient";
|
|
338
|
+
stops: { position: number; color: DrawingColor }[];
|
|
339
|
+
angle: number | null;
|
|
340
|
+
path: "shape" | "circle" | "rect" | null;
|
|
341
|
+
}
|
|
342
|
+
| { type: "pattern"; preset: string | null; foreground: DrawingColor; background: DrawingColor }
|
|
343
|
+
| { type: "other" };
|
|
344
|
+
/** An outline: `fill` is `null` and `width` (points) is `null` where the file is silent. */
|
|
345
|
+
export interface DrawingLine {
|
|
346
|
+
fill: DrawingFill | null;
|
|
347
|
+
width: number | null;
|
|
348
|
+
}
|
|
349
|
+
/** The fill and outline an element states; `null` in either leaves it to the style. */
|
|
350
|
+
export interface DrawingFormat {
|
|
351
|
+
fill: DrawingFill | null;
|
|
352
|
+
line: DrawingLine | null;
|
|
213
353
|
}
|
|
214
354
|
/**
|
|
215
355
|
* A colour as the file states it: `null` when the file leaves it to the
|
|
@@ -272,6 +412,31 @@ export interface RangeStyles {
|
|
|
272
412
|
styles: CellStyle[];
|
|
273
413
|
grid: number[][];
|
|
274
414
|
}
|
|
415
|
+
/** Limits for `goalSeek`; the workbook's iteration settings when left out. */
|
|
416
|
+
export interface GoalSeekOptions {
|
|
417
|
+
maxIterations?: number;
|
|
418
|
+
tolerance?: number;
|
|
419
|
+
}
|
|
420
|
+
/** How `goalSeek` ended. */
|
|
421
|
+
export interface GoalSeekResult {
|
|
422
|
+
/** The value left in the changing cell: the best one tried. */
|
|
423
|
+
value: number;
|
|
424
|
+
/** What the set cell computes with it; `null` when that is not a number. */
|
|
425
|
+
result: number | null;
|
|
426
|
+
/** How many times the set cell was computed. */
|
|
427
|
+
iterations: number;
|
|
428
|
+
/** Whether `result` is within the tolerance of the target. */
|
|
429
|
+
converged: boolean;
|
|
430
|
+
}
|
|
431
|
+
/** The rule a value breaks, as `checkValidation` reports it. */
|
|
432
|
+
export interface ValidationProblem {
|
|
433
|
+
/** How Excel reports it: `stop` refuses the entry, the others only warn. */
|
|
434
|
+
style: "stop" | "warning" | "information";
|
|
435
|
+
title: string;
|
|
436
|
+
/** The rule's own message; empty when it has none. */
|
|
437
|
+
message: string;
|
|
438
|
+
sqref: string[];
|
|
439
|
+
}
|
|
275
440
|
|
|
276
441
|
|
|
277
442
|
|
|
@@ -285,6 +450,20 @@ export class Book {
|
|
|
285
450
|
* The tab a reader opens the workbook on.
|
|
286
451
|
*/
|
|
287
452
|
activeSheet(): number;
|
|
453
|
+
/**
|
|
454
|
+
* Adds a data validation rule to a sheet, as Data - Data Validation
|
|
455
|
+
* does: `type` is `"whole"`, `"decimal"`, `"list"`, `"date"`, `"time"`,
|
|
456
|
+
* `"textLength"` or `"custom"`, `operator` one of `"between"` (the
|
|
457
|
+
* default), `"notBetween"`, `"equal"`, `"notEqual"`, `"greaterThan"`,
|
|
458
|
+
* `"lessThan"`, `"greaterThanOrEqual"`, `"lessThanOrEqual"`. Formulas are
|
|
459
|
+
* written for the first cell of `sqref`; a list is `"\"Yes,No\""` or a
|
|
460
|
+
* range such as `"$E$1:$E$5"`.
|
|
461
|
+
*
|
|
462
|
+
* ```js
|
|
463
|
+
* book.addDataValidation(0, { sqref: "B2:B100", type: "list", formula1: "\"Yes,No\"" });
|
|
464
|
+
* ```
|
|
465
|
+
*/
|
|
466
|
+
addDataValidation(sheet: number, rule: NewDataValidation): void;
|
|
288
467
|
/**
|
|
289
468
|
* Appends a sheet and returns its index.
|
|
290
469
|
*/
|
|
@@ -352,6 +531,17 @@ export class Book {
|
|
|
352
531
|
* `barChart`, `lineChart` - and a combination chart has more than one.
|
|
353
532
|
*/
|
|
354
533
|
charts(sheet: number): SheetChart[];
|
|
534
|
+
/**
|
|
535
|
+
* Whether `value` would be accepted in a cell under its data validation
|
|
536
|
+
* rule: `null` when it would (or there is no rule), otherwise what Excel
|
|
537
|
+
* would report, `{ style, title, message, sqref }`.
|
|
538
|
+
*
|
|
539
|
+
* ```js
|
|
540
|
+
* const problem = book.checkValidation(0, "B5", 150);
|
|
541
|
+
* if (problem) alert(problem.message || "Not allowed");
|
|
542
|
+
* ```
|
|
543
|
+
*/
|
|
544
|
+
checkValidation(sheet: number, address: string, value: CellValue): ValidationProblem | null;
|
|
355
545
|
/**
|
|
356
546
|
* Empties a cell, style and all.
|
|
357
547
|
*/
|
|
@@ -431,6 +621,19 @@ export class Book {
|
|
|
431
621
|
* last cells.
|
|
432
622
|
*/
|
|
433
623
|
fillSeries(sheet: number, range: string, direction: "down" | "right" | "up" | "left"): void;
|
|
624
|
+
/**
|
|
625
|
+
* Reads a workbook and hands sheet `sheet` over row by row, without
|
|
626
|
+
* building its grid: `callback(row, data)` gets the 1-based row number
|
|
627
|
+
* and what `getRowAt` would answer for it, and the row is dropped once
|
|
628
|
+
* the callback returns.
|
|
629
|
+
*
|
|
630
|
+
* The workbook comes back whole but for that sheet's cells. Only xlsx
|
|
631
|
+
* streams; any other format is read whole and then handed over the same
|
|
632
|
+
* way, so the callback sees the same rows but nothing is saved.
|
|
633
|
+
* A callback that throws is not called again, and what it threw comes
|
|
634
|
+
* out of `forEachRow` once the read is over.
|
|
635
|
+
*/
|
|
636
|
+
static forEachRow(bytes: Uint8Array, name: string | null | undefined, sheet: number, callback: Function, formatted?: boolean | null): Book;
|
|
434
637
|
/**
|
|
435
638
|
* Freezes the first `rows` rows and `columns` columns, so they stay put
|
|
436
639
|
* while the rest scrolls. `freezePanes(0, 1, 0)` pins the header row;
|
|
@@ -508,6 +711,19 @@ export class Book {
|
|
|
508
711
|
* `null`; `getFormattedAt` still answers for the cells that need it.
|
|
509
712
|
*/
|
|
510
713
|
getRowAt(sheet: number, row: number, formatted?: boolean | null): SheetRow;
|
|
714
|
+
/**
|
|
715
|
+
* Finds the value of `changing` that makes the formula in `set` compute
|
|
716
|
+
* `target`, as Excel's Goal Seek does, both cells on `sheet`. The best
|
|
717
|
+
* value found is left in `changing` and what reads it is recomputed.
|
|
718
|
+
* `options.maxIterations` and `options.tolerance` default to the
|
|
719
|
+
* workbook's own iteration settings (100 and 0.001 unless it says
|
|
720
|
+
* otherwise). Returns `{ value, result, iterations, converged }`.
|
|
721
|
+
*
|
|
722
|
+
* ```js
|
|
723
|
+
* const { value, converged } = book.goalSeek(0, "B4", 300, "B1");
|
|
724
|
+
* ```
|
|
725
|
+
*/
|
|
726
|
+
goalSeek(sheet: number, set: string, target: number, changing: string, options?: GoalSeekOptions): GoalSeekResult;
|
|
511
727
|
/**
|
|
512
728
|
* The hyperlinks of a sheet. `external` tells a URL from a jump inside
|
|
513
729
|
* the workbook.
|
|
@@ -533,6 +749,10 @@ export class Book {
|
|
|
533
749
|
* `copyOrigin` works as in `insertRows`, with left and right.
|
|
534
750
|
*/
|
|
535
751
|
insertColumns(sheet: number, at: number, count: number, copyOrigin?: "before" | "after" | "none"): void;
|
|
752
|
+
/**
|
|
753
|
+
* `insertRowsMany` for columns.
|
|
754
|
+
*/
|
|
755
|
+
insertColumnsMany(sheet: number, places: [number, number][], copyOrigin?: "before" | "after" | "none"): void;
|
|
536
756
|
/**
|
|
537
757
|
* Inserts `count` rows above row `at`, moving everything below down.
|
|
538
758
|
* `copyOrigin` - `"before"` (the row above), `"after"` (the row below)
|
|
@@ -544,6 +764,23 @@ export class Book {
|
|
|
544
764
|
* a user sees.
|
|
545
765
|
*/
|
|
546
766
|
insertRows(sheet: number, at: number, count: number, copyOrigin?: "before" | "after" | "none"): void;
|
|
767
|
+
/**
|
|
768
|
+
* Inserts rows at many places in one pass: `places` is `[at, count]`
|
|
769
|
+
* pairs, numbered as the sheet is before the call, in any order.
|
|
770
|
+
* `book.insertRowsMany(0, [[5, 1], [9, 1]])` puts a row above each of
|
|
771
|
+
* rows 5 and 9 - the old row 9, now row 10. Each new block takes its
|
|
772
|
+
* formatting from its own neighbour, as `copyOrigin` says.
|
|
773
|
+
*
|
|
774
|
+
* The result is that of the single inserts made from the bottom up, but
|
|
775
|
+
* the workbook is walked once rather than once per place: four thousand
|
|
776
|
+
* subtotal rows into forty thousand take milliseconds, not a minute.
|
|
777
|
+
*/
|
|
778
|
+
insertRowsMany(sheet: number, places: [number, number][], copyOrigin?: "before" | "after" | "none"): void;
|
|
779
|
+
/**
|
|
780
|
+
* The cells of a sheet whose values break their data validation rule,
|
|
781
|
+
* as Excel's Circle Invalid Data finds them: `["B3", "B9"]`.
|
|
782
|
+
*/
|
|
783
|
+
invalidCells(sheet: number): string[];
|
|
547
784
|
/**
|
|
548
785
|
* Merges a block of cells: `merge(0, "A1:C1")`.
|
|
549
786
|
*/
|
|
@@ -605,9 +842,11 @@ export class Book {
|
|
|
605
842
|
*
|
|
606
843
|
* `name` is the file name they came from, if the caller has one: it
|
|
607
844
|
* settles what the bytes cannot say (a `.csv` against a `.html`) and names
|
|
608
|
-
* the sheet of a SYLK file.
|
|
845
|
+
* the sheet of a SYLK file. `password` opens a workbook saved with a
|
|
846
|
+
* password to open; without it only one encrypted to be opened
|
|
847
|
+
* read-only reads.
|
|
609
848
|
*/
|
|
610
|
-
static read(bytes: Uint8Array, name?: string | null, max_expanded?: number | null, on_progress?: Function | null): Book;
|
|
849
|
+
static read(bytes: Uint8Array, name?: string | null, max_expanded?: number | null, on_progress?: Function | null, password?: string | null): Book;
|
|
611
850
|
/**
|
|
612
851
|
* Reads CSV with the guesses overridden: the delimiter, whether a row
|
|
613
852
|
* that produced no cell is skipped, whether an empty field becomes an
|
|
@@ -689,6 +928,10 @@ export class Book {
|
|
|
689
928
|
* Removes `count` columns from column `at`, 1-based.
|
|
690
929
|
*/
|
|
691
930
|
removeColumns(sheet: number, at: number, count: number): void;
|
|
931
|
+
/**
|
|
932
|
+
* `removeRowsMany` for columns.
|
|
933
|
+
*/
|
|
934
|
+
removeColumnsMany(sheet: number, places: [number, number][]): void;
|
|
692
935
|
/**
|
|
693
936
|
* Takes a note off a cell. Answers whether there was one.
|
|
694
937
|
*/
|
|
@@ -697,6 +940,19 @@ export class Book {
|
|
|
697
940
|
* Removes a defined name. Answers whether there was one.
|
|
698
941
|
*/
|
|
699
942
|
removeDefinedName(name: string, sheet?: number | null): boolean;
|
|
943
|
+
/**
|
|
944
|
+
* Removes the rows of a range that repeat a row above them, as Excel's
|
|
945
|
+
* Remove Duplicates does: cells are compared by the text they show,
|
|
946
|
+
* without regard to case. `options.columns` are the 1-based sheet
|
|
947
|
+
* columns compared (all of the range when left out), and
|
|
948
|
+
* `options.header` keeps the first row out of it. Returns
|
|
949
|
+
* `{ removed, remaining }`.
|
|
950
|
+
*
|
|
951
|
+
* ```js
|
|
952
|
+
* book.removeDuplicates(0, "A1:C500", { columns: [1, 3], header: true });
|
|
953
|
+
* ```
|
|
954
|
+
*/
|
|
955
|
+
removeDuplicates(sheet: number, range: string, options?: RemoveDuplicatesOptions): DuplicatesRemoved;
|
|
700
956
|
/**
|
|
701
957
|
* Takes the link off a range. Answers whether there was one.
|
|
702
958
|
*/
|
|
@@ -706,6 +962,11 @@ export class Book {
|
|
|
706
962
|
* cell reads `#REF!` afterwards.
|
|
707
963
|
*/
|
|
708
964
|
removeRows(sheet: number, at: number, count: number): void;
|
|
965
|
+
/**
|
|
966
|
+
* Removes rows at many places in one pass: `[at, count]` pairs, numbered
|
|
967
|
+
* as the sheet is before the call. Blocks that overlap are merged.
|
|
968
|
+
*/
|
|
969
|
+
removeRowsMany(sheet: number, places: [number, number][]): void;
|
|
709
970
|
/**
|
|
710
971
|
* Removes a sheet. References to it from anywhere in the workbook become
|
|
711
972
|
* `#REF!`, the way Excel writes them, and the sheets after it shift down
|
|
@@ -770,6 +1031,13 @@ export class Book {
|
|
|
770
1031
|
* The same by 1-based row and column.
|
|
771
1032
|
*/
|
|
772
1033
|
setCellStyleAt(sheet: number, row: number, column: number, patch: CellStylePatch): void;
|
|
1034
|
+
/**
|
|
1035
|
+
* Changes the fill and outline of a chart's chart area (`format`) and
|
|
1036
|
+
* plot area (`plotFormat`), by its position in `charts`; each takes
|
|
1037
|
+
* `{ fill, line }` as `setShapeFormat` does, or `null` to leave the area
|
|
1038
|
+
* to the chart style.
|
|
1039
|
+
*/
|
|
1040
|
+
setChartFormat(sheet: number, index: number, patch: ChartFormatPatch): void;
|
|
773
1041
|
/**
|
|
774
1042
|
* Hides a column, or shows it again. `column` is 1-based.
|
|
775
1043
|
*/
|
|
@@ -852,6 +1120,26 @@ export class Book {
|
|
|
852
1120
|
* Hides a row, or shows it again.
|
|
853
1121
|
*/
|
|
854
1122
|
setRowHidden(sheet: number, row: number, hidden: boolean): void;
|
|
1123
|
+
/**
|
|
1124
|
+
* Changes how a shape looks, by its position in `shapes`:
|
|
1125
|
+
*
|
|
1126
|
+
* ```js
|
|
1127
|
+
* book.setShapeFormat(0, 2, {
|
|
1128
|
+
* fill: { type: "solid", color: "accent2" },
|
|
1129
|
+
* line: { width: 2 },
|
|
1130
|
+
* font: { bold: true, color: "#FFFFFFFF" },
|
|
1131
|
+
* rotation: 15,
|
|
1132
|
+
* });
|
|
1133
|
+
* ```
|
|
1134
|
+
*
|
|
1135
|
+
* `fill`, `line`, `font`, `rotation` (degrees clockwise), `flipH` and
|
|
1136
|
+
* `flipV`; a field left out stays as it was, `null` for `fill` or `line`
|
|
1137
|
+
* gives it back to the shape's style. A colour is `#RRGGBB`,
|
|
1138
|
+
* `#AARRGGBB` or a theme colour by name (`accent1`, `tx1`, `bg2`), which
|
|
1139
|
+
* follows the theme. The rest of the shape - effects, other runs, the
|
|
1140
|
+
* outline's dashes - stays in the file as it was.
|
|
1141
|
+
*/
|
|
1142
|
+
setShapeFormat(sheet: number, index: number, patch: ShapeFormatPatch): void;
|
|
855
1143
|
/**
|
|
856
1144
|
* Gives a sheet a tab or takes it away: `"visible"`, `"hidden"` or
|
|
857
1145
|
* `"veryHidden"`.
|
|
@@ -866,13 +1154,32 @@ export class Book {
|
|
|
866
1154
|
* `headers`.
|
|
867
1155
|
*/
|
|
868
1156
|
setShowGridLines(sheet: number, show: boolean, headers?: boolean | null): void;
|
|
1157
|
+
/**
|
|
1158
|
+
* Filters a table by one of its columns, named by its header or
|
|
1159
|
+
* numbered from 1, and hides the data rows the table's criteria reject,
|
|
1160
|
+
* as Excel does. `null` takes the column's criterion off.
|
|
1161
|
+
*
|
|
1162
|
+
* ```js
|
|
1163
|
+
* book.setTableFilter("Sales", "Region", { values: ["South", "West"] });
|
|
1164
|
+
* book.setTableFilter("Sales", "Amount", { custom: [{ op: ">", value: 100 }] });
|
|
1165
|
+
* book.setTableFilter("Sales", 3, { top: 5 }); // or { bottom: 10, percent: true }
|
|
1166
|
+
* ```
|
|
1167
|
+
*
|
|
1168
|
+
* `values` keeps a row whose cell shows one of them, `blank: true` the
|
|
1169
|
+
* empty ones too; `custom` takes one or two comparisons (`=`, `<>`, `>`,
|
|
1170
|
+
* `>=`, `<`, `<=`; `*` and `?` in `=` and `<>`), joined by `or` unless
|
|
1171
|
+
* `and` is set. Criteria on several columns all have to hold.
|
|
1172
|
+
*/
|
|
1173
|
+
setTableFilter(name: string, column: string | number, criteria: TableFilter | null): void;
|
|
869
1174
|
/**
|
|
870
1175
|
* The zoom a reader opens the sheet at, in percent; `undefined` gives it
|
|
871
1176
|
* back to 100.
|
|
872
1177
|
*/
|
|
873
1178
|
setZoom(sheet: number, percent?: number | null): void;
|
|
874
1179
|
/**
|
|
875
|
-
* The drawn shapes of a sheet, text and all
|
|
1180
|
+
* The drawn shapes of a sheet, text and all, with the look Excel shows:
|
|
1181
|
+
* fill, outline and font are the shape's own with its style filling in
|
|
1182
|
+
* the rest, colours resolved through the workbook theme.
|
|
876
1183
|
*/
|
|
877
1184
|
shapes(sheet: number): SheetShape[];
|
|
878
1185
|
/**
|
|
@@ -922,6 +1229,25 @@ export class Book {
|
|
|
922
1229
|
* names.
|
|
923
1230
|
*/
|
|
924
1231
|
tables(sheet: number): SheetTable[];
|
|
1232
|
+
/**
|
|
1233
|
+
* Splits the text of each cell in the first column of `range` across
|
|
1234
|
+
* the columns to its right, as Excel's Text to Columns does. Pieces that
|
|
1235
|
+
* read as numbers, booleans or errors become them. Returns how many
|
|
1236
|
+
* columns the widest row took.
|
|
1237
|
+
*
|
|
1238
|
+
* `options.delimiters` is a string of delimiter characters (`";"`,
|
|
1239
|
+
* `",\t"`), or `options.widths` the character positions to cut before
|
|
1240
|
+
* for fixed width; `mergeConsecutive` treats a run of delimiters as one,
|
|
1241
|
+
* `qualifier` is the quote (`"` unless given; `null` for none), and
|
|
1242
|
+
* `destination` is the first cell written (the range's own when left
|
|
1243
|
+
* out).
|
|
1244
|
+
*
|
|
1245
|
+
* ```js
|
|
1246
|
+
* book.textToColumns(0, "A2:A100", { delimiters: ";" });
|
|
1247
|
+
* book.textToColumns(0, "A2:A100", { widths: [4, 10], destination: "C2" });
|
|
1248
|
+
* ```
|
|
1249
|
+
*/
|
|
1250
|
+
textToColumns(sheet: number, range: string, options: TextToColumnsOptions): number;
|
|
925
1251
|
/**
|
|
926
1252
|
* One sheet as CSV, comma-separated unless `options.delimiter` says
|
|
927
1253
|
* otherwise - a semicolon for a locale where the comma is the decimal
|
|
@@ -979,6 +1305,11 @@ export class Book {
|
|
|
979
1305
|
* removed, and walks the rows after that to give the exact rectangle.
|
|
980
1306
|
*/
|
|
981
1307
|
usedRangeHint(sheet: number): string | undefined;
|
|
1308
|
+
/**
|
|
1309
|
+
* The choices of the drop-down list on a cell, as Excel shows them; an
|
|
1310
|
+
* empty array when the cell has no list rule.
|
|
1311
|
+
*/
|
|
1312
|
+
validationList(sheet: number, address: string): string[];
|
|
982
1313
|
/**
|
|
983
1314
|
* Whether that password unlocks the sheet. `false` for a sheet with no
|
|
984
1315
|
* password on it, and for a hash this crate cannot check.
|