@shbernal/ts-xlsx 1.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/LICENSE +23 -0
- package/README.md +230 -0
- package/dist/core/address.d.ts +49 -0
- package/dist/core/address.js +125 -0
- package/dist/core/autofilter.d.ts +55 -0
- package/dist/core/autofilter.js +48 -0
- package/dist/core/cell.d.ts +132 -0
- package/dist/core/cell.js +249 -0
- package/dist/core/color-resolution.d.ts +58 -0
- package/dist/core/color-resolution.js +170 -0
- package/dist/core/column.d.ts +87 -0
- package/dist/core/column.js +167 -0
- package/dist/core/comment-thread.d.ts +116 -0
- package/dist/core/comment-thread.js +62 -0
- package/dist/core/conditional-formatting-overlay.d.ts +15 -0
- package/dist/core/conditional-formatting-overlay.js +24 -0
- package/dist/core/conditional-formatting.d.ts +70 -0
- package/dist/core/conditional-formatting.js +35 -0
- package/dist/core/containers.d.ts +2 -0
- package/dist/core/containers.js +25 -0
- package/dist/core/data-validation-overlay.d.ts +28 -0
- package/dist/core/data-validation-overlay.js +56 -0
- package/dist/core/data-validation.d.ts +38 -0
- package/dist/core/data-validation.js +13 -0
- package/dist/core/date.d.ts +25 -0
- package/dist/core/date.js +58 -0
- package/dist/core/formula.d.ts +49 -0
- package/dist/core/formula.js +319 -0
- package/dist/core/grid-edits.d.ts +22 -0
- package/dist/core/grid-edits.js +206 -0
- package/dist/core/image.d.ts +76 -0
- package/dist/core/image.js +65 -0
- package/dist/core/internal.d.ts +11 -0
- package/dist/core/internal.js +29 -0
- package/dist/core/merge.d.ts +13 -0
- package/dist/core/merge.js +26 -0
- package/dist/core/modern-functions.d.ts +1 -0
- package/dist/core/modern-functions.js +165 -0
- package/dist/core/page-setup.d.ts +94 -0
- package/dist/core/page-setup.js +6 -0
- package/dist/core/pivot-table.d.ts +113 -0
- package/dist/core/pivot-table.js +249 -0
- package/dist/core/preserved.d.ts +58 -0
- package/dist/core/preserved.js +5 -0
- package/dist/core/protection.d.ts +67 -0
- package/dist/core/protection.js +68 -0
- package/dist/core/range.d.ts +112 -0
- package/dist/core/range.js +283 -0
- package/dist/core/row.d.ts +73 -0
- package/dist/core/row.js +135 -0
- package/dist/core/style.d.ts +246 -0
- package/dist/core/style.js +125 -0
- package/dist/core/table-style.d.ts +67 -0
- package/dist/core/table-style.js +90 -0
- package/dist/core/table.d.ts +194 -0
- package/dist/core/table.js +291 -0
- package/dist/core/theme.d.ts +90 -0
- package/dist/core/theme.js +272 -0
- package/dist/core/value.d.ts +115 -0
- package/dist/core/value.js +144 -0
- package/dist/core/workbook-protection.d.ts +27 -0
- package/dist/core/workbook-protection.js +25 -0
- package/dist/core/workbook.d.ts +528 -0
- package/dist/core/workbook.js +732 -0
- package/dist/core/worksheet-model.d.ts +34 -0
- package/dist/core/worksheet-model.js +100 -0
- package/dist/core/worksheet.d.ts +647 -0
- package/dist/core/worksheet.js +1025 -0
- package/dist/customui/errors.d.ts +15 -0
- package/dist/customui/errors.js +15 -0
- package/dist/customui/index.d.ts +2 -0
- package/dist/customui/index.js +7 -0
- package/dist/customui/ribbon.d.ts +86 -0
- package/dist/customui/ribbon.js +180 -0
- package/dist/entries/core.d.ts +23 -0
- package/dist/entries/core.js +20 -0
- package/dist/entries/csv.d.ts +2 -0
- package/dist/entries/csv.js +6 -0
- package/dist/entries/customui.d.ts +1 -0
- package/dist/entries/customui.js +3 -0
- package/dist/entries/errors.d.ts +7 -0
- package/dist/entries/errors.js +20 -0
- package/dist/entries/vba.d.ts +2 -0
- package/dist/entries/vba.js +7 -0
- package/dist/entries/xlsb.d.ts +1 -0
- package/dist/entries/xlsb.js +7 -0
- package/dist/entries/xlsx.d.ts +5 -0
- package/dist/entries/xlsx.js +18 -0
- package/dist/errors.d.ts +65 -0
- package/dist/errors.js +66 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +19 -0
- package/dist/io/csv/read.d.ts +15 -0
- package/dist/io/csv/read.js +113 -0
- package/dist/io/csv/write.d.ts +28 -0
- package/dist/io/csv/write.js +124 -0
- package/dist/io/opc/errors.d.ts +46 -0
- package/dist/io/opc/errors.js +49 -0
- package/dist/io/opc/inflate.d.ts +15 -0
- package/dist/io/opc/inflate.js +91 -0
- package/dist/io/opc/namespaces.d.ts +18 -0
- package/dist/io/opc/namespaces.js +18 -0
- package/dist/io/opc/part-paths.d.ts +4 -0
- package/dist/io/opc/part-paths.js +35 -0
- package/dist/io/opc/read-opc.d.ts +24 -0
- package/dist/io/opc/read-opc.js +153 -0
- package/dist/io/opc/read-options.d.ts +10 -0
- package/dist/io/opc/read-options.js +7 -0
- package/dist/io/opc/rels.d.ts +15 -0
- package/dist/io/opc/rels.js +28 -0
- package/dist/io/opc/sniff-format.d.ts +27 -0
- package/dist/io/opc/sniff-format.js +92 -0
- package/dist/io/style/xf-style.d.ts +47 -0
- package/dist/io/style/xf-style.js +95 -0
- package/dist/io/xlsb/errors.d.ts +15 -0
- package/dist/io/xlsb/errors.js +15 -0
- package/dist/io/xlsb/formula.d.ts +48 -0
- package/dist/io/xlsb/formula.js +398 -0
- package/dist/io/xlsb/primitives.d.ts +86 -0
- package/dist/io/xlsb/primitives.js +230 -0
- package/dist/io/xlsb/ptg-functions.d.ts +16 -0
- package/dist/io/xlsb/ptg-functions.js +659 -0
- package/dist/io/xlsb/read-shared-strings.d.ts +2 -0
- package/dist/io/xlsb/read-shared-strings.js +22 -0
- package/dist/io/xlsb/read-styles.d.ts +4 -0
- package/dist/io/xlsb/read-styles.js +386 -0
- package/dist/io/xlsb/read-worksheet.d.ts +9 -0
- package/dist/io/xlsb/read-worksheet.js +301 -0
- package/dist/io/xlsb/read.d.ts +20 -0
- package/dist/io/xlsb/read.js +199 -0
- package/dist/io/xlsb/record-stream.d.ts +14 -0
- package/dist/io/xlsb/record-stream.js +56 -0
- package/dist/io/xlsb/record-types.d.ts +55 -0
- package/dist/io/xlsb/record-types.js +73 -0
- package/dist/io/xlsx/cell-accumulator.d.ts +25 -0
- package/dist/io/xlsx/cell-accumulator.js +172 -0
- package/dist/io/xlsx/cell-value.d.ts +32 -0
- package/dist/io/xlsx/cell-value.js +85 -0
- package/dist/io/xlsx/comments.d.ts +74 -0
- package/dist/io/xlsx/comments.js +243 -0
- package/dist/io/xlsx/conditional-formatting.d.ts +32 -0
- package/dist/io/xlsx/conditional-formatting.js +464 -0
- package/dist/io/xlsx/data-validation.d.ts +20 -0
- package/dist/io/xlsx/data-validation.js +258 -0
- package/dist/io/xlsx/edit-vba.d.ts +23 -0
- package/dist/io/xlsx/edit-vba.js +139 -0
- package/dist/io/xlsx/errors.d.ts +17 -0
- package/dist/io/xlsx/errors.js +17 -0
- package/dist/io/xlsx/hyperlinks.d.ts +42 -0
- package/dist/io/xlsx/hyperlinks.js +139 -0
- package/dist/io/xlsx/images.d.ts +34 -0
- package/dist/io/xlsx/images.js +218 -0
- package/dist/io/xlsx/namespaces.d.ts +55 -0
- package/dist/io/xlsx/namespaces.js +55 -0
- package/dist/io/xlsx/package-plan.d.ts +103 -0
- package/dist/io/xlsx/package-plan.js +168 -0
- package/dist/io/xlsx/pivot-read.d.ts +5 -0
- package/dist/io/xlsx/pivot-read.js +134 -0
- package/dist/io/xlsx/pivot.d.ts +12 -0
- package/dist/io/xlsx/pivot.js +141 -0
- package/dist/io/xlsx/read-rows.d.ts +85 -0
- package/dist/io/xlsx/read-rows.js +286 -0
- package/dist/io/xlsx/read-styles.d.ts +8 -0
- package/dist/io/xlsx/read-styles.js +551 -0
- package/dist/io/xlsx/read-worksheet.d.ts +4 -0
- package/dist/io/xlsx/read-worksheet.js +528 -0
- package/dist/io/xlsx/read.d.ts +32 -0
- package/dist/io/xlsx/read.js +680 -0
- package/dist/io/xlsx/relationships.d.ts +33 -0
- package/dist/io/xlsx/relationships.js +47 -0
- package/dist/io/xlsx/rich-runs.d.ts +13 -0
- package/dist/io/xlsx/rich-runs.js +59 -0
- package/dist/io/xlsx/rich-text.d.ts +7 -0
- package/dist/io/xlsx/rich-text.js +23 -0
- package/dist/io/xlsx/shared-formulas.d.ts +6 -0
- package/dist/io/xlsx/shared-formulas.js +52 -0
- package/dist/io/xlsx/shared-strings-read.d.ts +2 -0
- package/dist/io/xlsx/shared-strings-read.js +70 -0
- package/dist/io/xlsx/shared-strings.d.ts +17 -0
- package/dist/io/xlsx/shared-strings.js +50 -0
- package/dist/io/xlsx/sheet-properties.d.ts +13 -0
- package/dist/io/xlsx/sheet-properties.js +211 -0
- package/dist/io/xlsx/styles.d.ts +138 -0
- package/dist/io/xlsx/styles.js +821 -0
- package/dist/io/xlsx/tables.d.ts +9 -0
- package/dist/io/xlsx/tables.js +208 -0
- package/dist/io/xlsx/threaded-comments.d.ts +102 -0
- package/dist/io/xlsx/threaded-comments.js +308 -0
- package/dist/io/xlsx/workbook-xml.d.ts +12 -0
- package/dist/io/xlsx/workbook-xml.js +353 -0
- package/dist/io/xlsx/worksheet-xml.d.ts +86 -0
- package/dist/io/xlsx/worksheet-xml.js +643 -0
- package/dist/io/xlsx/write-stream.d.ts +171 -0
- package/dist/io/xlsx/write-stream.js +399 -0
- package/dist/io/xlsx/write.d.ts +81 -0
- package/dist/io/xlsx/write.js +396 -0
- package/dist/io/xlsx/x14-ext.d.ts +9 -0
- package/dist/io/xlsx/x14-ext.js +12 -0
- package/dist/vba/cfb-writer.d.ts +19 -0
- package/dist/vba/cfb-writer.js +277 -0
- package/dist/vba/cfb.d.ts +16 -0
- package/dist/vba/cfb.js +324 -0
- package/dist/vba/codepage.d.ts +18 -0
- package/dist/vba/codepage.js +87 -0
- package/dist/vba/errors.d.ts +24 -0
- package/dist/vba/errors.js +24 -0
- package/dist/vba/index.d.ts +5 -0
- package/dist/vba/index.js +15 -0
- package/dist/vba/ms-ovba.d.ts +12 -0
- package/dist/vba/ms-ovba.js +176 -0
- package/dist/vba/project-editor.d.ts +62 -0
- package/dist/vba/project-editor.js +377 -0
- package/dist/vba/project.d.ts +45 -0
- package/dist/vba/project.js +160 -0
- package/dist/vba/vba-encoding.d.ts +14 -0
- package/dist/vba/vba-encoding.js +39 -0
- package/dist/xml/errors.d.ts +15 -0
- package/dist/xml/errors.js +15 -0
- package/dist/xml/xml-read.d.ts +107 -0
- package/dist/xml/xml-read.js +283 -0
- package/dist/xml/xml.d.ts +41 -0
- package/dist/xml/xml.js +86 -0
- package/package.json +117 -0
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
import { type CustomUiDocument } from '../customui/index.ts';
|
|
2
|
+
import { type VbaLibraryReference, type VbaProject, type VbaProjectSignature } from '../vba/index.ts';
|
|
3
|
+
import { type Person } from './comment-thread.ts';
|
|
4
|
+
import { type WorkbookImage } from './image.ts';
|
|
5
|
+
import { INTERNAL } from './internal.ts';
|
|
6
|
+
import type { PreservedPart, PreservedRootReference } from './preserved.ts';
|
|
7
|
+
import type { Color, Font, NamedCellStyle, TableStyleTable } from './style.ts';
|
|
8
|
+
import { type TableStyle } from './table-style.ts';
|
|
9
|
+
import { type ThemeColorScheme, type ThemeFontScheme, type ThemeOverrides } from './theme.ts';
|
|
10
|
+
import type { WorkbookProtection } from './workbook-protection.ts';
|
|
11
|
+
import { Worksheet, type WorksheetState } from './worksheet.ts';
|
|
12
|
+
/**
|
|
13
|
+
* A workbook-level reference to package content the model does not model — a pivot cache
|
|
14
|
+
* (`pivotCacheDefinition`) or a slicer cache (`slicerCache`) — preserved verbatim across a round-trip
|
|
15
|
+
* instead of being dropped. `relType` is the workbook relationship Type URI to re-emit; `entryPath`
|
|
16
|
+
* is the part it points at; `parts` is the transitive closure that reference reaches (the entry
|
|
17
|
+
* included). `pivotCacheId` carries the `<pivotCache cacheId>` a pivot cache is registered under in
|
|
18
|
+
* the workbook's `<pivotCaches>`, so the wiring a pivot table resolves its cache through is re-emitted
|
|
19
|
+
* too; it is absent for a slicer cache, which the workbook lists in an extension block instead.
|
|
20
|
+
* `externalReferenceIndex` is the 0-based position of an `externalLink` within the workbook's
|
|
21
|
+
* `<externalReferences>` — the `[n]` a formula or defined name resolves an external cell through — so
|
|
22
|
+
* the block is re-emitted in the original order and every `[n]` still points at the same linked
|
|
23
|
+
* workbook; it is absent for a pivot/slicer cache.
|
|
24
|
+
*/
|
|
25
|
+
export interface PreservedWorkbookReference {
|
|
26
|
+
readonly relType: string;
|
|
27
|
+
readonly entryPath: string;
|
|
28
|
+
readonly parts: readonly PreservedPart[];
|
|
29
|
+
readonly pivotCacheId?: string;
|
|
30
|
+
readonly externalReferenceIndex?: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The workbook's theme part, captured verbatim from a source package — the `<clrScheme>`,
|
|
34
|
+
* `<fontScheme>`, and `<fmtScheme>` every `theme="n"` colour reference and every `scheme="major|minor"`
|
|
35
|
+
* font in the file resolves against.
|
|
36
|
+
*
|
|
37
|
+
* Held opaquely, like {@link Workbook.restoreDifferentialStyles}'s `<dxf>` fragments: the model does
|
|
38
|
+
* not interpret the theme, it only refuses to destroy it. `entryPath` is where the source package held
|
|
39
|
+
* the part (reached through the workbook's `.../theme` relationship, so not necessarily
|
|
40
|
+
* `xl/theme/theme1.xml`), and `parts` is the transitive closure it reaches — the entry included. The
|
|
41
|
+
* closure matters because a theme can carry its own relationships: a picture used as a themed fill is
|
|
42
|
+
* wired by an `r:embed` into the theme's rels part, and re-emitting the theme without it would leave
|
|
43
|
+
* that reference dangling.
|
|
44
|
+
*/
|
|
45
|
+
export interface PreservedTheme {
|
|
46
|
+
readonly entryPath: string;
|
|
47
|
+
readonly parts: readonly PreservedPart[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The workbook's saved window state — OOXML's `<workbookView>`, the single entry of `<bookViews>`.
|
|
51
|
+
*
|
|
52
|
+
* This is the rect a consumer restores the document window to, and the layout every pane geometry is
|
|
53
|
+
* computed against: a frozen split is positioned within it. `activeTab` names the sheet whose tab is
|
|
54
|
+
* selected on open.
|
|
55
|
+
*
|
|
56
|
+
* The position and size are in twips (1/20 of a point), Excel's window unit. A slightly negative
|
|
57
|
+
* `x`/`y` is normal and is what Excel itself writes — a maximised window's frame sits just outside the
|
|
58
|
+
* work area.
|
|
59
|
+
*/
|
|
60
|
+
export interface WorkbookView {
|
|
61
|
+
/** Left edge of the document window, in twips. */
|
|
62
|
+
x: number;
|
|
63
|
+
/** Top edge of the document window, in twips. */
|
|
64
|
+
y: number;
|
|
65
|
+
/** Window width, in twips. */
|
|
66
|
+
width: number;
|
|
67
|
+
/** Window height, in twips. */
|
|
68
|
+
height: number;
|
|
69
|
+
/** 0-based index into {@link Workbook.worksheets} of the sheet selected on open. */
|
|
70
|
+
activeTab: number;
|
|
71
|
+
/** Window visibility; omit for a normally visible window. */
|
|
72
|
+
visibility?: 'visible' | 'hidden' | 'veryHidden';
|
|
73
|
+
/** Whether the document window opens minimised; omit for a restored window. */
|
|
74
|
+
minimized?: boolean;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The window geometry a workbook starts from — the values desktop Excel writes for its own default
|
|
78
|
+
* window.
|
|
79
|
+
*
|
|
80
|
+
* A default is emitted rather than the element left out because Excel writes `<bookViews>` into every
|
|
81
|
+
* file it saves and consumers lay panes out against that rect. With no view at all the frozen-pane
|
|
82
|
+
* split is computed against an uninitialised window, and the frozen region can stay unpainted until
|
|
83
|
+
* some later event forces a relayout.
|
|
84
|
+
*/
|
|
85
|
+
export declare const DEFAULT_WORKBOOK_VIEW: {
|
|
86
|
+
readonly x: -110;
|
|
87
|
+
readonly y: -110;
|
|
88
|
+
readonly width: 19420;
|
|
89
|
+
readonly height: 12220;
|
|
90
|
+
readonly activeTab: 0;
|
|
91
|
+
};
|
|
92
|
+
/** Document-level metadata written to the package's core properties. */
|
|
93
|
+
export interface WorkbookProperties {
|
|
94
|
+
creator?: string;
|
|
95
|
+
lastModifiedBy?: string;
|
|
96
|
+
created?: Date;
|
|
97
|
+
modified?: Date;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* A named reference in the workbook — the entries Excel surfaces in its Name Manager. A name maps
|
|
101
|
+
* an identifier to a formula (`refersTo`), most often a cell range like `Sheet1!$A$1:$B$2` but
|
|
102
|
+
* possibly any formula. A name is global to the workbook unless it names a sheet in {@link scope},
|
|
103
|
+
* which restricts it to that sheet and lets another sheet reuse the same name independently.
|
|
104
|
+
*/
|
|
105
|
+
export interface DefinedName {
|
|
106
|
+
/** The name as typed in a formula, e.g. `"TaxRate"`. Built-in names carry an `_xlnm.` prefix. */
|
|
107
|
+
readonly name: string;
|
|
108
|
+
/** The formula the name resolves to, e.g. `"Sheet1!$A$1:$B$2"`. */
|
|
109
|
+
readonly refersTo: string;
|
|
110
|
+
/** The sheet the name is scoped to; omit for a workbook-global name. */
|
|
111
|
+
readonly scope?: string;
|
|
112
|
+
/** A human note shown beside the name in Excel's Name Manager. */
|
|
113
|
+
readonly comment?: string;
|
|
114
|
+
/** Hide the name from the Name Manager UI without removing it. */
|
|
115
|
+
readonly hidden?: boolean;
|
|
116
|
+
}
|
|
117
|
+
export interface AddWorksheetOptions {
|
|
118
|
+
readonly state?: WorksheetState['state'];
|
|
119
|
+
}
|
|
120
|
+
/** A picture registered on the workbook, ready to be anchored to a worksheet. */
|
|
121
|
+
export interface AddImageOptions {
|
|
122
|
+
/** The image bytes. */
|
|
123
|
+
readonly buffer: Uint8Array;
|
|
124
|
+
/** The file kind — `"png"`, `"jpeg"`/`"jpg"`, `"gif"`, … A leading dot or a URL query string is
|
|
125
|
+
* tolerated and stripped; omit it entirely to infer the kind from the bytes' magic number. */
|
|
126
|
+
readonly extension?: string;
|
|
127
|
+
}
|
|
128
|
+
export declare class Workbook {
|
|
129
|
+
#private;
|
|
130
|
+
readonly properties: WorkbookProperties;
|
|
131
|
+
/**
|
|
132
|
+
* The workbook's window state — position, size, and the selected sheet. Always present (see
|
|
133
|
+
* {@link DEFAULT_WORKBOOK_VIEW} for why it is defaulted rather than left unset) and always written.
|
|
134
|
+
* Reading a file replaces it with that file's saved geometry, so a round-trip restores the window
|
|
135
|
+
* the author left rather than stamping ours over it.
|
|
136
|
+
*/
|
|
137
|
+
readonly view: WorkbookView;
|
|
138
|
+
/**
|
|
139
|
+
* Ask consuming spreadsheet apps to recalculate every formula when the file is opened, rather than
|
|
140
|
+
* trusting the cached results stored with each formula cell. Set this when the producer cannot
|
|
141
|
+
* compute formula results itself — the OOXML `fullCalcOnLoad` flag. Off by default, so a workbook
|
|
142
|
+
* whose cached results are authoritative stays unmarked.
|
|
143
|
+
*/
|
|
144
|
+
fullCalcOnLoad: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Workbook-level structure/window protection — the OOXML `<workbookProtection>` element. Absent by
|
|
147
|
+
* default (an unprotected workbook). Set it to lock the workbook shell, or leave it as read from a
|
|
148
|
+
* file so a protected workbook stays locked across a passthrough save rather than being silently
|
|
149
|
+
* unlocked. Distinct from a worksheet's own `protect()`, which guards a single sheet's cells.
|
|
150
|
+
*/
|
|
151
|
+
protection: WorkbookProtection | undefined;
|
|
152
|
+
/** The worksheets in insertion order. */
|
|
153
|
+
get worksheets(): readonly Worksheet[];
|
|
154
|
+
/**
|
|
155
|
+
* The 0-based index of the active sheet: {@link WorkbookView.activeTab} resolved against the sheets
|
|
156
|
+
* that actually exist. Exactly one sheet is always active — an out-of-range tab (a caller's stale
|
|
157
|
+
* index, or a file whose sheet was removed after the view was saved) falls back to the first sheet
|
|
158
|
+
* rather than to none, because a package where no sheet is selected gives the consumer no view to
|
|
159
|
+
* initialise on open.
|
|
160
|
+
*/
|
|
161
|
+
get activeTabIndex(): number;
|
|
162
|
+
/** The workbook-level preserved references, in the order they were read. */
|
|
163
|
+
get preservedReferences(): readonly PreservedWorkbookReference[];
|
|
164
|
+
/** The package-root preserved references, in the order they were read. */
|
|
165
|
+
get preservedRootReferences(): readonly PreservedRootReference[];
|
|
166
|
+
/**
|
|
167
|
+
* The ribbon customisations decoded from this workbook's `customUI` parts — `customUI.xml` (Office
|
|
168
|
+
* 2007) and/or `customUI14.xml` (Office 2010+), in the order their root relationships were read. Each
|
|
169
|
+
* {@link CustomUiDocument} is tagged with its dialect and exposes the parsed `<ribbon>` tree. Empty
|
|
170
|
+
* for a workbook that customises no ribbon.
|
|
171
|
+
*
|
|
172
|
+
* This is a **read-only view** over parts the writer already round-trips verbatim — mutating the
|
|
173
|
+
* returned objects changes nothing on write; the original `customUI` XML is re-emitted byte-for-byte
|
|
174
|
+
* regardless. Parsed lazily on first access and memoised.
|
|
175
|
+
*
|
|
176
|
+
* @throws {@link CustomUiParseError} if a `customUI` part is present but its XML is malformed.
|
|
177
|
+
*/
|
|
178
|
+
get customUI(): readonly CustomUiDocument[];
|
|
179
|
+
/**
|
|
180
|
+
* The VBA project decoded from this workbook's preserved `vbaProject.bin`, or `undefined` for a
|
|
181
|
+
* workbook with no macros. This is a **read-only view** over the bytes the writer already round-trips
|
|
182
|
+
* verbatim — mutating the returned object changes nothing on write; the original macro blob is
|
|
183
|
+
* re-emitted byte-for-byte regardless. Parsed lazily on first access and memoised.
|
|
184
|
+
*
|
|
185
|
+
* @throws {@link VbaParseError} if a macro project is present but its `vbaProject.bin` is malformed.
|
|
186
|
+
*/
|
|
187
|
+
get vbaProject(): VbaProject | undefined;
|
|
188
|
+
/**
|
|
189
|
+
* The raw `vbaProject.bin` bytes attached to this workbook — the exact macro blob the writer will
|
|
190
|
+
* embed — or `undefined` for a workbook with no macros. The getter returns a defensive copy, so
|
|
191
|
+
* mutating it changes nothing on write.
|
|
192
|
+
*
|
|
193
|
+
* Assigning bytes attaches (or replaces) the macro project: the written package becomes
|
|
194
|
+
* macro-enabled and re-embeds these bytes verbatim. The bytes must be a well-formed VBA container
|
|
195
|
+
* (a CFB holding a `dir` stream); a malformed blob is rejected with {@link VbaParseError} rather
|
|
196
|
+
* than written out to produce a package Excel would flag for repair. This is the attach-blob path:
|
|
197
|
+
* copy a project between workbooks with `dst.vbaProjectBytes = src.vbaProjectBytes`, or import a
|
|
198
|
+
* `.bin` produced by another tool. Assigning `undefined` removes the project, reverting the workbook
|
|
199
|
+
* to a plain (non-macro) package.
|
|
200
|
+
*
|
|
201
|
+
* Replacing or removing the project also drops any digital signature the previous blob carried — a
|
|
202
|
+
* signature over the old bytes cannot validate new ones — so the result never advertises a broken
|
|
203
|
+
* signature.
|
|
204
|
+
*/
|
|
205
|
+
get vbaProjectBytes(): Uint8Array | undefined;
|
|
206
|
+
set vbaProjectBytes(bytes: Uint8Array | undefined);
|
|
207
|
+
/**
|
|
208
|
+
* Whether this workbook's VBA project carries a digital signature — `true` if any signature part is
|
|
209
|
+
* attached, `false` for an unsigned project or a workbook with no macros.
|
|
210
|
+
*
|
|
211
|
+
* This reflects the **presence** of a signature blob, not its cryptographic validity: the library
|
|
212
|
+
* neither parses the PKCS#7/CMS structure nor validates the certificate chain or signer. A `true`
|
|
213
|
+
* here means "a signature is attached," never "this signature is valid." Replacing or editing the
|
|
214
|
+
* project drops its signatures (a signature over the old bytes cannot validate new ones), so this
|
|
215
|
+
* reads `false` again after {@link vbaProjectBytes}, {@link removeVbaModule}, or
|
|
216
|
+
* {@link addVbaReference} mutates the project. See {@link vbaProjectSignatures} for the raw bytes and
|
|
217
|
+
* which generation(s) are present.
|
|
218
|
+
*/
|
|
219
|
+
get vbaProjectSigned(): boolean;
|
|
220
|
+
/**
|
|
221
|
+
* The digital signatures attached to this workbook's VBA project, in the order their relationships
|
|
222
|
+
* are wired off `vbaProject.bin` — up to three generations (legacy, agile, V3) can coexist over the
|
|
223
|
+
* same project bytes. Empty for an unsigned project or a workbook with no macros.
|
|
224
|
+
*
|
|
225
|
+
* Each entry's `bytes` are the raw signature blob passed through verbatim; the library does not parse
|
|
226
|
+
* or verify them (see {@link vbaProjectSigned} on presence-vs-validity). Hand a blob to an external
|
|
227
|
+
* verifier if you need cryptographic validation — that is deliberately out of this library's scope.
|
|
228
|
+
*/
|
|
229
|
+
get vbaProjectSignatures(): readonly VbaProjectSignature[];
|
|
230
|
+
/**
|
|
231
|
+
* Remove a standard module from this workbook's existing macro project, in place — a structural splice
|
|
232
|
+
* that leaves every remaining module's compiled p-code untouched (see {@link removeVbaModule}).
|
|
233
|
+
* Replacing the project also drops a stale signature, as {@link vbaProjectBytes} does.
|
|
234
|
+
*
|
|
235
|
+
* Only `procedural` and `class` modules can be removed this way — see {@link removeVbaModule} for why.
|
|
236
|
+
* To author or edit module *source* (which needs real compiled p-code), use the offline
|
|
237
|
+
* `tools/vba-compiler`, then attach its output via {@link vbaProjectBytes}.
|
|
238
|
+
*
|
|
239
|
+
* @throws {@link VbaAuthorError} if the workbook has no macro project, or `name` is not in the project,
|
|
240
|
+
* or names a `document`/`designer` module.
|
|
241
|
+
* @throws {@link VbaParseError} if the attached `vbaProject.bin` is malformed.
|
|
242
|
+
*/
|
|
243
|
+
removeVbaModule(name: string): void;
|
|
244
|
+
/**
|
|
245
|
+
* Add a registered (COM type-library) reference to this workbook's existing macro project, in place.
|
|
246
|
+
* Every existing module, reference, and host-info record rides through unchanged (see
|
|
247
|
+
* {@link addVbaReference}). Replacing the project also drops a stale signature, as
|
|
248
|
+
* {@link vbaProjectBytes} does.
|
|
249
|
+
*
|
|
250
|
+
* @throws {@link VbaAuthorError} if the workbook has no macro project, or any field of `ref` is invalid
|
|
251
|
+
* (see {@link VbaLibraryReference}).
|
|
252
|
+
* @throws {@link VbaParseError} if the attached `vbaProject.bin` is malformed.
|
|
253
|
+
*/
|
|
254
|
+
addVbaReference(ref: VbaLibraryReference): void;
|
|
255
|
+
/** The preserved differential-style (`<dxfs>`) fragments, in index order. */
|
|
256
|
+
get differentialStyles(): readonly string[];
|
|
257
|
+
/** The preserved custom indexed-color palette, in index order; empty when the default palette rules. */
|
|
258
|
+
get indexedColors(): readonly string[];
|
|
259
|
+
/** The preserved most-recently-used colour swatches, in order; empty when the file declared none. */
|
|
260
|
+
get mruColors(): readonly string[];
|
|
261
|
+
/** The preserved `<tableStyles>` block; `styles` is empty when the file declared no custom style. */
|
|
262
|
+
get tableStyles(): TableStyleTable;
|
|
263
|
+
/**
|
|
264
|
+
* Register a custom table style — a named look a table applies to itself by putting that name in
|
|
265
|
+
* {@link TableStyleInfo.name}, exactly as it would name one of Excel's built-in gallery styles.
|
|
266
|
+
*
|
|
267
|
+
* ```ts
|
|
268
|
+
* workbook.addTableStyle({
|
|
269
|
+
* name: 'Harbour',
|
|
270
|
+
* elements: {
|
|
271
|
+
* wholeTable: {border: {top: {style: 'thin'}, bottom: {style: 'thin'}}},
|
|
272
|
+
* headerRow: {font: {bold: true, color: {argb: 'FFFFFFFF'}},
|
|
273
|
+
* fill: {type: 'pattern', pattern: 'solid', bgColor: {argb: 'FFBB2649'}}},
|
|
274
|
+
* firstRowStripe: {fill: {type: 'pattern', pattern: 'solid', bgColor: {argb: 'FFF6E7EB'}}},
|
|
275
|
+
* },
|
|
276
|
+
* });
|
|
277
|
+
* sheet.addTable({name: 'Cargo', ref: 'A1:B3', columns, style: {name: 'Harbour'}});
|
|
278
|
+
* ```
|
|
279
|
+
*
|
|
280
|
+
* Each element's formatting is interned into the workbook's shared differential-style table, so two
|
|
281
|
+
* elements — or a conditional-formatting rule — that paint the same way share one entry.
|
|
282
|
+
*
|
|
283
|
+
* Registering a name a source file already defined **overrides** that definition rather than adding
|
|
284
|
+
* a second one beside it.
|
|
285
|
+
*
|
|
286
|
+
* @throws {@link AuthoringError} if the name is empty, or an element carries a `size` outside the four stripe
|
|
287
|
+
* types, or a `size` is not a positive integer — see {@link checkTableStyle} for why those are
|
|
288
|
+
* refused here rather than silently dropped.
|
|
289
|
+
*/
|
|
290
|
+
addTableStyle(style: TableStyle): void;
|
|
291
|
+
/** The table styles authored on this workbook, in registration order. */
|
|
292
|
+
get customTableStyles(): readonly TableStyle[];
|
|
293
|
+
/** The preserved theme part, or undefined when the workbook rides the library's default theme. */
|
|
294
|
+
get themePart(): PreservedTheme | undefined;
|
|
295
|
+
/**
|
|
296
|
+
* Author the workbook's theme: any subset of the twelve colour-scheme slots, and either of the two
|
|
297
|
+
* typefaces. Merges into what the workbook already has, so branding one accent leaves the other
|
|
298
|
+
* eleven slots alone, and calling it twice accumulates.
|
|
299
|
+
*
|
|
300
|
+
* This is the workbook-wide palette. A cell that names a colour as `theme="4"` — which is what Excel
|
|
301
|
+
* writes whenever a user picks from the theme row of the colour picker — follows `accent1` here, so
|
|
302
|
+
* one call restyles every such cell, chart and table style at once. Colours are `RRGGBB`; a leading
|
|
303
|
+
* `#` and an 8-hex ARGB are both accepted and reduced, and anything else throws rather than writing
|
|
304
|
+
* a value Excel silently renders as flat black.
|
|
305
|
+
*
|
|
306
|
+
* What it does **not** touch: the theme's format scheme — the gradient, line and effect styles that
|
|
307
|
+
* give a theme its texture. Those ride through from the source theme (or the library's default)
|
|
308
|
+
* untouched, because nobody hand-authors gradient stops from a spreadsheet API and regenerating them
|
|
309
|
+
* would replace a designer's work with the Office default. For the same reason a slot left
|
|
310
|
+
* unauthored keeps the source's own encoding, including the `<a:sysClr>` form Excel uses for
|
|
311
|
+
* `dk1`/`lt1` so they follow the viewer's window colours.
|
|
312
|
+
*
|
|
313
|
+
* @throws {@link AuthoringError} if a colour is not 6 or 8 hexadecimal digits.
|
|
314
|
+
*/
|
|
315
|
+
setTheme(overrides: ThemeOverrides): void;
|
|
316
|
+
/**
|
|
317
|
+
* The colour scheme every `theme="n"` reference in this workbook resolves against — anything
|
|
318
|
+
* {@link setTheme} authored, over the preserved theme's `<a:clrScheme>`, over the Office default.
|
|
319
|
+
*
|
|
320
|
+
* Note the slot *order*: `theme="0"` is `lt1` and `theme="1"` is `dk1`, which is not the order the
|
|
321
|
+
* slots appear in the theme part. See {@link THEME_COLOR_SLOTS}.
|
|
322
|
+
*/
|
|
323
|
+
get themeColors(): ThemeColorScheme;
|
|
324
|
+
/** The theme's major (heading) and minor (body) typefaces, authored values over the source's. */
|
|
325
|
+
get themeFonts(): ThemeFontScheme;
|
|
326
|
+
/**
|
|
327
|
+
* The default font as the source package declared it — font id 0 of its styles part, the face every
|
|
328
|
+
* cell that names no font of its own renders in. `undefined` for a workbook authored from scratch or
|
|
329
|
+
* read from a package carrying no styles part: nothing was declared, and the library does not
|
|
330
|
+
* fabricate a declaration on the file's behalf.
|
|
331
|
+
*
|
|
332
|
+
* This is the *round-trip* surface. {@link defaultFont} is what the workbook actually renders in,
|
|
333
|
+
* which is this once anything has been authored over it.
|
|
334
|
+
*/
|
|
335
|
+
get declaredDefaultFont(): Font | undefined;
|
|
336
|
+
/**
|
|
337
|
+
* Author the workbook's default font — the face, size and colour every cell with no font of its own
|
|
338
|
+
* renders in, **empty cells included**. Merges into whatever the workbook already had, so
|
|
339
|
+
* `setDefaultFont({size: 14})` keeps the resolved face and changes only the size, and calling it
|
|
340
|
+
* twice accumulates. This is the one knob that reaches a cell no row or column default can: an
|
|
341
|
+
* untouched cell in an unformatted column.
|
|
342
|
+
*
|
|
343
|
+
* It writes the styles part's font 0 and **nothing else** — in particular it does not rewrite the
|
|
344
|
+
* theme's body typeface. The dependency runs the other way: with no default font authored, font 0
|
|
345
|
+
* follows {@link themeFonts}'s minor face, so `setTheme({fonts: {minor}})` already reaches every
|
|
346
|
+
* unstyled cell and needs no second call here. See {@link defaultFont} for the full chain.
|
|
347
|
+
*
|
|
348
|
+
* @throws {@link AuthoringError} if `size` is not a positive finite number, or `name` is empty — both
|
|
349
|
+
* produce a styles part Excel renders from some other font without ever reporting why.
|
|
350
|
+
*/
|
|
351
|
+
setDefaultFont(font: Font): void;
|
|
352
|
+
/**
|
|
353
|
+
* The font every cell that names none of its own renders in, resolved and complete — what the writer
|
|
354
|
+
* emits as font id 0. Never `undefined`: a workbook always renders in *some* face, and the chain
|
|
355
|
+
* below always reaches one.
|
|
356
|
+
*
|
|
357
|
+
* ```
|
|
358
|
+
* authored default font > authored theme body face > the source file's font 0 > theme body face
|
|
359
|
+
* ```
|
|
360
|
+
*
|
|
361
|
+
* The two authored levels outrank the file because authoring is an explicit act; between them
|
|
362
|
+
* {@link setDefaultFont} wins on the face because it names font 0 outright while
|
|
363
|
+
* {@link setTheme} names it only by implication. With **nothing** authored the file's own font 0
|
|
364
|
+
* passes through verbatim — deliberately, because a producer resolves that face by script and we do
|
|
365
|
+
* not: Excel writes `等线` as font 0 under a theme whose latin body face is `Calibri`, and
|
|
366
|
+
* re-deriving would silently rewrite it.
|
|
367
|
+
*
|
|
368
|
+
* `family` and `scheme` describe the *theme's* body face, so they are carried exactly while the
|
|
369
|
+
* resolved face still is that face and dropped when a caller names another — which is also what
|
|
370
|
+
* Excel writes: a font 0 naming a non-theme face carries no `<scheme>` at all. Either may be stated
|
|
371
|
+
* outright, in which case the caller's word stands.
|
|
372
|
+
*/
|
|
373
|
+
get defaultFont(): Font;
|
|
374
|
+
/**
|
|
375
|
+
* The theme part text this workbook should write, or `undefined` when nothing was authored and the
|
|
376
|
+
* source theme (or the writer's default) should ride through untouched.
|
|
377
|
+
*
|
|
378
|
+
* Authoring generates *over* the existing part rather than from scratch — see
|
|
379
|
+
* {@link applyThemeOverrides} — so a preserved theme keeps its format scheme, its unauthored slots'
|
|
380
|
+
* exact encoding, and the relationships it carries.
|
|
381
|
+
*/
|
|
382
|
+
authoredThemeXml(): string | undefined;
|
|
383
|
+
/**
|
|
384
|
+
* Resolve a colour reference to a concrete 8-hex ARGB string, or `undefined` when it does not
|
|
385
|
+
* resolve to a fixed colour — an `auto` colour, one of the two system indexed colours, or a theme
|
|
386
|
+
* slot this workbook's scheme does not declare.
|
|
387
|
+
*
|
|
388
|
+
* This is a *derived* view, not a rewrite: the {@link Color} stays exactly as its file encoded it,
|
|
389
|
+
* so a round-trip re-emits `theme="4" tint="0.4"` rather than a literal ARGB. Resolving into the
|
|
390
|
+
* model would sever every cell's link to the theme, so recolouring the workbook would stop working,
|
|
391
|
+
* and would inflate the styles table with one distinct colour per shade.
|
|
392
|
+
*
|
|
393
|
+
* A `theme` reference resolves through {@link themeColors}; an `indexed` one through the workbook's
|
|
394
|
+
* custom `<indexedColors>` palette when it declares one, else the built-in legacy palette. A `tint`
|
|
395
|
+
* is applied last.
|
|
396
|
+
*/
|
|
397
|
+
resolveColor(color: Color): string | undefined;
|
|
398
|
+
/** The named cell styles, in index order (index 0 is Normal); empty when only the default exists. */
|
|
399
|
+
get namedStyles(): readonly NamedCellStyle[];
|
|
400
|
+
/**
|
|
401
|
+
* Register an identity a threaded comment can name — an author, or someone `@mentioned` in a message.
|
|
402
|
+
* A message reaches it by {@link Comment.personId}, a mention by {@link Mention.personId}.
|
|
403
|
+
*
|
|
404
|
+
* Keyed by {@link Person.id} alone, so registering the same id twice replaces the entry rather than
|
|
405
|
+
* adding a second: the id is the identity. Registering the same human twice under *different* ids is
|
|
406
|
+
* legitimate and is what Excel itself does — see {@link restorePersons}. The id is normalised to the
|
|
407
|
+
* brace-wrapped upper-case GUID form the format requires, so a `crypto.randomUUID()` is accepted as-is.
|
|
408
|
+
*
|
|
409
|
+
* @throws {SyntaxError} if the id is not a GUID.
|
|
410
|
+
*/
|
|
411
|
+
addPerson(person: Person): void;
|
|
412
|
+
/**
|
|
413
|
+
* The registered threaded-comment identities, in the order they were read. That order carries no
|
|
414
|
+
* meaning — Excel re-sorts the registry by person id when it saves — so nothing may depend on it.
|
|
415
|
+
*/
|
|
416
|
+
get persons(): readonly Person[];
|
|
417
|
+
/** Look up a registered identity by its {@link Person.id}, or `undefined` if the registry has none. */
|
|
418
|
+
getPerson(id: string): Person | undefined;
|
|
419
|
+
/**
|
|
420
|
+
* Register a picture on the workbook and return its numeric id. Pass the id to
|
|
421
|
+
* {@link Worksheet.addImage} to anchor the picture to a sheet; the same id may be anchored on any
|
|
422
|
+
* number of sheets and positions, and the bytes are still stored only once.
|
|
423
|
+
*/
|
|
424
|
+
addImage(options: AddImageOptions): number;
|
|
425
|
+
/** The registered images, indexed by the id {@link addImage} returned. */
|
|
426
|
+
get media(): readonly WorkbookImage[];
|
|
427
|
+
/** Look up a registered image by its id, or `undefined` if no image carries that id. */
|
|
428
|
+
getImage(id: number): WorkbookImage | undefined;
|
|
429
|
+
/** The workbook's defined names, in the order they were registered. */
|
|
430
|
+
get definedNames(): readonly DefinedName[];
|
|
431
|
+
/**
|
|
432
|
+
* Register a defined name on the workbook.
|
|
433
|
+
*
|
|
434
|
+
* @throws {@link AuthoringError} if the name is empty, or if a {@link DefinedName.scope} is given that names no
|
|
435
|
+
* existing worksheet — a scoped name must target a sheet that is already part of the workbook.
|
|
436
|
+
*/
|
|
437
|
+
defineName(definedName: DefinedName): void;
|
|
438
|
+
/**
|
|
439
|
+
* Create a worksheet and append it to the workbook.
|
|
440
|
+
*
|
|
441
|
+
* @throws {@link AuthoringError} if the name is empty, too long, contains a forbidden character,
|
|
442
|
+
* or collides (case-insensitively) with an existing sheet.
|
|
443
|
+
*/
|
|
444
|
+
addWorksheet(name: string, options?: AddWorksheetOptions): Worksheet;
|
|
445
|
+
/** Look up a worksheet by name (case-insensitive) or by numeric id. */
|
|
446
|
+
getWorksheet(nameOrId: string | number): Worksheet | undefined;
|
|
447
|
+
/**
|
|
448
|
+
* The codec's channel into this workbook — see `core/internal.ts` for why these are not public
|
|
449
|
+
* methods. Declared last so every private field it closes over is already in scope.
|
|
450
|
+
*/
|
|
451
|
+
readonly [INTERNAL]: WorkbookInternals;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* What a codec may do to a `Workbook` that an author may not: reinstate state read from a file, in
|
|
455
|
+
* the finished form the file stated it. Reached as `workbook[INTERNAL]`; see `core/internal.ts`.
|
|
456
|
+
*
|
|
457
|
+
* Every operation replaces what it restores rather than merging, because a reader states a table
|
|
458
|
+
* whole — a half-restored `<dxfs>` would leave existing `dxfId` references pointing into a mix of
|
|
459
|
+
* two files.
|
|
460
|
+
*/
|
|
461
|
+
export interface WorkbookInternals {
|
|
462
|
+
/** Record a workbook-level preserved reference (a pivot or slicer cache) read from a file. */
|
|
463
|
+
addPreservedReference(reference: PreservedWorkbookReference): void;
|
|
464
|
+
/** Record a package-root preserved reference (a customUI ribbon part, custom props) read from a file. */
|
|
465
|
+
addPreservedRootReference(reference: PreservedRootReference): void;
|
|
466
|
+
/**
|
|
467
|
+
* Reinstate the differential-style (`<dxfs>`) table read from a file — the deserialization
|
|
468
|
+
* counterpart the writer re-emits verbatim. Each entry is one `<dxf>…</dxf>` fragment, preserved as
|
|
469
|
+
* opaque XML so a conditional-formatting rule's `dxfId` (an index into this table) stays valid on
|
|
470
|
+
* re-write.
|
|
471
|
+
*/
|
|
472
|
+
restoreDifferentialStyles(fragments: readonly string[]): void;
|
|
473
|
+
/**
|
|
474
|
+
* Reinstate the custom indexed-color palette (`<colors><indexedColors>`) read from a file — each
|
|
475
|
+
* entry a verbatim `<rgbColor rgb="…"/>` fragment — so a colour referenced by `indexed="…"` keeps
|
|
476
|
+
* its intended RGB on re-write instead of the palette being dropped and the colour shifting to a
|
|
477
|
+
* default-palette entry.
|
|
478
|
+
*/
|
|
479
|
+
restoreIndexedColors(fragments: readonly string[]): void;
|
|
480
|
+
/**
|
|
481
|
+
* Reinstate the most-recently-used colour swatches (`<colors><mruColors>`) read from a file, each
|
|
482
|
+
* entry a verbatim `<color rgb="…"/>` fragment — the "Recent Colors" row a spreadsheet application
|
|
483
|
+
* offers, which is the author's own working set rather than anything the model interprets.
|
|
484
|
+
*/
|
|
485
|
+
restoreMruColors(fragments: readonly string[]): void;
|
|
486
|
+
/**
|
|
487
|
+
* Reinstate the custom table-style definitions (`<tableStyles>`) read from a file — see
|
|
488
|
+
* {@link TableStyleTable} — so a table whose `styleName` names a custom style still resolves to a
|
|
489
|
+
* real definition on re-write instead of dangling, and the file's nominated default table/pivot
|
|
490
|
+
* styles survive.
|
|
491
|
+
*/
|
|
492
|
+
restoreTableStyles(table: TableStyleTable): void;
|
|
493
|
+
/**
|
|
494
|
+
* Reinstate the theme part read from a file — opaque preserved XML plus the closure of parts it
|
|
495
|
+
* reaches (see {@link PreservedTheme}) — so a workbook's colour and font schemes survive a re-write
|
|
496
|
+
* instead of being replaced by the library's default Office theme. Passing `undefined` drops back
|
|
497
|
+
* to that default.
|
|
498
|
+
*/
|
|
499
|
+
restoreThemePart(theme: PreservedTheme | undefined): void;
|
|
500
|
+
/**
|
|
501
|
+
* Reinstate the named cell styles (`cellStyleXfs`/`cellStyles`) read from a file, index for index,
|
|
502
|
+
* so a cell's link to a named style (its `xfId`) stays valid on re-write. Index 0 is the Normal
|
|
503
|
+
* default.
|
|
504
|
+
*/
|
|
505
|
+
restoreNamedStyles(styles: readonly NamedCellStyle[]): void;
|
|
506
|
+
/**
|
|
507
|
+
* Reinstate font id 0 as a file declared it — the face its unstyled cells render in, and the metric
|
|
508
|
+
* its column widths are expressed in character units of. Restored rather than assumed because the
|
|
509
|
+
* library must not inject its own default ahead of one a file already states: doing so replaces the
|
|
510
|
+
* declared face on every empty cell and silently changes what every `<col width>` means.
|
|
511
|
+
*
|
|
512
|
+
* {@link Workbook.setDefaultFont} is the authoring verb; this is only the file's own word.
|
|
513
|
+
*/
|
|
514
|
+
restoreDefaultFont(font: Font | undefined): void;
|
|
515
|
+
/**
|
|
516
|
+
* Reinstate the threaded-comment identity registry (`xl/persons/person.xml`) read from a file — the
|
|
517
|
+
* authors and mentioned people a comment thread's messages point at.
|
|
518
|
+
*
|
|
519
|
+
* Entries are keyed by {@link Person.id} and by nothing else. A single human legitimately owns
|
|
520
|
+
* several entries: Excel interns a *mentioned* identity as its own `providerId="PeoplePicker"` entry
|
|
521
|
+
* beside that person's `providerId="AD"` authoring entry — same `displayName`, same `userId`, a
|
|
522
|
+
* different id — and points the mention at the new one. Collapsing entries by name or `userId` would
|
|
523
|
+
* merge those two and silently re-point every mention at the wrong identity.
|
|
524
|
+
*
|
|
525
|
+
* {@link Workbook.addPerson} is the authoring verb.
|
|
526
|
+
*/
|
|
527
|
+
restorePersons(persons: readonly Person[]): void;
|
|
528
|
+
}
|