@shbernal/ts-xlsx 1.3.1 → 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/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 +131 -85
- 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 +85 -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/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/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 +61 -115
- package/dist/io/xlsx/read.d.ts +3 -5
- package/dist/io/xlsx/read.js +61 -69
- 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 +2 -2
- 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/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 +3 -3
- package/dist/io/xlsx/write.d.ts +8 -7
- package/dist/io/xlsx/write.js +6 -3
- 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 {
|
|
@@ -64,12 +64,12 @@ export interface SheetView {
|
|
|
64
64
|
/**
|
|
65
65
|
* Per-column formatting. A column may exist purely to carry these, with no cells. The style
|
|
66
66
|
* facets are *defaults* for the column's cells: a cell that sets a facet of its own wins, but
|
|
67
|
-
* 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
|
|
68
68
|
* symmetric with how a {@link RowProperties} fill defaults a row's cells.
|
|
69
69
|
*/
|
|
70
70
|
export interface ColumnProperties extends CellStyle {
|
|
71
71
|
/** Stable key naming the column so a keyed-object row (see {@link Worksheet.addRow}) can place a
|
|
72
|
-
* 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. */
|
|
73
73
|
key?: string;
|
|
74
74
|
/** Column width in character units. */
|
|
75
75
|
width?: number;
|
|
@@ -105,26 +105,34 @@ export interface CellModel extends CellStyle {
|
|
|
105
105
|
note?: string | undefined;
|
|
106
106
|
}
|
|
107
107
|
/**
|
|
108
|
-
* A serialisable snapshot of a worksheet's value and overlay content
|
|
109
|
-
* the column/row/page metadata, and the sheet-level overlays (merges, data
|
|
110
|
-
* formattings, tables, the autofilter, protection). {@link Worksheet.model}
|
|
111
|
-
* it back reproduces that content. The getter and setter cover exactly the
|
|
112
|
-
* `dst.model = src.model` round-trip drops none of it
|
|
113
|
-
* silently lose data, the historical merge-loss failure this contract exists to
|
|
114
|
-
* directions are driven from one field table (`core/worksheet-model.ts`), which the
|
|
115
|
-
* 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
116
|
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
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).
|
|
121
|
+
*
|
|
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.
|
|
122
129
|
*/
|
|
123
130
|
export interface WorksheetModel {
|
|
124
131
|
state: WorksheetState['state'];
|
|
125
132
|
tabColor: Color | undefined;
|
|
126
133
|
properties: WorksheetProperties;
|
|
127
134
|
outline: OutlineProperties;
|
|
135
|
+
view: SheetView;
|
|
128
136
|
pageSetup: PageSetup;
|
|
129
137
|
printOptions: PrintOptions;
|
|
130
138
|
pageMargins: PageMargins;
|
|
@@ -163,7 +171,7 @@ export declare class Worksheet {
|
|
|
163
171
|
readonly properties: WorksheetProperties;
|
|
164
172
|
/**
|
|
165
173
|
* Outline summary-position flags. Mutate in place: `sheet.outline.summaryBelow = false`. Empty
|
|
166
|
-
* means unset
|
|
174
|
+
* means unset: the writer emits no `<outlinePr>` and a round-trip never fabricates one.
|
|
167
175
|
*/
|
|
168
176
|
readonly outline: OutlineProperties;
|
|
169
177
|
/**
|
|
@@ -173,13 +181,13 @@ export declare class Worksheet {
|
|
|
173
181
|
readonly view: SheetView;
|
|
174
182
|
/**
|
|
175
183
|
* Print-scaling and orientation. Mutate in place: `sheet.pageSetup.fitToPage = true`. Empty means
|
|
176
|
-
* unset
|
|
184
|
+
* unset: the writer emits neither `<pageSetUpPr>` nor `<pageSetup>` and a round-trip never
|
|
177
185
|
* fabricates them.
|
|
178
186
|
*/
|
|
179
187
|
readonly pageSetup: PageSetup;
|
|
180
188
|
/**
|
|
181
189
|
* Print-toggle flags (`<printOptions>`): centring, and whether headings/gridlines print. Mutate in
|
|
182
|
-
* place: `sheet.printOptions.gridLines = true`. Empty means unset
|
|
190
|
+
* place: `sheet.printOptions.gridLines = true`. Empty means unset. The writer emits no element and
|
|
183
191
|
* a round-trip never fabricates one.
|
|
184
192
|
*/
|
|
185
193
|
readonly printOptions: PrintOptions;
|
|
@@ -217,8 +225,8 @@ export declare class Worksheet {
|
|
|
217
225
|
/** Whether a cell has been materialised at the given 1-based position. */
|
|
218
226
|
hasCell(row: number, col: number): boolean;
|
|
219
227
|
/**
|
|
220
|
-
* A handle on a 1-based column: its formatting, its cells, and its values. Cheap and stateless
|
|
221
|
-
*
|
|
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
|
|
222
230
|
* not extend the used range. Writing through it (`getColumn(2).width = 12`) is what materialises
|
|
223
231
|
* the record.
|
|
224
232
|
*
|
|
@@ -226,7 +234,7 @@ export declare class Worksheet {
|
|
|
226
234
|
*/
|
|
227
235
|
getColumn(index: number): Column;
|
|
228
236
|
/**
|
|
229
|
-
* 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
|
|
230
238
|
* creates neither cells nor a format record, so asking about a row costs nothing and does not
|
|
231
239
|
* extend the used range. Writing through it (`getRow(3).height = 20`) is what materialises the
|
|
232
240
|
* record.
|
|
@@ -235,7 +243,7 @@ export declare class Worksheet {
|
|
|
235
243
|
*/
|
|
236
244
|
getRow(number: number): Row;
|
|
237
245
|
/**
|
|
238
|
-
* 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
|
|
239
247
|
* inclusive corners as `getRange(2, 2, 5, 4)`. Cheap and stateless like {@link getRow} and
|
|
240
248
|
* {@link getColumn}: it creates no cells and does not extend the used range.
|
|
241
249
|
*
|
|
@@ -254,7 +262,7 @@ export declare class Worksheet {
|
|
|
254
262
|
getRange(reference: string): Range;
|
|
255
263
|
getRange(top: number, left: number, bottom: number, right: number): Range;
|
|
256
264
|
/**
|
|
257
|
-
* 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),
|
|
258
266
|
* or 0 for an empty sheet. Spans gaps: a value in row 5 makes this 5 even if rows 2–4
|
|
259
267
|
* are empty. This is the used-range extent, not a populated-row tally (see
|
|
260
268
|
* {@link actualRowCount}).
|
|
@@ -263,29 +271,29 @@ export declare class Worksheet {
|
|
|
263
271
|
/** The number of rows that hold at least one non-empty cell, ignoring gaps and formatting-only rows. */
|
|
264
272
|
get actualRowCount(): number;
|
|
265
273
|
/**
|
|
266
|
-
* The 1-based index of the last column carrying anything
|
|
267
|
-
* 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
|
|
268
276
|
* other axis: a value in column E makes this 5 even if columns B–D are empty.
|
|
269
277
|
*/
|
|
270
278
|
get columnCount(): number;
|
|
271
279
|
/**
|
|
272
|
-
* The sheet's used range as one handle
|
|
273
|
-
* 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.
|
|
274
282
|
*
|
|
275
283
|
* This is {@link rowCount} and {@link columnCount} said once, so a caller stops reassembling
|
|
276
284
|
* `A1:${numberToColumn(sheet.columnCount)}${sheet.rowCount}` by hand. That is what an
|
|
277
|
-
* {@link autoFilter} covering the whole sheet wants
|
|
278
|
-
*
|
|
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
|
|
279
287
|
* nothing, which is the bug this exists to make hard to write.
|
|
280
288
|
*
|
|
281
289
|
* It inherits both counts' definition of *used*, so it spans gaps (a value in `E5` and nothing
|
|
282
|
-
* 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
|
|
283
291
|
* width, an outline level, a merge reaching past the last value. `undefined` therefore means
|
|
284
292
|
* strictly "no rectangle": an empty sheet, or one carrying only row formatting and no columns at
|
|
285
293
|
* all (or the reverse), where an axis has no extent to bound the other against.
|
|
286
294
|
*
|
|
287
|
-
* Not the same thing as the `<dimension>` a written package records. That is the *tight* box
|
|
288
|
-
* 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
|
|
289
297
|
* describe where the data is, not what the grid spans. This handle is anchored at `A1`, because
|
|
290
298
|
* a caller asking for the used range means the block to read, style or filter.
|
|
291
299
|
*/
|
|
@@ -312,7 +320,7 @@ export declare class Worksheet {
|
|
|
312
320
|
/** The tables defined on this sheet, in definition order. */
|
|
313
321
|
get tables(): readonly Table[];
|
|
314
322
|
/** The table with the given name (case-sensitive, the identifier Excel uses), or `undefined`.
|
|
315
|
-
* 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. */
|
|
316
324
|
getTable(name: string): Table | undefined;
|
|
317
325
|
/**
|
|
318
326
|
* Add a pivot table to this (destination) sheet, summarising a source sheet's data. The source is
|
|
@@ -325,7 +333,7 @@ export declare class Worksheet {
|
|
|
325
333
|
/** The pivot tables hosted on this sheet, in definition order. */
|
|
326
334
|
get pivotTables(): readonly PivotTable[];
|
|
327
335
|
/**
|
|
328
|
-
* 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
|
|
329
337
|
* read-only inspection view (source range, field roles, value field, aggregation). A pivot
|
|
330
338
|
* authored on this sheet via {@link addPivotTable} does not appear here; a pivot loaded from a
|
|
331
339
|
* file does not appear in {@link pivotTables}. The loaded pivots re-emit verbatim through
|
|
@@ -333,13 +341,13 @@ export declare class Worksheet {
|
|
|
333
341
|
*/
|
|
334
342
|
get loadedPivotTables(): readonly ParsedPivotTable[];
|
|
335
343
|
/**
|
|
336
|
-
* Anchor a threaded conversation to a cell
|
|
337
|
-
* replies, and whether the discussion was marked resolved. Distinct from a cell's
|
|
338
|
-
* ({@link Cell.note}), and mutually exclusive with one: Excel refuses to put both on
|
|
339
|
-
* 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.
|
|
340
348
|
*
|
|
341
349
|
* Every message supplies its own {@link Comment.id} and {@link Comment.date}, and names its author by
|
|
342
|
-
* {@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
|
|
343
351
|
* clock and no id generator, so nothing here is invented and the same workbook always serialises to the
|
|
344
352
|
* same bytes. Every id is normalised to the brace-wrapped upper-case GUID form the format requires, so a
|
|
345
353
|
* `crypto.randomUUID()` is accepted as-is.
|
|
@@ -347,7 +355,7 @@ export declare class Worksheet {
|
|
|
347
355
|
* Message ids must be unique **within this sheet**, because that is the scope in which they mean
|
|
348
356
|
* anything: a reply names its thread by the head's id inside the sheet's own part, and the legacy
|
|
349
357
|
* fallback comment binds its cell by the same id inside the sheet's own comments part. Two sheets reusing
|
|
350
|
-
* 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
|
|
351
359
|
* nothing resolves across a part boundary.
|
|
352
360
|
*
|
|
353
361
|
* @throws {SyntaxError} if the anchor does not resolve to a single cell, if any id is not a GUID, if a
|
|
@@ -356,7 +364,7 @@ export declare class Worksheet {
|
|
|
356
364
|
*/
|
|
357
365
|
addCommentThread(thread: CommentThread): void;
|
|
358
366
|
/**
|
|
359
|
-
* The threaded conversations on this sheet
|
|
367
|
+
* The threaded conversations on this sheet: Excel's modern review comments (author, timestamp,
|
|
360
368
|
* replies, resolved state, `@mentions`). Empty for a sheet with none. Distinct from a cell's legacy note
|
|
361
369
|
* ({@link Cell.note}).
|
|
362
370
|
*/
|
|
@@ -399,7 +407,7 @@ export declare class Worksheet {
|
|
|
399
407
|
*/
|
|
400
408
|
addImageAnchor(imageId: number, anchor: ImageAnchor): void;
|
|
401
409
|
/** Drop every anchor of the given workbook image from this sheet. The image stays registered on the
|
|
402
|
-
* workbook
|
|
410
|
+
* workbook (another sheet may still show it), so only this sheet's anchors are removed; the writer
|
|
403
411
|
* then omits any media no sheet anchors any longer. */
|
|
404
412
|
removeImage(imageId: number): void;
|
|
405
413
|
/** The images anchored to this sheet, in the order they were added. */
|
|
@@ -416,11 +424,11 @@ export declare class Worksheet {
|
|
|
416
424
|
get preservedReferences(): readonly PreservedWorksheetReference[];
|
|
417
425
|
/**
|
|
418
426
|
* Merge a range of cells (`"A1:B2"`). A range that overlaps an already-merged region is
|
|
419
|
-
* rejected
|
|
427
|
+
* rejected: Excel forbids overlapping merges and writes such geometry as a corrupt file.
|
|
420
428
|
* Whole-row/column ranges (`"A:A"`) are unbounded, carry no rectangle, and are not overlap-checked.
|
|
421
429
|
*
|
|
422
430
|
* Any value already sitting in a covered non-anchor cell is discarded, keeping only the top-left
|
|
423
|
-
* anchor's
|
|
431
|
+
* anchor's, exactly how Excel collapses a range on merge. Leaving it would emit a populated `<c>`
|
|
424
432
|
* under the `<mergeCell>` ref, the geometry Excel opens with a repair prompt. Covered-cell styles
|
|
425
433
|
* survive (a border spanning the merge is legal), so only the conflicting value is cleared.
|
|
426
434
|
*/
|
|
@@ -428,15 +436,15 @@ export declare class Worksheet {
|
|
|
428
436
|
/** The merged ranges on this sheet, in the order they were added. */
|
|
429
437
|
get merges(): readonly string[];
|
|
430
438
|
/**
|
|
431
|
-
* The sheet's autofilter
|
|
439
|
+
* The sheet's autofilter (its range plus any per-column criteria), or `undefined` when the sheet
|
|
432
440
|
* carries none. Setting one turns on the header-row filter dropdowns Excel draws over the range;
|
|
433
441
|
* the writer emits both the sheet's `<autoFilter>` element and the hidden `_FilterDatabase` defined
|
|
434
442
|
* name Excel derives from it. Setting `undefined` clears the filter.
|
|
435
443
|
*
|
|
436
|
-
* 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
|
|
437
445
|
* with no active criteria; pass an {@link AutoFilter} object to narrow columns. Either way the
|
|
438
446
|
* value is normalised on assignment (range to canonical `A1:C10` form) and the getter returns the
|
|
439
|
-
* 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
|
|
440
448
|
* filterable region and is rejected.
|
|
441
449
|
*/
|
|
442
450
|
get autoFilter(): AutoFilter | undefined;
|
|
@@ -454,7 +462,7 @@ export declare class Worksheet {
|
|
|
454
462
|
* the rule through {@link dataValidationAt}.
|
|
455
463
|
*
|
|
456
464
|
* Pass `{extended: true}` to mark a rule that belongs in the 2009 extension form
|
|
457
|
-
* (`<x14:dataValidation>`)
|
|
465
|
+
* (`<x14:dataValidation>`), the carrier Excel uses for a list source on another sheet and other
|
|
458
466
|
* shapes the standard element cannot express. The reader sets it for a rule found in that form so a
|
|
459
467
|
* round-trip writes it back there instead of silently corrupting the cross-sheet reference.
|
|
460
468
|
*/
|
|
@@ -464,7 +472,7 @@ export declare class Worksheet {
|
|
|
464
472
|
/** The data validations on this sheet, each bound to its target range, in insertion order. */
|
|
465
473
|
get dataValidations(): readonly DataValidationEntry[];
|
|
466
474
|
/**
|
|
467
|
-
* 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
|
|
468
476
|
* range (`"A1:A10"`), a whole column, or several space-separated areas (`"A1:C1 A3:C3"`) sharing one
|
|
469
477
|
* rule set. The block is stored once against the range, defensively copied so the getter never hands
|
|
470
478
|
* back a reference into the caller's object.
|
|
@@ -481,8 +489,8 @@ export declare class Worksheet {
|
|
|
481
489
|
* Remove `count` rows starting at the 1-based `start`, then insert the given rows in their place.
|
|
482
490
|
* Rows below the edit shift by `inserts.length - count`: a delete pulls the tail up, an insert
|
|
483
491
|
* pushes it down, and doing both at once is a replace. Each inserted row takes either
|
|
484
|
-
* {@link RowInput} shape
|
|
485
|
-
* 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
|
|
486
494
|
* silently becomes a no-op. Cells carry their full style to the shifted position, and merged ranges
|
|
487
495
|
* shift with the rows they cover.
|
|
488
496
|
*
|
|
@@ -500,19 +508,19 @@ export declare class Worksheet {
|
|
|
500
508
|
/**
|
|
501
509
|
* Append a row of `values` after the last used row, returning the cells it materialised.
|
|
502
510
|
* The append point is {@link rowCount}` + 1`, so the row lands below every row that holds
|
|
503
|
-
* data or its own formatting
|
|
511
|
+
* data or its own formatting, never overwriting existing content, unlike {@link insertRow},
|
|
504
512
|
* which shifts and needs a position. Unlike {@link spliceRows}, appending shifts nothing, so
|
|
505
513
|
* it never disturbs merges or the rows above.
|
|
506
514
|
*
|
|
507
|
-
* A row takes either shape
|
|
508
|
-
* sparse array (`['a', , 'c']`) leaves that column untouched
|
|
509
|
-
*
|
|
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}.
|
|
510
518
|
*/
|
|
511
519
|
addRow(values: RowInput): Cell[];
|
|
512
520
|
/**
|
|
513
521
|
* Append several rows after the last used row in one call, returning the cells materialised
|
|
514
|
-
* for each. The rows stack in order
|
|
515
|
-
* 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
|
|
516
524
|
* value-less. Each row is an array or a keyed object independently, so a mixed batch is fine.
|
|
517
525
|
* The bulk form of {@link addRow}.
|
|
518
526
|
*/
|
|
@@ -529,8 +537,8 @@ export declare class Worksheet {
|
|
|
529
537
|
unfreeze(): void;
|
|
530
538
|
/**
|
|
531
539
|
* Copy the row at the 1-based `start`, `options.count` times (default 1). With `options.insert`
|
|
532
|
-
* (the default) the copies are inserted directly after the source, shifting the rows below
|
|
533
|
-
* 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
|
|
534
542
|
* below without shifting. Each copy is a faithful duplicate of the source's values and per-cell
|
|
535
543
|
* styles, and carries no merge of its own, so a range can be merged onto a duplicated row afterwards.
|
|
536
544
|
*
|
|
@@ -542,7 +550,7 @@ export declare class Worksheet {
|
|
|
542
550
|
}): void;
|
|
543
551
|
/**
|
|
544
552
|
* Remove `count` columns starting at the 1-based `start`, then insert the given columns in their
|
|
545
|
-
* place
|
|
553
|
+
* place: the column analog of {@link spliceRows}. Columns to the right shift by
|
|
546
554
|
* `inserts.length - count`, keeping their values and styles, and a merged range lying wholly to
|
|
547
555
|
* the right of the edit re-anchors to its new columns. Each inserted column is an array of values
|
|
548
556
|
* indexed by row (index 0 → row 1); an empty array inserts a blank column.
|
|
@@ -561,7 +569,7 @@ export declare class Worksheet {
|
|
|
561
569
|
/**
|
|
562
570
|
* Append a column of `values` after the last used column, returning the cells it materialised.
|
|
563
571
|
* The append point is {@link columnCount}` + 1`, so the column lands right of every column that
|
|
564
|
-
* holds data or its own formatting
|
|
572
|
+
* holds data or its own formatting, never overwriting existing content, unlike {@link insertColumn},
|
|
565
573
|
* which shifts and needs a position. Unlike {@link spliceColumns}, appending shifts nothing, so it
|
|
566
574
|
* never disturbs merges or the columns to its left.
|
|
567
575
|
*
|
|
@@ -571,19 +579,19 @@ export declare class Worksheet {
|
|
|
571
579
|
addColumn(values: CellValue[]): Cell[];
|
|
572
580
|
/**
|
|
573
581
|
* Append several columns after the last used column in one call, returning the cells materialised
|
|
574
|
-
* for each. The columns stack in order
|
|
575
|
-
* 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
|
|
576
584
|
* value-less. The bulk form of {@link addColumn}.
|
|
577
585
|
*/
|
|
578
586
|
addColumns(columns: CellValue[][]): Cell[][];
|
|
579
587
|
/**
|
|
580
588
|
* A snapshot of this sheet's value and overlay content (see {@link WorksheetModel}). Reading it and
|
|
581
|
-
* assigning it onto another sheet
|
|
582
|
-
* and their styles, column/row metadata, tables, the autofilter, protection,
|
|
583
|
-
* survive, because the getter emits and the setter consumes exactly the same
|
|
584
|
-
* (`name`, `id`) is not part of the model and is never touched by assignment; nor
|
|
585
|
-
* that carry workbook-level identity (images, pivots,
|
|
586
|
-
* {@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.
|
|
587
595
|
*/
|
|
588
596
|
get model(): WorksheetModel;
|
|
589
597
|
set model(model: WorksheetModel);
|
|
@@ -602,7 +610,7 @@ export declare class Worksheet {
|
|
|
602
610
|
/** The sheet's protection, or `undefined` if the sheet is unprotected. */
|
|
603
611
|
get protection(): SheetProtection | undefined;
|
|
604
612
|
/**
|
|
605
|
-
* 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
|
|
606
614
|
* methods. Declared last so every private field it closes over is already in scope.
|
|
607
615
|
*/
|
|
608
616
|
readonly [INTERNAL]: WorksheetInternals;
|
|
@@ -623,7 +631,7 @@ export interface WorksheetInternals {
|
|
|
623
631
|
*/
|
|
624
632
|
evictRow(number: number): void;
|
|
625
633
|
/**
|
|
626
|
-
* Register a pivot table reconstructed from a loaded package
|
|
634
|
+
* Register a pivot table reconstructed from a loaded package: the reader's counterpart to
|
|
627
635
|
* {@link Worksheet.addPivotTable}. This records an inspectable, read-only view of a pivot the
|
|
628
636
|
* reader parsed from its OOXML parts; the pivot itself round-trips by byte-preservation, so
|
|
629
637
|
* registering it here only makes it visible via {@link Worksheet.loadedPivotTables} and never
|
|
@@ -635,7 +643,7 @@ export interface WorksheetInternals {
|
|
|
635
643
|
* replacing any already held. Their authors and mentioned people are already resolved against the
|
|
636
644
|
* workbook registry, so a thread arrives self-contained.
|
|
637
645
|
*
|
|
638
|
-
* Not authoring
|
|
646
|
+
* Not authoring: {@link Worksheet.addCommentThread} is that, and validates the anchor. These
|
|
639
647
|
* threads are what a re-write emits, so what the reader hands over is what the file will say.
|
|
640
648
|
*/
|
|
641
649
|
restoreCommentThreads(threads: readonly CommentThread[]): void;
|
|
@@ -646,7 +654,7 @@ export interface WorksheetInternals {
|
|
|
646
654
|
*/
|
|
647
655
|
addPreservedReference(reference: PreservedWorksheetReference): void;
|
|
648
656
|
/**
|
|
649
|
-
* Reinstate an already-derived protection state
|
|
657
|
+
* Reinstate an already-derived protection state: the deserialization counterpart to
|
|
650
658
|
* {@link Worksheet.protect}. A loaded `<sheetProtection>` carries its credential in finished agile
|
|
651
659
|
* form (algorithm, hash, salt, spin count) with no recoverable plaintext password, so the reader
|
|
652
660
|
* restores that credential verbatim rather than re-hashing.
|
|
@@ -655,7 +663,7 @@ export interface WorksheetInternals {
|
|
|
655
663
|
/**
|
|
656
664
|
* Materialise the cell at an exact 1-based position, creating it on first access. Unlike
|
|
657
665
|
* {@link Worksheet.getCell} this performs no merge resolution: the cell returned is the one at
|
|
658
|
-
* `(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
|
|
659
667
|
* model or a parsed file states where each value sits, and routing a covered value to its region
|
|
660
668
|
* master mid-load would move it.
|
|
661
669
|
*/
|