@shbernal/ts-xlsx 1.2.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/core/address.d.ts +49 -2
- package/dist/core/address.js +31 -3
- package/dist/core/autofilter.d.ts +2 -2
- package/dist/core/cell.d.ts +17 -16
- package/dist/core/cell.js +3 -7
- package/dist/core/color-resolution.d.ts +7 -7
- package/dist/core/column.d.ts +8 -9
- package/dist/core/column.js +2 -4
- package/dist/core/comment-thread.d.ts +32 -23
- package/dist/core/comment-thread.js +4 -4
- package/dist/core/conditional-formatting-overlay.d.ts +1 -1
- package/dist/core/conditional-formatting.d.ts +3 -3
- package/dist/core/data-validation-overlay.d.ts +1 -1
- package/dist/core/data-validation.d.ts +3 -3
- package/dist/core/date.d.ts +3 -3
- package/dist/core/formula.d.ts +6 -6
- package/dist/core/grid-edits.js +3 -3
- package/dist/core/image.d.ts +37 -2
- package/dist/core/image.js +6 -0
- package/dist/core/internal.d.ts +9 -1
- package/dist/core/limits.d.ts +4 -4
- package/dist/core/merge.d.ts +6 -12
- package/dist/core/merge.js +0 -3
- package/dist/core/page-setup.d.ts +4 -4
- package/dist/core/pivot-table.d.ts +2 -4
- package/dist/core/pivot-table.js +5 -5
- package/dist/core/preserved.d.ts +3 -3
- package/dist/core/protection.d.ts +4 -4
- package/dist/core/range.d.ts +16 -14
- package/dist/core/range.js +5 -5
- package/dist/core/row-input.d.ts +2 -8
- package/dist/core/row-input.js +2 -2
- package/dist/core/row.d.ts +7 -8
- package/dist/core/row.js +2 -4
- package/dist/core/style.d.ts +14 -14
- package/dist/core/table-style.d.ts +9 -9
- package/dist/core/table-style.js +1 -1
- package/dist/core/table.d.ts +30 -42
- package/dist/core/table.js +16 -10
- package/dist/core/theme.d.ts +13 -43
- package/dist/core/theme.js +2 -148
- package/dist/core/value.d.ts +7 -7
- package/dist/core/workbook-protection.d.ts +2 -2
- package/dist/core/workbook-styles.d.ts +26 -0
- package/dist/core/workbook-styles.js +48 -0
- package/dist/core/workbook-theme.d.ts +25 -0
- package/dist/core/workbook-theme.js +49 -0
- package/dist/core/workbook-vba.d.ts +17 -0
- package/dist/core/workbook-vba.js +79 -0
- package/dist/core/workbook.d.ts +141 -83
- package/dist/core/workbook.js +74 -133
- package/dist/core/worksheet-comments.d.ts +9 -0
- package/dist/core/worksheet-comments.js +52 -0
- package/dist/core/worksheet-model.d.ts +4 -4
- package/dist/core/worksheet-model.js +1 -0
- package/dist/core/worksheet-pictures.d.ts +29 -0
- package/dist/core/worksheet-pictures.js +42 -0
- package/dist/core/worksheet.d.ts +94 -77
- package/dist/core/worksheet.js +36 -95
- package/dist/customui/errors.d.ts +1 -1
- package/dist/customui/ribbon.d.ts +3 -3
- package/dist/entries/core.d.ts +4 -4
- package/dist/entries/core.js +1 -1
- package/dist/entries/vba.d.ts +1 -1
- package/dist/entries/vba.js +1 -1
- package/dist/entries/xlsx.d.ts +1 -0
- package/dist/entries/xlsx.js +1 -0
- package/dist/errors.d.ts +12 -12
- package/dist/io/csv/read.js +1 -2
- package/dist/io/csv/write.d.ts +8 -3
- package/dist/io/csv/write.js +17 -2
- package/dist/io/opc/errors.d.ts +6 -6
- package/dist/io/opc/inflate.d.ts +1 -1
- package/dist/io/opc/namespaces.d.ts +1 -1
- package/dist/io/opc/read-opc.d.ts +19 -3
- package/dist/io/opc/read-opc.js +14 -8
- package/dist/io/opc/read-options.d.ts +2 -2
- package/dist/io/opc/sniff-format.d.ts +2 -2
- package/dist/io/opc/zip-mtime.d.ts +5 -0
- package/dist/io/opc/zip-mtime.js +1 -0
- package/dist/io/style/xf-style.d.ts +38 -6
- package/dist/io/style/xf-style.js +22 -0
- package/dist/io/xlsb/errors.d.ts +1 -1
- package/dist/io/xlsb/formula.d.ts +4 -4
- package/dist/io/xlsb/primitives.d.ts +8 -8
- package/dist/io/xlsb/ptg-functions.d.ts +1 -1
- package/dist/io/xlsb/read-styles.js +2 -20
- package/dist/io/xlsb/read.d.ts +2 -2
- package/dist/io/xlsx/cell-accumulator.d.ts +25 -6
- package/dist/io/xlsx/cell-accumulator.js +111 -30
- package/dist/io/xlsx/cell-value.d.ts +2 -2
- package/dist/io/xlsx/cell-value.js +3 -3
- package/dist/io/xlsx/color-xml.js +11 -17
- package/dist/io/xlsx/comments.d.ts +5 -5
- package/dist/io/xlsx/comments.js +13 -6
- package/dist/io/xlsx/conditional-formatting.d.ts +3 -3
- package/dist/io/xlsx/conditional-formatting.js +7 -16
- package/dist/io/xlsx/data-validation.d.ts +2 -2
- package/dist/io/xlsx/data-validation.js +1 -1
- package/dist/io/xlsx/edit-vba.js +2 -1
- package/dist/io/xlsx/errors.d.ts +3 -3
- package/dist/io/xlsx/hyperlinks.d.ts +4 -2
- package/dist/io/xlsx/hyperlinks.js +5 -5
- package/dist/io/xlsx/images.d.ts +1 -1
- package/dist/io/xlsx/images.js +8 -8
- package/dist/io/xlsx/namespaces.d.ts +2 -2
- package/dist/io/xlsx/package-plan.js +5 -2
- package/dist/io/xlsx/read-pivot.js +2 -5
- package/dist/io/xlsx/read-rows.d.ts +13 -13
- package/dist/io/xlsx/read-rows.js +19 -55
- package/dist/io/xlsx/read-shared-strings.js +7 -5
- package/dist/io/xlsx/read-styles.d.ts +3 -3
- package/dist/io/xlsx/read-styles.js +40 -65
- package/dist/io/xlsx/read-worksheet.js +67 -115
- package/dist/io/xlsx/read.d.ts +3 -5
- package/dist/io/xlsx/read.js +94 -71
- package/dist/io/xlsx/rich-runs.d.ts +1 -1
- package/dist/io/xlsx/rich-runs.js +1 -1
- package/dist/io/xlsx/rich-text.d.ts +1 -1
- package/dist/io/xlsx/shared-strings.d.ts +2 -2
- package/dist/io/xlsx/sheet-properties.js +5 -4
- package/dist/io/xlsx/styles.d.ts +8 -9
- package/dist/io/xlsx/styles.js +4 -3
- package/dist/io/xlsx/tables.d.ts +2 -2
- package/dist/io/xlsx/tables.js +8 -13
- package/dist/io/xlsx/theme-xml.d.ts +37 -0
- package/dist/io/xlsx/theme-xml.js +142 -0
- package/dist/io/xlsx/threaded-comments.d.ts +18 -27
- package/dist/io/xlsx/threaded-comments.js +9 -21
- package/dist/io/xlsx/workbook-xml.d.ts +1 -1
- package/dist/io/xlsx/workbook-xml.js +6 -2
- package/dist/io/xlsx/worksheet-xml.d.ts +2 -2
- package/dist/io/xlsx/worksheet-xml.js +7 -12
- package/dist/io/xlsx/write-stream.d.ts +15 -15
- package/dist/io/xlsx/write-stream.js +5 -3
- package/dist/io/xlsx/write.d.ts +12 -7
- package/dist/io/xlsx/write.js +10 -6
- package/dist/io/xlsx/x14-ext.d.ts +1 -1
- package/dist/vba/bytes.d.ts +12 -0
- package/dist/vba/bytes.js +40 -0
- package/dist/vba/cfb-writer.d.ts +1 -1
- package/dist/vba/cfb.d.ts +1 -1
- package/dist/vba/cfb.js +15 -51
- package/dist/vba/codepage.d.ts +2 -2
- package/dist/vba/errors.d.ts +2 -2
- package/dist/vba/index.d.ts +2 -2
- package/dist/vba/index.js +2 -2
- package/dist/vba/ms-ovba.d.ts +1 -1
- package/dist/vba/ms-ovba.js +1 -3
- package/dist/vba/project-editor.d.ts +9 -9
- package/dist/vba/project-editor.js +2 -11
- package/dist/vba/project.d.ts +5 -5
- package/dist/vba/project.js +1 -10
- package/dist/vba/vba-encoding.d.ts +1 -1
- package/dist/xml/errors.d.ts +1 -1
- package/dist/xml/xml-read.d.ts +38 -9
- package/dist/xml/xml-read.js +23 -0
- package/dist/xml/xml.d.ts +31 -9
- package/dist/xml/xml.js +23 -3
- package/package.json +41 -35
package/dist/core/worksheet.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type AutoFilter } from './autofilter.ts';
|
|
2
2
|
import { Cell } from './cell.ts';
|
|
3
3
|
import { Column } from './column.ts';
|
|
4
|
-
import {
|
|
4
|
+
import type { CommentThread } from './comment-thread.ts';
|
|
5
5
|
import type { ConditionalFormatting } from './conditional-formatting.ts';
|
|
6
6
|
import type { DataValidation, DataValidationEntry } from './data-validation.ts';
|
|
7
|
-
import {
|
|
7
|
+
import type { AnchoredImage, AnchorPoint, ImageAnchor, ImageEditAs } from './image.ts';
|
|
8
8
|
import { INTERNAL } from './internal.ts';
|
|
9
9
|
import type { HeaderFooter, PageBreak, PageMargins, PageSetup, PrintOptions } from './page-setup.ts';
|
|
10
10
|
import { type ParsedPivotTable, PivotTable, type PivotTableOptions } from './pivot-table.ts';
|
|
@@ -39,7 +39,7 @@ export interface OutlineProperties {
|
|
|
39
39
|
/**
|
|
40
40
|
* A worksheet's frozen-pane view. `state` `'frozen'` locks the top `ySplit` rows and left `xSplit`
|
|
41
41
|
* columns in place while the rest scrolls; `'normal'` (the default) has no split and emits no
|
|
42
|
-
* `<pane
|
|
42
|
+
* `<pane>`: writing a normal view leaves no leftover pane markup that would trip Excel's repair
|
|
43
43
|
* prompt. An empty object is a normal view.
|
|
44
44
|
*/
|
|
45
45
|
export interface SheetView {
|
|
@@ -51,16 +51,25 @@ export interface SheetView {
|
|
|
51
51
|
ySplit?: number;
|
|
52
52
|
/** The cell anchoring the bottom-right scrolling pane; defaults to the first unfrozen cell. */
|
|
53
53
|
topLeftCell?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Whether the grid's cell lines are drawn on screen. Absent means Excel's default, which is on,
|
|
56
|
+
* so only `false` is worth setting: a sheet that paints its own fills and borders reads as a
|
|
57
|
+
* document rather than a spreadsheet once the grid behind it is off.
|
|
58
|
+
*
|
|
59
|
+
* On screen only, and unrelated to {@link PrintOptions.gridLines}, which decides whether the grid
|
|
60
|
+
* is *printed*. Excel exposes them as two separate checkboxes because the answers differ.
|
|
61
|
+
*/
|
|
62
|
+
showGridLines?: boolean;
|
|
54
63
|
}
|
|
55
64
|
/**
|
|
56
65
|
* Per-column formatting. A column may exist purely to carry these, with no cells. The style
|
|
57
66
|
* facets are *defaults* for the column's cells: a cell that sets a facet of its own wins, but
|
|
58
|
-
* one that leaves a facet unset inherits the column's
|
|
67
|
+
* one that leaves a facet unset inherits the column's, the same precedence Excel applies, and
|
|
59
68
|
* symmetric with how a {@link RowProperties} fill defaults a row's cells.
|
|
60
69
|
*/
|
|
61
70
|
export interface ColumnProperties extends CellStyle {
|
|
62
71
|
/** Stable key naming the column so a keyed-object row (see {@link Worksheet.addRow}) can place a
|
|
63
|
-
* value under it by name rather than position. In-memory only
|
|
72
|
+
* value under it by name rather than position. In-memory only: it is not serialized to OOXML. */
|
|
64
73
|
key?: string;
|
|
65
74
|
/** Column width in character units. */
|
|
66
75
|
width?: number;
|
|
@@ -96,26 +105,34 @@ export interface CellModel extends CellStyle {
|
|
|
96
105
|
note?: string | undefined;
|
|
97
106
|
}
|
|
98
107
|
/**
|
|
99
|
-
* A serialisable snapshot of a worksheet's value and overlay content
|
|
100
|
-
* the column/row/page metadata, and the sheet-level overlays (merges, data
|
|
101
|
-
* formattings, tables, the autofilter, protection). {@link Worksheet.model}
|
|
102
|
-
* it back reproduces that content. The getter and setter cover exactly the
|
|
103
|
-
* `dst.model = src.model` round-trip drops none of it
|
|
104
|
-
* silently lose data, the historical merge-loss failure this contract exists to
|
|
105
|
-
* directions are driven from one field table (`core/worksheet-model.ts`), which the
|
|
106
|
-
* covers every field below, so adding a field here without wiring it fails the build.
|
|
108
|
+
* A serialisable snapshot of a worksheet's value and overlay content: its cells and their styles,
|
|
109
|
+
* the column/row/page metadata, the frozen-pane view, and the sheet-level overlays (merges, data
|
|
110
|
+
* validations, conditional formattings, tables, the autofilter, protection). {@link Worksheet.model}
|
|
111
|
+
* exports one; assigning it back reproduces that content. The getter and setter cover exactly the
|
|
112
|
+
* same fields, so a `dst.model = src.model` round-trip drops none of it: an export field the import
|
|
113
|
+
* ignored would silently lose data, the historical merge-loss failure this contract exists to
|
|
114
|
+
* prevent. Both directions are driven from one field table (`core/worksheet-model.ts`), which the
|
|
115
|
+
* compiler proves covers every field below, so adding a field here without wiring it fails the build.
|
|
116
|
+
*
|
|
117
|
+
* The line between what belongs here and what does not is **workbook-independence**: a field earns
|
|
118
|
+
* its place when its value means the same thing on any sheet of any workbook. That is the test a new
|
|
119
|
+
* field is measured against, and applying it is what admitted the autofilter and the frozen-pane view
|
|
120
|
+
* after each had been omitted for no stated reason (ADR-0005 §2).
|
|
107
121
|
*
|
|
108
|
-
* Out of scope by design: content
|
|
109
|
-
*
|
|
110
|
-
* (their source references a live worksheet),
|
|
111
|
-
*
|
|
112
|
-
*
|
|
122
|
+
* Out of scope by design: content carrying workbook-level identity rather than pure sheet state.
|
|
123
|
+
* That covers anchored and background images (their bytes live on the {@link Workbook}), pivot tables
|
|
124
|
+
* (their source references a live worksheet), threaded comments (their authors are ids into the
|
|
125
|
+
* workbook's {@link Workbook.persons} registry, so a copied conversation would name an author the
|
|
126
|
+
* destination has never heard of), and byte-preserved parts (charts, vector drawings, slicers) kept
|
|
127
|
+
* verbatim for round-tripping. These stay with their source sheet; a model assignment neither copies
|
|
128
|
+
* nor clears them.
|
|
113
129
|
*/
|
|
114
130
|
export interface WorksheetModel {
|
|
115
131
|
state: WorksheetState['state'];
|
|
116
132
|
tabColor: Color | undefined;
|
|
117
133
|
properties: WorksheetProperties;
|
|
118
134
|
outline: OutlineProperties;
|
|
135
|
+
view: SheetView;
|
|
119
136
|
pageSetup: PageSetup;
|
|
120
137
|
printOptions: PrintOptions;
|
|
121
138
|
pageMargins: PageMargins;
|
|
@@ -154,7 +171,7 @@ export declare class Worksheet {
|
|
|
154
171
|
readonly properties: WorksheetProperties;
|
|
155
172
|
/**
|
|
156
173
|
* Outline summary-position flags. Mutate in place: `sheet.outline.summaryBelow = false`. Empty
|
|
157
|
-
* means unset
|
|
174
|
+
* means unset: the writer emits no `<outlinePr>` and a round-trip never fabricates one.
|
|
158
175
|
*/
|
|
159
176
|
readonly outline: OutlineProperties;
|
|
160
177
|
/**
|
|
@@ -164,13 +181,13 @@ export declare class Worksheet {
|
|
|
164
181
|
readonly view: SheetView;
|
|
165
182
|
/**
|
|
166
183
|
* Print-scaling and orientation. Mutate in place: `sheet.pageSetup.fitToPage = true`. Empty means
|
|
167
|
-
* unset
|
|
184
|
+
* unset: the writer emits neither `<pageSetUpPr>` nor `<pageSetup>` and a round-trip never
|
|
168
185
|
* fabricates them.
|
|
169
186
|
*/
|
|
170
187
|
readonly pageSetup: PageSetup;
|
|
171
188
|
/**
|
|
172
189
|
* Print-toggle flags (`<printOptions>`): centring, and whether headings/gridlines print. Mutate in
|
|
173
|
-
* place: `sheet.printOptions.gridLines = true`. Empty means unset
|
|
190
|
+
* place: `sheet.printOptions.gridLines = true`. Empty means unset. The writer emits no element and
|
|
174
191
|
* a round-trip never fabricates one.
|
|
175
192
|
*/
|
|
176
193
|
readonly printOptions: PrintOptions;
|
|
@@ -208,8 +225,8 @@ export declare class Worksheet {
|
|
|
208
225
|
/** Whether a cell has been materialised at the given 1-based position. */
|
|
209
226
|
hasCell(row: number, col: number): boolean;
|
|
210
227
|
/**
|
|
211
|
-
* A handle on a 1-based column: its formatting, its cells, and its values. Cheap and stateless
|
|
212
|
-
*
|
|
228
|
+
* A handle on a 1-based column: its formatting, its cells, and its values. Cheap and stateless.
|
|
229
|
+
* It creates neither cells nor a format record, so asking about a column costs nothing and does
|
|
213
230
|
* not extend the used range. Writing through it (`getColumn(2).width = 12`) is what materialises
|
|
214
231
|
* the record.
|
|
215
232
|
*
|
|
@@ -217,7 +234,7 @@ export declare class Worksheet {
|
|
|
217
234
|
*/
|
|
218
235
|
getColumn(index: number): Column;
|
|
219
236
|
/**
|
|
220
|
-
* A handle on a 1-based row: its formatting, its cells, and its values. Cheap and stateless
|
|
237
|
+
* A handle on a 1-based row: its formatting, its cells, and its values. Cheap and stateless. It
|
|
221
238
|
* creates neither cells nor a format record, so asking about a row costs nothing and does not
|
|
222
239
|
* extend the used range. Writing through it (`getRow(3).height = 20`) is what materialises the
|
|
223
240
|
* record.
|
|
@@ -226,7 +243,7 @@ export declare class Worksheet {
|
|
|
226
243
|
*/
|
|
227
244
|
getRow(number: number): Row;
|
|
228
245
|
/**
|
|
229
|
-
* A handle on a rectangular block of cells
|
|
246
|
+
* A handle on a rectangular block of cells: `getRange('B2:D5')`, or the same block by its
|
|
230
247
|
* inclusive corners as `getRange(2, 2, 5, 4)`. Cheap and stateless like {@link getRow} and
|
|
231
248
|
* {@link getColumn}: it creates no cells and does not extend the used range.
|
|
232
249
|
*
|
|
@@ -245,7 +262,7 @@ export declare class Worksheet {
|
|
|
245
262
|
getRange(reference: string): Range;
|
|
246
263
|
getRange(top: number, left: number, bottom: number, right: number): Range;
|
|
247
264
|
/**
|
|
248
|
-
* The 1-based index of the last row carrying anything
|
|
265
|
+
* The 1-based index of the last row carrying anything (data or its own formatting),
|
|
249
266
|
* or 0 for an empty sheet. Spans gaps: a value in row 5 makes this 5 even if rows 2–4
|
|
250
267
|
* are empty. This is the used-range extent, not a populated-row tally (see
|
|
251
268
|
* {@link actualRowCount}).
|
|
@@ -254,29 +271,29 @@ export declare class Worksheet {
|
|
|
254
271
|
/** The number of rows that hold at least one non-empty cell, ignoring gaps and formatting-only rows. */
|
|
255
272
|
get actualRowCount(): number;
|
|
256
273
|
/**
|
|
257
|
-
* The 1-based index of the last column carrying anything
|
|
258
|
-
* properties
|
|
274
|
+
* The 1-based index of the last column carrying anything (a non-empty cell or its own format
|
|
275
|
+
* properties), or 0 for an empty sheet. The used-range width, mirroring {@link rowCount} for the
|
|
259
276
|
* other axis: a value in column E makes this 5 even if columns B–D are empty.
|
|
260
277
|
*/
|
|
261
278
|
get columnCount(): number;
|
|
262
279
|
/**
|
|
263
|
-
* The sheet's used range as one handle
|
|
264
|
-
* anything
|
|
280
|
+
* The sheet's used range as one handle: `A1` through the last row and column that carry
|
|
281
|
+
* anything, or `undefined` when there is no rectangle to name.
|
|
265
282
|
*
|
|
266
283
|
* This is {@link rowCount} and {@link columnCount} said once, so a caller stops reassembling
|
|
267
284
|
* `A1:${numberToColumn(sheet.columnCount)}${sheet.rowCount}` by hand. That is what an
|
|
268
|
-
* {@link autoFilter} covering the whole sheet wants
|
|
269
|
-
*
|
|
285
|
+
* {@link autoFilter} covering the whole sheet wants (`sheet.autoFilter = sheet.usedRange.address`),
|
|
286
|
+
* and Excel writes exactly that ref for a filter it applies itself. A header-only ref filters
|
|
270
287
|
* nothing, which is the bug this exists to make hard to write.
|
|
271
288
|
*
|
|
272
289
|
* It inherits both counts' definition of *used*, so it spans gaps (a value in `E5` and nothing
|
|
273
|
-
* else still gives `A1:E5`) and includes a line carrying only its own formatting
|
|
290
|
+
* else still gives `A1:E5`) and includes a line carrying only its own formatting: a set column
|
|
274
291
|
* width, an outline level, a merge reaching past the last value. `undefined` therefore means
|
|
275
292
|
* strictly "no rectangle": an empty sheet, or one carrying only row formatting and no columns at
|
|
276
293
|
* all (or the reverse), where an axis has no extent to bound the other against.
|
|
277
294
|
*
|
|
278
|
-
* Not the same thing as the `<dimension>` a written package records. That is the *tight* box
|
|
279
|
-
* top-left at the first used cell
|
|
295
|
+
* Not the same thing as the `<dimension>` a written package records. That is the *tight* box,
|
|
296
|
+
* top-left at the first used cell and formatting-only rows excluded, because Excel writes it to
|
|
280
297
|
* describe where the data is, not what the grid spans. This handle is anchored at `A1`, because
|
|
281
298
|
* a caller asking for the used range means the block to read, style or filter.
|
|
282
299
|
*/
|
|
@@ -303,7 +320,7 @@ export declare class Worksheet {
|
|
|
303
320
|
/** The tables defined on this sheet, in definition order. */
|
|
304
321
|
get tables(): readonly Table[];
|
|
305
322
|
/** The table with the given name (case-sensitive, the identifier Excel uses), or `undefined`.
|
|
306
|
-
* A table read back from a file is fully hydrated
|
|
323
|
+
* A table read back from a file is fully hydrated: its rows can be read and appended to. */
|
|
307
324
|
getTable(name: string): Table | undefined;
|
|
308
325
|
/**
|
|
309
326
|
* Add a pivot table to this (destination) sheet, summarising a source sheet's data. The source is
|
|
@@ -316,7 +333,7 @@ export declare class Worksheet {
|
|
|
316
333
|
/** The pivot tables hosted on this sheet, in definition order. */
|
|
317
334
|
get pivotTables(): readonly PivotTable[];
|
|
318
335
|
/**
|
|
319
|
-
* Pivot tables reconstructed from a loaded package, in the order the reader found them
|
|
336
|
+
* Pivot tables reconstructed from a loaded package, in the order the reader found them: a
|
|
320
337
|
* read-only inspection view (source range, field roles, value field, aggregation). A pivot
|
|
321
338
|
* authored on this sheet via {@link addPivotTable} does not appear here; a pivot loaded from a
|
|
322
339
|
* file does not appear in {@link pivotTables}. The loaded pivots re-emit verbatim through
|
|
@@ -324,13 +341,13 @@ export declare class Worksheet {
|
|
|
324
341
|
*/
|
|
325
342
|
get loadedPivotTables(): readonly ParsedPivotTable[];
|
|
326
343
|
/**
|
|
327
|
-
* Anchor a threaded conversation to a cell
|
|
328
|
-
* replies, and whether the discussion was marked resolved. Distinct from a cell's
|
|
329
|
-
* ({@link Cell.note}), and mutually exclusive with one: Excel refuses to put both on
|
|
330
|
-
* cell carrying both is written back as the conversation alone.
|
|
344
|
+
* Anchor a threaded conversation to a cell. This is Excel's modern review comment: an opening
|
|
345
|
+
* message, its replies, and whether the discussion was marked resolved. Distinct from a cell's
|
|
346
|
+
* legacy note ({@link Cell.note}), and mutually exclusive with one: Excel refuses to put both on
|
|
347
|
+
* one cell, and a cell carrying both is written back as the conversation alone.
|
|
331
348
|
*
|
|
332
349
|
* Every message supplies its own {@link Comment.id} and {@link Comment.date}, and names its author by
|
|
333
|
-
* {@link Comment.personId} into the workbook registry ({@link Workbook.addPerson})
|
|
350
|
+
* {@link Comment.personId} into the workbook registry ({@link Workbook.addPerson}): the writer has no
|
|
334
351
|
* clock and no id generator, so nothing here is invented and the same workbook always serialises to the
|
|
335
352
|
* same bytes. Every id is normalised to the brace-wrapped upper-case GUID form the format requires, so a
|
|
336
353
|
* `crypto.randomUUID()` is accepted as-is.
|
|
@@ -338,7 +355,7 @@ export declare class Worksheet {
|
|
|
338
355
|
* Message ids must be unique **within this sheet**, because that is the scope in which they mean
|
|
339
356
|
* anything: a reply names its thread by the head's id inside the sheet's own part, and the legacy
|
|
340
357
|
* fallback comment binds its cell by the same id inside the sheet's own comments part. Two sheets reusing
|
|
341
|
-
* one id is therefore harmless and is not rejected
|
|
358
|
+
* one id is therefore harmless and is not rejected: Excel's ids happen to be globally unique, but
|
|
342
359
|
* nothing resolves across a part boundary.
|
|
343
360
|
*
|
|
344
361
|
* @throws {SyntaxError} if the anchor does not resolve to a single cell, if any id is not a GUID, if a
|
|
@@ -347,7 +364,7 @@ export declare class Worksheet {
|
|
|
347
364
|
*/
|
|
348
365
|
addCommentThread(thread: CommentThread): void;
|
|
349
366
|
/**
|
|
350
|
-
* The threaded conversations on this sheet
|
|
367
|
+
* The threaded conversations on this sheet: Excel's modern review comments (author, timestamp,
|
|
351
368
|
* replies, resolved state, `@mentions`). Empty for a sheet with none. Distinct from a cell's legacy note
|
|
352
369
|
* ({@link Cell.note}).
|
|
353
370
|
*/
|
|
@@ -390,7 +407,7 @@ export declare class Worksheet {
|
|
|
390
407
|
*/
|
|
391
408
|
addImageAnchor(imageId: number, anchor: ImageAnchor): void;
|
|
392
409
|
/** Drop every anchor of the given workbook image from this sheet. The image stays registered on the
|
|
393
|
-
* workbook
|
|
410
|
+
* workbook (another sheet may still show it), so only this sheet's anchors are removed; the writer
|
|
394
411
|
* then omits any media no sheet anchors any longer. */
|
|
395
412
|
removeImage(imageId: number): void;
|
|
396
413
|
/** The images anchored to this sheet, in the order they were added. */
|
|
@@ -407,11 +424,11 @@ export declare class Worksheet {
|
|
|
407
424
|
get preservedReferences(): readonly PreservedWorksheetReference[];
|
|
408
425
|
/**
|
|
409
426
|
* Merge a range of cells (`"A1:B2"`). A range that overlaps an already-merged region is
|
|
410
|
-
* rejected
|
|
427
|
+
* rejected: Excel forbids overlapping merges and writes such geometry as a corrupt file.
|
|
411
428
|
* Whole-row/column ranges (`"A:A"`) are unbounded, carry no rectangle, and are not overlap-checked.
|
|
412
429
|
*
|
|
413
430
|
* Any value already sitting in a covered non-anchor cell is discarded, keeping only the top-left
|
|
414
|
-
* anchor's
|
|
431
|
+
* anchor's, exactly how Excel collapses a range on merge. Leaving it would emit a populated `<c>`
|
|
415
432
|
* under the `<mergeCell>` ref, the geometry Excel opens with a repair prompt. Covered-cell styles
|
|
416
433
|
* survive (a border spanning the merge is legal), so only the conflicting value is cleared.
|
|
417
434
|
*/
|
|
@@ -419,15 +436,15 @@ export declare class Worksheet {
|
|
|
419
436
|
/** The merged ranges on this sheet, in the order they were added. */
|
|
420
437
|
get merges(): readonly string[];
|
|
421
438
|
/**
|
|
422
|
-
* The sheet's autofilter
|
|
439
|
+
* The sheet's autofilter (its range plus any per-column criteria), or `undefined` when the sheet
|
|
423
440
|
* carries none. Setting one turns on the header-row filter dropdowns Excel draws over the range;
|
|
424
441
|
* the writer emits both the sheet's `<autoFilter>` element and the hidden `_FilterDatabase` defined
|
|
425
442
|
* name Excel derives from it. Setting `undefined` clears the filter.
|
|
426
443
|
*
|
|
427
|
-
* A bare range string is the ergonomic common case
|
|
444
|
+
* A bare range string is the ergonomic common case: `sheet.autoFilter = 'A1:C10'` for dropdowns
|
|
428
445
|
* with no active criteria; pass an {@link AutoFilter} object to narrow columns. Either way the
|
|
429
446
|
* value is normalised on assignment (range to canonical `A1:C10` form) and the getter returns the
|
|
430
|
-
* structured object. The range must be a bounded rectangle
|
|
447
|
+
* structured object. The range must be a bounded rectangle: a whole-row/column reference is not a
|
|
431
448
|
* filterable region and is rejected.
|
|
432
449
|
*/
|
|
433
450
|
get autoFilter(): AutoFilter | undefined;
|
|
@@ -445,7 +462,7 @@ export declare class Worksheet {
|
|
|
445
462
|
* the rule through {@link dataValidationAt}.
|
|
446
463
|
*
|
|
447
464
|
* Pass `{extended: true}` to mark a rule that belongs in the 2009 extension form
|
|
448
|
-
* (`<x14:dataValidation>`)
|
|
465
|
+
* (`<x14:dataValidation>`), the carrier Excel uses for a list source on another sheet and other
|
|
449
466
|
* shapes the standard element cannot express. The reader sets it for a rule found in that form so a
|
|
450
467
|
* round-trip writes it back there instead of silently corrupting the cross-sheet reference.
|
|
451
468
|
*/
|
|
@@ -455,7 +472,7 @@ export declare class Worksheet {
|
|
|
455
472
|
/** The data validations on this sheet, each bound to its target range, in insertion order. */
|
|
456
473
|
get dataValidations(): readonly DataValidationEntry[];
|
|
457
474
|
/**
|
|
458
|
-
* Attach a conditional formatting to a target range. `formatting.ref` is an OOXML `sqref
|
|
475
|
+
* Attach a conditional formatting to a target range. `formatting.ref` is an OOXML `sqref`: one
|
|
459
476
|
* range (`"A1:A10"`), a whole column, or several space-separated areas (`"A1:C1 A3:C3"`) sharing one
|
|
460
477
|
* rule set. The block is stored once against the range, defensively copied so the getter never hands
|
|
461
478
|
* back a reference into the caller's object.
|
|
@@ -472,8 +489,8 @@ export declare class Worksheet {
|
|
|
472
489
|
* Remove `count` rows starting at the 1-based `start`, then insert the given rows in their place.
|
|
473
490
|
* Rows below the edit shift by `inserts.length - count`: a delete pulls the tail up, an insert
|
|
474
491
|
* pushes it down, and doing both at once is a replace. Each inserted row takes either
|
|
475
|
-
* {@link RowInput} shape
|
|
476
|
-
* like {@link addRow}. A `count` larger than the rows present simply clears the tail
|
|
492
|
+
* {@link RowInput} shape, a positional array from column A or a key-addressed object, exactly
|
|
493
|
+
* like {@link addRow}. A `count` larger than the rows present simply clears the tail; it never
|
|
477
494
|
* silently becomes a no-op. Cells carry their full style to the shifted position, and merged ranges
|
|
478
495
|
* shift with the rows they cover.
|
|
479
496
|
*
|
|
@@ -491,19 +508,19 @@ export declare class Worksheet {
|
|
|
491
508
|
/**
|
|
492
509
|
* Append a row of `values` after the last used row, returning the cells it materialised.
|
|
493
510
|
* The append point is {@link rowCount}` + 1`, so the row lands below every row that holds
|
|
494
|
-
* data or its own formatting
|
|
511
|
+
* data or its own formatting, never overwriting existing content, unlike {@link insertRow},
|
|
495
512
|
* which shifts and needs a position. Unlike {@link spliceRows}, appending shifts nothing, so
|
|
496
513
|
* it never disturbs merges or the rows above.
|
|
497
514
|
*
|
|
498
|
-
* A row takes either shape
|
|
499
|
-
* sparse array (`['a', , 'c']`) leaves that column untouched
|
|
500
|
-
*
|
|
515
|
+
* A row takes either shape. A positional array maps its values to columns from A, and a hole in a
|
|
516
|
+
* sparse array (`['a', , 'c']`) leaves that column untouched. A keyed object lands its values
|
|
517
|
+
* under the columns carrying the matching {@link ColumnProperties.key}.
|
|
501
518
|
*/
|
|
502
519
|
addRow(values: RowInput): Cell[];
|
|
503
520
|
/**
|
|
504
521
|
* Append several rows after the last used row in one call, returning the cells materialised
|
|
505
|
-
* for each. The rows stack in order
|
|
506
|
-
* directly below it
|
|
522
|
+
* for each. The rows stack in order: the first lands at {@link rowCount}` + 1`, the next
|
|
523
|
+
* directly below it, so a later row never collides with an earlier one even when both are
|
|
507
524
|
* value-less. Each row is an array or a keyed object independently, so a mixed batch is fine.
|
|
508
525
|
* The bulk form of {@link addRow}.
|
|
509
526
|
*/
|
|
@@ -520,8 +537,8 @@ export declare class Worksheet {
|
|
|
520
537
|
unfreeze(): void;
|
|
521
538
|
/**
|
|
522
539
|
* Copy the row at the 1-based `start`, `options.count` times (default 1). With `options.insert`
|
|
523
|
-
* (the default) the copies are inserted directly after the source, shifting the rows below
|
|
524
|
-
* any merged range there
|
|
540
|
+
* (the default) the copies are inserted directly after the source, shifting the rows below, and
|
|
541
|
+
* any merged range there, down by `count`; otherwise the copies overwrite the rows immediately
|
|
525
542
|
* below without shifting. Each copy is a faithful duplicate of the source's values and per-cell
|
|
526
543
|
* styles, and carries no merge of its own, so a range can be merged onto a duplicated row afterwards.
|
|
527
544
|
*
|
|
@@ -533,7 +550,7 @@ export declare class Worksheet {
|
|
|
533
550
|
}): void;
|
|
534
551
|
/**
|
|
535
552
|
* Remove `count` columns starting at the 1-based `start`, then insert the given columns in their
|
|
536
|
-
* place
|
|
553
|
+
* place: the column analog of {@link spliceRows}. Columns to the right shift by
|
|
537
554
|
* `inserts.length - count`, keeping their values and styles, and a merged range lying wholly to
|
|
538
555
|
* the right of the edit re-anchors to its new columns. Each inserted column is an array of values
|
|
539
556
|
* indexed by row (index 0 → row 1); an empty array inserts a blank column.
|
|
@@ -552,7 +569,7 @@ export declare class Worksheet {
|
|
|
552
569
|
/**
|
|
553
570
|
* Append a column of `values` after the last used column, returning the cells it materialised.
|
|
554
571
|
* The append point is {@link columnCount}` + 1`, so the column lands right of every column that
|
|
555
|
-
* holds data or its own formatting
|
|
572
|
+
* holds data or its own formatting, never overwriting existing content, unlike {@link insertColumn},
|
|
556
573
|
* which shifts and needs a position. Unlike {@link spliceColumns}, appending shifts nothing, so it
|
|
557
574
|
* never disturbs merges or the columns to its left.
|
|
558
575
|
*
|
|
@@ -562,19 +579,19 @@ export declare class Worksheet {
|
|
|
562
579
|
addColumn(values: CellValue[]): Cell[];
|
|
563
580
|
/**
|
|
564
581
|
* Append several columns after the last used column in one call, returning the cells materialised
|
|
565
|
-
* for each. The columns stack in order
|
|
566
|
-
* directly right of it
|
|
582
|
+
* for each. The columns stack in order: the first lands at {@link columnCount}` + 1`, the next
|
|
583
|
+
* directly right of it, so a later column never collides with an earlier one even when both are
|
|
567
584
|
* value-less. The bulk form of {@link addColumn}.
|
|
568
585
|
*/
|
|
569
586
|
addColumns(columns: CellValue[][]): Cell[][];
|
|
570
587
|
/**
|
|
571
588
|
* A snapshot of this sheet's value and overlay content (see {@link WorksheetModel}). Reading it and
|
|
572
|
-
* assigning it onto another sheet
|
|
573
|
-
* and their styles, column/row metadata, tables, the autofilter, protection,
|
|
574
|
-
* survive, because the getter emits and the setter consumes exactly the same
|
|
575
|
-
* (`name`, `id`) is not part of the model and is never touched by assignment; nor
|
|
576
|
-
* that carry workbook-level identity (images, pivots,
|
|
577
|
-
* {@link WorksheetModel} for that boundary.
|
|
589
|
+
* assigning it onto another sheet (`dst.model = src.model`) reproduces the source: merges, cells
|
|
590
|
+
* and their styles, column/row metadata, tables, the autofilter, protection, the frozen-pane view,
|
|
591
|
+
* and the page setup all survive, because the getter emits and the setter consumes exactly the same
|
|
592
|
+
* fields. Identity (`name`, `id`) is not part of the model and is never touched by assignment; nor
|
|
593
|
+
* are attached parts that carry workbook-level identity (images, pivots, threaded comments,
|
|
594
|
+
* byte-preserved charts/drawings). See {@link WorksheetModel} for that boundary.
|
|
578
595
|
*/
|
|
579
596
|
get model(): WorksheetModel;
|
|
580
597
|
set model(model: WorksheetModel);
|
|
@@ -593,7 +610,7 @@ export declare class Worksheet {
|
|
|
593
610
|
/** The sheet's protection, or `undefined` if the sheet is unprotected. */
|
|
594
611
|
get protection(): SheetProtection | undefined;
|
|
595
612
|
/**
|
|
596
|
-
* The codec's channel into this sheet
|
|
613
|
+
* The codec's channel into this sheet. See `core/internal.ts` for why these are not public
|
|
597
614
|
* methods. Declared last so every private field it closes over is already in scope.
|
|
598
615
|
*/
|
|
599
616
|
readonly [INTERNAL]: WorksheetInternals;
|
|
@@ -614,7 +631,7 @@ export interface WorksheetInternals {
|
|
|
614
631
|
*/
|
|
615
632
|
evictRow(number: number): void;
|
|
616
633
|
/**
|
|
617
|
-
* Register a pivot table reconstructed from a loaded package
|
|
634
|
+
* Register a pivot table reconstructed from a loaded package: the reader's counterpart to
|
|
618
635
|
* {@link Worksheet.addPivotTable}. This records an inspectable, read-only view of a pivot the
|
|
619
636
|
* reader parsed from its OOXML parts; the pivot itself round-trips by byte-preservation, so
|
|
620
637
|
* registering it here only makes it visible via {@link Worksheet.loadedPivotTables} and never
|
|
@@ -626,7 +643,7 @@ export interface WorksheetInternals {
|
|
|
626
643
|
* replacing any already held. Their authors and mentioned people are already resolved against the
|
|
627
644
|
* workbook registry, so a thread arrives self-contained.
|
|
628
645
|
*
|
|
629
|
-
* Not authoring
|
|
646
|
+
* Not authoring: {@link Worksheet.addCommentThread} is that, and validates the anchor. These
|
|
630
647
|
* threads are what a re-write emits, so what the reader hands over is what the file will say.
|
|
631
648
|
*/
|
|
632
649
|
restoreCommentThreads(threads: readonly CommentThread[]): void;
|
|
@@ -637,7 +654,7 @@ export interface WorksheetInternals {
|
|
|
637
654
|
*/
|
|
638
655
|
addPreservedReference(reference: PreservedWorksheetReference): void;
|
|
639
656
|
/**
|
|
640
|
-
* Reinstate an already-derived protection state
|
|
657
|
+
* Reinstate an already-derived protection state: the deserialization counterpart to
|
|
641
658
|
* {@link Worksheet.protect}. A loaded `<sheetProtection>` carries its credential in finished agile
|
|
642
659
|
* form (algorithm, hash, salt, spin count) with no recoverable plaintext password, so the reader
|
|
643
660
|
* restores that credential verbatim rather than re-hashing.
|
|
@@ -646,7 +663,7 @@ export interface WorksheetInternals {
|
|
|
646
663
|
/**
|
|
647
664
|
* Materialise the cell at an exact 1-based position, creating it on first access. Unlike
|
|
648
665
|
* {@link Worksheet.getCell} this performs no merge resolution: the cell returned is the one at
|
|
649
|
-
* `(row, col)` even when a merged region covers it. Loading content is where that matters
|
|
666
|
+
* `(row, col)` even when a merged region covers it. Loading content is where that matters: a
|
|
650
667
|
* model or a parsed file states where each value sits, and routing a covered value to its region
|
|
651
668
|
* master mid-load would move it.
|
|
652
669
|
*/
|