@rosperitus/excelerate 0.11.0 → 0.12.3

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/excelerate.d.ts CHANGED
@@ -1,6 +1,62 @@
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
+ export interface CellStylePatch {
10
+ numberFormat?: string;
11
+ font?: Partial<{
12
+ name: string;
13
+ size: number;
14
+ bold: boolean;
15
+ italic: boolean;
16
+ underline: string;
17
+ strike: boolean;
18
+ color: StyleColor;
19
+ }>;
20
+ fill?: Partial<{ pattern: string; foreground: StyleColor; background: StyleColor }>;
21
+ borders?: Partial<{
22
+ left: Partial<BorderSide>;
23
+ right: Partial<BorderSide>;
24
+ top: Partial<BorderSide>;
25
+ bottom: Partial<BorderSide>;
26
+ }>;
27
+ alignment?: Partial<{
28
+ horizontal: string | null;
29
+ vertical: string | null;
30
+ wrapText: boolean;
31
+ shrinkToFit: boolean;
32
+ indent: number;
33
+ textRotation: number;
34
+ }>;
35
+ }
36
+ /**
37
+ * Sort keys: a 1-based column number of the sheet (a row number when sorting
38
+ * columns) or a header's text; a minus in front sorts largest first.
39
+ */
40
+ export type SortKeys = (number | string)[];
41
+ /** How `sortRange` reads its range. */
42
+ export interface SortRangeOptions {
43
+ /** The first row (or column) is a header: it stays put and names keys. */
44
+ header?: boolean;
45
+ /** Reorder columns left to right instead of rows. */
46
+ byColumns?: boolean;
47
+ }
48
+ /**
49
+ * Styles to write over a rectangle, as `setRangeStyles` takes them: `grid`
50
+ * points into `styles`, and `null` or `-1` leaves its cell as it is. What
51
+ * `getRangeStyles` returns fits here unchanged.
52
+ */
53
+ export interface RangeStylesPatch {
54
+ styles: CellStylePatch[];
55
+ grid: (number | null)[][];
56
+ }
57
+
58
+
59
+
4
60
  /** What a cell can hold on the JS side. An error cell reads as its code, `#DIV/0!`. */
5
61
  export type CellValue = number | string | boolean | null;
6
62
  /** A rectangle of cells, row by row, as `getRange` returns it. */
@@ -16,6 +72,109 @@ export interface SheetRow {
16
72
  indent: Uint32Array;
17
73
  hidden: boolean;
18
74
  }
75
+ /** Where a drawing object sits, in the 1-based numbers a user sees. */
76
+ export interface ObjectAnchor {
77
+ kind: "twoCell" | "oneCell" | "absolute";
78
+ row: number | null;
79
+ column: number | null;
80
+ }
81
+ /** How a sheet is frozen and shown, as `sheetView` returns it. */
82
+ export interface SheetViewInfo {
83
+ frozenRows: number;
84
+ frozenColumns: number;
85
+ zoom: number | null;
86
+ showGridLines: boolean;
87
+ showRowColHeaders: boolean;
88
+ rightToLeft: boolean;
89
+ topLeftCell: string | null;
90
+ }
91
+ /** A name that stands for a formula, as `definedNames` returns it. */
92
+ export interface WorkbookName {
93
+ name: string;
94
+ formula: string;
95
+ sheet: number | null;
96
+ hidden: boolean;
97
+ }
98
+ /** A rule limiting what a cell accepts, as `dataValidations` returns it. */
99
+ export interface SheetValidation {
100
+ sqref: string[];
101
+ type: string;
102
+ operator: string;
103
+ formula1: string;
104
+ formula2: string;
105
+ allowBlank: boolean;
106
+ showDropDown: boolean;
107
+ }
108
+ /** One conditional formatting block, as `conditionalFormats` returns it. */
109
+ export interface SheetConditionalFormat {
110
+ sqref: string[];
111
+ rules: { type: string; priority: number; operator: string | null; formulas: string[]; text: string | null }[];
112
+ }
113
+ /** The autofilter over a range, as `autoFilter` returns it. */
114
+ export interface SheetAutoFilter {
115
+ range: string;
116
+ columns: { colId: number; kind: "values" | "custom" | "dynamic" | "top10" | "none" }[];
117
+ }
118
+ /** A pivot report on the sheet, as `pivotTables` returns it. */
119
+ export interface SheetPivotTable {
120
+ name: string;
121
+ location: string | null;
122
+ cacheId: number;
123
+ rowFields: number;
124
+ columnFields: number;
125
+ valueFields: number;
126
+ }
127
+ /** How a sheet or the workbook is locked, as `sheetProtection` returns it. */
128
+ export interface ProtectionInfo { locked: boolean; hasPassword: boolean }
129
+ /** How `toCsv` writes, and how `Book.readCsv` reads. */
130
+ export interface CsvOptions {
131
+ delimiter?: string;
132
+ contiguous?: boolean;
133
+ preserveEmptyFields?: boolean;
134
+ }
135
+ /** A note on a cell, as `comments` returns it. */
136
+ export interface SheetComment { address: string; author: string; text: string }
137
+ /** A link over a cell or a block of them, as `hyperlinks` returns it. */
138
+ export interface SheetHyperlink {
139
+ range: string;
140
+ target: string;
141
+ external: boolean;
142
+ display: string | null;
143
+ tooltip: string | null;
144
+ }
145
+ /** A table over a block of cells, as `tables` returns it. */
146
+ export interface SheetTable {
147
+ name: string;
148
+ displayName: string;
149
+ range: string;
150
+ headerRowCount: number | null;
151
+ totalsRowCount: number | null;
152
+ columns: string[];
153
+ }
154
+ /** A chart on the sheet, as `charts` returns it. */
155
+ export interface SheetChart {
156
+ name: string;
157
+ title: string | null;
158
+ kinds: string[];
159
+ seriesCount: number;
160
+ anchor: ObjectAnchor;
161
+ }
162
+ /** A picture on the sheet, as `images` returns it. Bytes come from `imageData`. */
163
+ export interface SheetImage {
164
+ name: string;
165
+ description: string;
166
+ format: string;
167
+ byteLength: number;
168
+ anchor: ObjectAnchor;
169
+ }
170
+ /** A drawn shape, as `shapes` returns it. */
171
+ export interface SheetShape {
172
+ name: string;
173
+ description: string;
174
+ geometry: string | null;
175
+ text: string;
176
+ anchor: ObjectAnchor;
177
+ }
19
178
  /**
20
179
  * A colour as the file states it: `null` when the file leaves it to the
21
180
  * reader, `#AARRGGBB` when it names one outright, and `indexed:N` or
@@ -53,6 +212,14 @@ export interface CellStyle {
53
212
  textRotation: number;
54
213
  };
55
214
  }
215
+ /**
216
+ * The styles of a rectangle, as `getRangeStyles` returns them: each distinct
217
+ * style once in `styles`, and `grid` - row by row - pointing into it.
218
+ */
219
+ export interface RangeStyles {
220
+ styles: CellStyle[];
221
+ grid: number[][];
222
+ }
56
223
 
57
224
 
58
225
 
@@ -70,6 +237,24 @@ export class Book {
70
237
  * Appends a sheet and returns its index.
71
238
  */
72
239
  addSheet(title: string): number;
240
+ /**
241
+ * Draws a table over a range, the thing `Sales[Amount]` names.
242
+ *
243
+ * The first row of the range is the header unless `headerRow` says
244
+ * otherwise, and the column names are read from it. The name must be
245
+ * unique in the workbook, as Excel requires.
246
+ */
247
+ addTable(sheet: number, name: string, range: string, header_row?: boolean | null): void;
248
+ /**
249
+ * The array formulas of a sheet, as the areas they cover: `["B2:B4"]`.
250
+ * The formula itself is on the top left cell of each.
251
+ */
252
+ arrayFormulas(sheet: number): string[];
253
+ /**
254
+ * The autofilter over a sheet, or `undefined` when it has none. What the
255
+ * filter hides is a property of each row - see `rowHidden`.
256
+ */
257
+ autoFilter(sheet: number): SheetAutoFilter | undefined;
73
258
  /**
74
259
  * Whether a cell is bold.
75
260
  *
@@ -110,6 +295,11 @@ export class Book {
110
295
  * The same by 1-based row and column.
111
296
  */
112
297
  cellStyleAt(sheet: number, row: number, column: number): CellStyle;
298
+ /**
299
+ * The charts on a sheet. `kinds` names the plots drawn in each -
300
+ * `barChart`, `lineChart` - and a combination chart has more than one.
301
+ */
302
+ charts(sheet: number): SheetChart[];
113
303
  /**
114
304
  * Empties a cell, style and all.
115
305
  */
@@ -122,11 +312,72 @@ export class Book {
122
312
  * The same for a column, named by its letters: `columnLevel(0, "C")`.
123
313
  */
124
314
  columnLevel(sheet: number, column: string): number;
315
+ /**
316
+ * The width of a column in characters, or `undefined` when the sheet
317
+ * leaves it to the default. `column` is 1-based.
318
+ */
319
+ columnWidth(sheet: number, column: number): number | undefined;
320
+ /**
321
+ * The notes on a sheet, in address order.
322
+ */
323
+ comments(sheet: number): SheetComment[];
324
+ /**
325
+ * The conditional formatting of a sheet, block by block. The formatting
326
+ * each rule applies is not modelled here - it lives in the workbook's
327
+ * differential styles - but what the rule tests is.
328
+ */
329
+ conditionalFormats(sheet: number): SheetConditionalFormat[];
330
+ /**
331
+ * Copies a rectangle of cells so its top left corner lands on `to`,
332
+ * rewriting the formulas as Excel rewrites a copied formula: `=A1` one
333
+ * row down reads `=A2`, `$A$1` stays put.
334
+ *
335
+ * `toSheet` defaults to the sheet copied from. A cell the source leaves
336
+ * empty empties the target, the way pasting a block does.
337
+ */
338
+ copyRange(sheet: number, range: string, to: string, to_sheet?: number | null): void;
339
+ /**
340
+ * The rules limiting what cells accept: the dropdown lists, the ranges,
341
+ * the dates.
342
+ */
343
+ dataValidations(sheet: number): SheetValidation[];
344
+ /**
345
+ * The names the workbook defines: what `=Total` and `Print_Area` stand
346
+ * for. `sheet` is set on a name local to one sheet.
347
+ */
348
+ definedNames(): WorkbookName[];
125
349
  /**
126
350
  * Evaluates a formula (with or without the leading `=`) as if it sat in
127
351
  * `address` of `sheet`, and returns its result.
128
352
  */
129
353
  evaluate(sheet: number, address: string, formula: string): CellValue;
354
+ /**
355
+ * The other workbooks this one reads, in the order `[1]Sheet1!A1` counts
356
+ * them. A path is `undefined` where the file does not name one.
357
+ */
358
+ externalBooks(): any[];
359
+ /**
360
+ * Copies the first row of a range into the rows below it, as Ctrl+D.
361
+ */
362
+ fillDown(sheet: number, range: string): void;
363
+ /**
364
+ * Copies the first column of a range into the columns to its right, as
365
+ * Ctrl+R.
366
+ */
367
+ fillRight(sheet: number, range: string): void;
368
+ /**
369
+ * Continues what the first cells of a range start, as dragging the fill
370
+ * handle does: `1, 2` goes on `3, 4`, `Кв1` to `Кв2`, `Jan` to `Feb`, a
371
+ * date by a day; anything else repeats. `"down"` fills each column,
372
+ * `"right"` each row; `"up"` and `"left"` run the series back from the
373
+ * last cells.
374
+ */
375
+ fillSeries(sheet: number, range: string, direction: "down" | "right" | "up" | "left"): void;
376
+ /**
377
+ * Freezes the first `rows` rows and `columns` columns, so they stay put
378
+ * while the rest scrolls. `freezePanes(0, 1, 0)` pins the header row.
379
+ */
380
+ freezePanes(sheet: number, rows: number, columns: number): void;
130
381
  /**
131
382
  * Reads an xlsx package from its bytes.
132
383
  */
@@ -170,6 +421,17 @@ export class Book {
170
421
  * to take. `getRangeAt(0, 1, 1, 3, 2)` is `A1:B3`.
171
422
  */
172
423
  getRangeAt(sheet: number, row: number, column: number, rows: number, columns: number): CellGrid;
424
+ /**
425
+ * The styles of a rectangle in one call: each distinct style once, and a
426
+ * grid of indexes into them. `cellStyle` per cell costs a crossing and a
427
+ * whole style object per cell; a formatted table of ten thousand cells
428
+ * usually has a dozen styles.
429
+ */
430
+ getRangeStyles(sheet: number, range: string): RangeStyles;
431
+ /**
432
+ * The same by numbers, as `getRangeAt` takes them.
433
+ */
434
+ getRangeStylesAt(sheet: number, row: number, column: number, rows: number, columns: number): RangeStyles;
173
435
  /**
174
436
  * A whole row in one crossing of the boundary: values, displayed text,
175
437
  * bold and indent, plus whether the row is hidden.
@@ -183,6 +445,46 @@ export class Book {
183
445
  * `null`; `getFormattedAt` still answers for the cells that need it.
184
446
  */
185
447
  getRowAt(sheet: number, row: number, formatted?: boolean | null): SheetRow;
448
+ /**
449
+ * The hyperlinks of a sheet. `external` tells a URL from a jump inside
450
+ * the workbook.
451
+ */
452
+ hyperlinks(sheet: number): SheetHyperlink[];
453
+ /**
454
+ * The bytes of one picture, by its position in `images`.
455
+ */
456
+ imageData(sheet: number, index: number): Uint8Array;
457
+ /**
458
+ * The pictures on a sheet, without their bytes: `imageData` fetches those
459
+ * for the one that is wanted.
460
+ */
461
+ images(sheet: number): SheetImage[];
462
+ /**
463
+ * Inserts blank cells over a range, pushing what was there `"down"` or
464
+ * `"right"` - Excel's "Insert Cells", which moves part of a row rather
465
+ * than the whole of it. `copyOrigin` works as in `insertRows`.
466
+ */
467
+ insertCells(sheet: number, range: string, shift: string, copyOrigin?: "before" | "after" | "none"): void;
468
+ /**
469
+ * Inserts `count` columns to the left of column `at`, 1-based.
470
+ * `copyOrigin` works as in `insertRows`, with left and right.
471
+ */
472
+ insertColumns(sheet: number, at: number, count: number, copyOrigin?: "before" | "after" | "none"): void;
473
+ /**
474
+ * Inserts `count` rows above row `at`, moving everything below down.
475
+ * `copyOrigin` - `"before"` (the row above), `"after"` (the row below)
476
+ * or `"none"` - says whose formatting the new rows take. Left out, it is
477
+ * `"before"`, as in Excel.
478
+ *
479
+ * Formulas across the whole workbook follow the cells they read, and so
480
+ * do merges, links, validations, tables and drawings. `at` is the number
481
+ * a user sees.
482
+ */
483
+ insertRows(sheet: number, at: number, count: number, copyOrigin?: "before" | "after" | "none"): void;
484
+ /**
485
+ * Merges a block of cells: `merge(0, "A1:C1")`.
486
+ */
487
+ merge(sheet: number, range: string): void;
186
488
  /**
187
489
  * The merged areas of a sheet, as `"A1:C1"` strings in the order the file
188
490
  * lists them.
@@ -196,10 +498,44 @@ export class Book {
196
498
  * carrying three hundred thousand of them needs.
197
499
  */
198
500
  mergedRangesAt(sheet: number): Uint32Array;
501
+ /**
502
+ * Moves a rectangle of cells, leaving the source empty.
503
+ *
504
+ * A moved formula keeps reading the cells it read; the formulas elsewhere
505
+ * that read *these* cells follow them instead, as they do when Excel cuts
506
+ * and pastes.
507
+ */
508
+ moveRange(sheet: number, range: string, to: string, to_sheet?: number | null): void;
509
+ /**
510
+ * Moves a sheet along the tab bar. Formulas are untouched - a sheet is
511
+ * named, not numbered - but every index moves, this one included, so read
512
+ * `sheetIndex` again afterwards.
513
+ */
514
+ moveSheet(from: number, to: number): void;
199
515
  /**
200
516
  * A new workbook with one empty sheet.
201
517
  */
202
518
  constructor();
519
+ /**
520
+ * The pivot reports laid out on a sheet. The numbers they show are cells
521
+ * like any others; this says where a report sits and how wide its axes
522
+ * are.
523
+ */
524
+ pivotTables(sheet: number): SheetPivotTable[];
525
+ /**
526
+ * Locks a sheet against editing, optionally behind a password.
527
+ *
528
+ * This is the lock Excel offers under "Protect Sheet": it stops a user
529
+ * editing, it does not encrypt anything. The password is stored as Excel
530
+ * stores it - SHA-512 over a random salt, 100,000 spins - and
531
+ * `verifySheetPassword` checks it back.
532
+ */
533
+ protectSheet(sheet: number, password?: string | null): void;
534
+ /**
535
+ * Locks the structure of the workbook: which sheets there are, and their
536
+ * order. `windows` locks the window layout as well.
537
+ */
538
+ protectWorkbook(password?: string | null, windows?: boolean | null): void;
203
539
  /**
204
540
  * Reads a workbook of any format this crate supports, working the format
205
541
  * out from the bytes themselves.
@@ -209,6 +545,15 @@ export class Book {
209
545
  * the sheet of a SYLK file.
210
546
  */
211
547
  static read(bytes: Uint8Array, name?: string | null, max_expanded?: number | null, on_progress?: Function | null): Book;
548
+ /**
549
+ * Reads CSV with the guesses overridden: the delimiter, whether a row
550
+ * that produced no cell is skipped, whether an empty field becomes an
551
+ * empty string rather than no cell at all.
552
+ *
553
+ * `Book.read` guesses all of this from the bytes, which is right for a
554
+ * file of unknown origin; this is for one whose shape you already know.
555
+ */
556
+ static readCsv(bytes: Uint8Array, options: CsvOptions): Book;
212
557
  /**
213
558
  * Recomputes every formula and stores the results beside them, so that
214
559
  * `get` and `toCsv` show this engine's answers rather than the cache the
@@ -272,10 +617,51 @@ export class Book {
272
617
  * The names registered, in no particular order.
273
618
  */
274
619
  registeredFunctions(): string[];
620
+ /**
621
+ * Removes the cells of a range, pulling the rest back over the hole from
622
+ * below (`"up"`) or from the right (`"left"`).
623
+ */
624
+ removeCells(sheet: number, range: string, shift: string): void;
625
+ /**
626
+ * Removes `count` columns from column `at`, 1-based.
627
+ */
628
+ removeColumns(sheet: number, at: number, count: number): void;
629
+ /**
630
+ * Takes a note off a cell. Answers whether there was one.
631
+ */
632
+ removeComment(sheet: number, address: string): boolean;
633
+ /**
634
+ * Removes a defined name. Answers whether there was one.
635
+ */
636
+ removeDefinedName(name: string, sheet?: number | null): boolean;
637
+ /**
638
+ * Takes the link off a range. Answers whether there was one.
639
+ */
640
+ removeHyperlink(sheet: number, range: string): boolean;
641
+ /**
642
+ * Removes `count` rows from row `at` down. A formula that read a removed
643
+ * cell reads `#REF!` afterwards.
644
+ */
645
+ removeRows(sheet: number, at: number, count: number): void;
646
+ /**
647
+ * Removes a sheet. References to it from anywhere in the workbook become
648
+ * `#REF!`, the way Excel writes them, and the sheets after it shift down
649
+ * by one index.
650
+ */
651
+ removeSheet(sheet: number): void;
652
+ /**
653
+ * Removes a table by name. Answers whether there was one.
654
+ */
655
+ removeTable(sheet: number, name: string): boolean;
275
656
  /**
276
657
  * Renames a sheet.
277
658
  */
278
659
  renameSheet(sheet: number, title: string): void;
660
+ /**
661
+ * The height of a row in points, or `undefined` when the sheet leaves it
662
+ * to the default. `row` is the number a user sees.
663
+ */
664
+ rowHeight(sheet: number, row: number): number | undefined;
279
665
  /**
280
666
  * Whether a row is hidden. `row` is the number a user sees.
281
667
  */
@@ -298,6 +684,58 @@ export class Book {
298
684
  * The same by 1-based row and column.
299
685
  */
300
686
  setAt(sheet: number, row: number, column: number, value: CellValue): void;
687
+ /**
688
+ * Paints a cell: a number format, a font, a fill, borders, alignment, or
689
+ * any part of those.
690
+ *
691
+ * The patch is laid over the style the cell has, so a field left out
692
+ * keeps what was there - `{ font: { bold: true } }` does not reset the
693
+ * number format. Equal styles share one entry in the workbook's table,
694
+ * so painting a column costs one style, not one per cell.
695
+ *
696
+ * ```js
697
+ * book.setCellStyle(0, "B2", {
698
+ * numberFormat: "#,##0.00",
699
+ * font: { bold: true, color: "#FF1F4E79" },
700
+ * fill: { pattern: "solid", foreground: "#FFFFE699" },
701
+ * alignment: { horizontal: "right" },
702
+ * });
703
+ * ```
704
+ */
705
+ setCellStyle(sheet: number, address: string, patch: CellStylePatch): void;
706
+ /**
707
+ * The same by 1-based row and column.
708
+ */
709
+ setCellStyleAt(sheet: number, row: number, column: number, patch: CellStylePatch): void;
710
+ /**
711
+ * Hides a column, or shows it again. `column` is 1-based.
712
+ */
713
+ setColumnHidden(sheet: number, column: number, hidden: boolean): void;
714
+ /**
715
+ * Sets the width of a column in characters of the default font, or gives
716
+ * it back to the sheet default with `undefined`. `column` is 1-based.
717
+ *
718
+ * A run of columns that covered this one is split around it, so the
719
+ * neighbours keep the width they had.
720
+ */
721
+ setColumnWidth(sheet: number, column: number, width?: number | null): void;
722
+ /**
723
+ * Puts a note on a cell, replacing any note already there.
724
+ */
725
+ setComment(sheet: number, address: string, author: string, text: string): void;
726
+ /**
727
+ * Defines a name, replacing one of the same name. `formula` is what it
728
+ * stands for - `Sheet1!$A$1:$A$9` or a constant - and `sheet` makes the
729
+ * name local to that sheet instead of the workbook.
730
+ */
731
+ setDefinedName(name: string, formula: string, sheet?: number | null): void;
732
+ /**
733
+ * Puts a link over a cell or a block of them.
734
+ *
735
+ * `target` is a URL or a file path unless `inside` is true, and then it
736
+ * is a place in this workbook: `'Sheet 2'!A1`.
737
+ */
738
+ setHyperlink(sheet: number, range: string, target: string, inside?: boolean | null, display?: string | null, tooltip?: string | null): void;
301
739
  /**
302
740
  * Writes a rectangle of values with `at` as its top-left corner. Rows may
303
741
  * differ in length; a `null` leaves its cell empty.
@@ -307,6 +745,56 @@ export class Book {
307
745
  * The same with the corner given as 1-based row and column.
308
746
  */
309
747
  setRangeAt(sheet: number, row: number, column: number, values: CellGrid): void;
748
+ /**
749
+ * The same over a rectangle: `setRangeStyle(0, "A1:D1", { font: { bold:
750
+ * true } })`. Cells the range covers but the sheet has no value for are
751
+ * created empty, which is what carries the style.
752
+ */
753
+ setRangeStyle(sheet: number, range: string, patch: CellStylePatch): void;
754
+ /**
755
+ * Paints a rectangle cell by cell in one call, `at` its top-left corner:
756
+ * `grid` points into `styles`, each a patch as `setCellStyle` takes it,
757
+ * and `null` or `-1` leaves its cell alone. The output of
758
+ * `getRangeStyles` goes back in unchanged, so a block's formatting can be
759
+ * read, edited in JS and written back - or copied somewhere else.
760
+ */
761
+ setRangeStyles(sheet: number, at: string, styles: RangeStylesPatch): void;
762
+ /**
763
+ * The same with the corner given as 1-based row and column.
764
+ */
765
+ setRangeStylesAt(sheet: number, row: number, column: number, styles: RangeStylesPatch): void;
766
+ /**
767
+ * Sets the height of a row in points, or gives it back to the sheet
768
+ * default with `undefined`. `row` is the number a user sees.
769
+ */
770
+ setRowHeight(sheet: number, row: number, height?: number | null): void;
771
+ /**
772
+ * Hides a row, or shows it again.
773
+ */
774
+ setRowHidden(sheet: number, row: number, hidden: boolean): void;
775
+ /**
776
+ * Gives a sheet a tab or takes it away: `"visible"`, `"hidden"` or
777
+ * `"veryHidden"`.
778
+ *
779
+ * A very hidden sheet is not in the dialog Excel offers for unhiding one.
780
+ * Either way the sheet keeps its index, which is what every other call
781
+ * counts.
782
+ */
783
+ setSheetVisibility(sheet: number, state: string): void;
784
+ /**
785
+ * Shows or hides the grid lines, and the row and column headings with
786
+ * `headers`.
787
+ */
788
+ setShowGridLines(sheet: number, show: boolean, headers?: boolean | null): void;
789
+ /**
790
+ * The zoom a reader opens the sheet at, in percent; `undefined` gives it
791
+ * back to 100.
792
+ */
793
+ setZoom(sheet: number, percent?: number | null): void;
794
+ /**
795
+ * The drawn shapes of a sheet, text and all.
796
+ */
797
+ shapes(sheet: number): SheetShape[];
310
798
  /**
311
799
  * The tab index of a sheet by name, or `undefined` when there is none.
312
800
  * Names are compared the way Excel does, ignoring case.
@@ -316,6 +804,14 @@ export class Book {
316
804
  * Sheet titles, in tab order.
317
805
  */
318
806
  sheetNames(): string[];
807
+ /**
808
+ * Whether a sheet is locked, and whether the lock has a password.
809
+ */
810
+ sheetProtection(sheet: number): ProtectionInfo;
811
+ /**
812
+ * How the sheet is frozen and shown.
813
+ */
814
+ sheetView(sheet: number): SheetViewInfo;
319
815
  /**
320
816
  * Whether a sheet has a tab: `"visible"`, `"hidden"` or `"veryHidden"`.
321
817
  *
@@ -324,9 +820,37 @@ export class Book {
324
820
  */
325
821
  sheetVisibility(sheet: number): string;
326
822
  /**
327
- * One sheet as CSV.
823
+ * Sorts the rows of a range, or its columns. A key is a column number of
824
+ * the sheet, 1-based (a row number when sorting columns), or the text of
825
+ * a header when `options.header` says the first line is one; a minus
826
+ * sorts it largest first: `[2, -4]`, `["Region", "-Amount"]`. The first
827
+ * key decides first.
828
+ *
829
+ * ```js
830
+ * book.sortRange(0, "A1:D100", ["Region", "-Amount"], { header: true });
831
+ * ```
832
+ */
833
+ sortRange(sheet: number, range: string, keys: SortKeys, options?: SortRangeOptions): void;
834
+ /**
835
+ * Sorts the data rows of a table, found by name anywhere in the book;
836
+ * its header and totals rows stay put. Keys name its columns, as in
837
+ * `sortRange`: `book.sortTable("Sales", ["-Amount"])`.
838
+ */
839
+ sortTable(name: string, keys: SortKeys): void;
840
+ /**
841
+ * The tables of a sheet: what a structured reference like `Sales[Amount]`
842
+ * names.
843
+ */
844
+ tables(sheet: number): SheetTable[];
845
+ /**
846
+ * One sheet as CSV, comma-separated.
328
847
  */
329
848
  toCsv(sheet: number): string;
849
+ /**
850
+ * The same with the delimiter stated - a semicolon for a locale where the
851
+ * comma is the decimal mark.
852
+ */
853
+ toCsvWith(sheet: number, options: CsvOptions): string;
330
854
  /**
331
855
  * The workbook as an HTML page, or one sheet of it. `fragment` leaves out
332
856
  * the `<html>` wrapper, for embedding in a page that already has one.
@@ -347,6 +871,22 @@ export class Book {
347
871
  * The workbook as an xlsx package.
348
872
  */
349
873
  toXlsx(on_progress?: Function | null): Uint8Array;
874
+ /**
875
+ * Unfreezes the panes. The same as `freezePanes(sheet, 0, 0)`.
876
+ */
877
+ unfreezePanes(sheet: number): void;
878
+ /**
879
+ * Takes a merge back out. Answers whether there was one.
880
+ */
881
+ unmerge(sheet: number, range: string): boolean;
882
+ /**
883
+ * Unlocks a sheet, password and all.
884
+ */
885
+ unprotectSheet(sheet: number): void;
886
+ /**
887
+ * Unlocks the workbook.
888
+ */
889
+ unprotectWorkbook(): void;
350
890
  /**
351
891
  * Forgets a function registered earlier; answers whether there was one.
352
892
  */
@@ -356,4 +896,23 @@ export class Book {
356
896
  * nothing. This is the rectangle to walk; the sheet itself is sparse.
357
897
  */
358
898
  usedRange(sheet: number): string | undefined;
899
+ /**
900
+ * The used range of a sheet as `"A1:D20"` without walking the rows;
901
+ * `undefined` for an empty sheet.
902
+ *
903
+ * Rows are exact, columns an upper bound: removing a cell never narrows
904
+ * them. `usedRange` answers the same until a cell in an edge column is
905
+ * removed, and walks the rows after that to give the exact rectangle.
906
+ */
907
+ usedRangeHint(sheet: number): string | undefined;
908
+ /**
909
+ * Whether that password unlocks the sheet. `false` for a sheet with no
910
+ * password on it, and for a hash this crate cannot check.
911
+ */
912
+ verifySheetPassword(sheet: number, password: string): boolean;
913
+ /**
914
+ * Whether the workbook's structure is locked, and whether behind a
915
+ * password.
916
+ */
917
+ workbookProtection(): ProtectionInfo;
359
918
  }