@office-kit/xlsx 0.8.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 +21 -0
- package/README.md +319 -0
- package/THIRD_PARTY_NOTICES.md +56 -0
- package/dist/cell/cell.d.ts +234 -0
- package/dist/cell/index.d.ts +4 -0
- package/dist/cell/rich-text.d.ts +37 -0
- package/dist/cell-D9CaNKnU.mjs +320 -0
- package/dist/cell-D9CaNKnU.mjs.map +1 -0
- package/dist/cell-style-BEDjMX1y.mjs +1579 -0
- package/dist/cell-style-BEDjMX1y.mjs.map +1 -0
- package/dist/cell.mjs +2 -0
- package/dist/chart/chart-xml.d.ts +16 -0
- package/dist/chart/chart.d.ts +735 -0
- package/dist/chart/cx/chartex-xml.d.ts +6 -0
- package/dist/chart/cx/chartex.d.ts +279 -0
- package/dist/chart/index.d.ts +6 -0
- package/dist/chart/user-shapes-xml.d.ts +4 -0
- package/dist/chart/user-shapes.d.ts +61 -0
- package/dist/chart.mjs +232 -0
- package/dist/chart.mjs.map +1 -0
- package/dist/chartsheet/chartsheet-xml.d.ts +17 -0
- package/dist/chartsheet/chartsheet.d.ts +121 -0
- package/dist/chartsheet/index.d.ts +2 -0
- package/dist/chartsheet-C3-tqkPy.mjs +23 -0
- package/dist/chartsheet-C3-tqkPy.mjs.map +1 -0
- package/dist/chartsheet.mjs +2 -0
- package/dist/colors-ovWAwnZI.mjs +67 -0
- package/dist/colors-ovWAwnZI.mjs.map +1 -0
- package/dist/compat/numbers.d.ts +14 -0
- package/dist/coordinate-96Ecci4d.mjs +276 -0
- package/dist/coordinate-96Ecci4d.mjs.map +1 -0
- package/dist/datetime-B2ySVlXt.mjs +71 -0
- package/dist/datetime-B2ySVlXt.mjs.map +1 -0
- package/dist/defined-names-CviWmtQg.mjs +89 -0
- package/dist/defined-names-CviWmtQg.mjs.map +1 -0
- package/dist/differential-D4dg-qtZ.mjs +37 -0
- package/dist/differential-D4dg-qtZ.mjs.map +1 -0
- package/dist/drawing/anchor.d.ts +63 -0
- package/dist/drawing/dml/colors.d.ts +109 -0
- package/dist/drawing/dml/dml-xml.d.ts +35 -0
- package/dist/drawing/dml/effect.d.ts +92 -0
- package/dist/drawing/dml/fill.d.ts +115 -0
- package/dist/drawing/dml/geometry.d.ts +113 -0
- package/dist/drawing/dml/line.d.ts +41 -0
- package/dist/drawing/dml/shape-properties.d.ts +33 -0
- package/dist/drawing/dml/text.d.ts +218 -0
- package/dist/drawing/drawing-xml.d.ts +5 -0
- package/dist/drawing/drawing.d.ts +117 -0
- package/dist/drawing/image.d.ts +40 -0
- package/dist/drawing/index.d.ts +14 -0
- package/dist/drawing-BxzLuryn.mjs +415 -0
- package/dist/drawing-BxzLuryn.mjs.map +1 -0
- package/dist/drawing.mjs +119 -0
- package/dist/drawing.mjs.map +1 -0
- package/dist/escape-DFTE7ZJc.mjs +51 -0
- package/dist/escape-DFTE7ZJc.mjs.map +1 -0
- package/dist/exceptions-D-CFwxgm.mjs +37 -0
- package/dist/exceptions-D-CFwxgm.mjs.map +1 -0
- package/dist/formula/tokenizer.d.ts +61 -0
- package/dist/formula/translate.d.ts +67 -0
- package/dist/inference-B3ES3KEJ.mjs +42 -0
- package/dist/inference-B3ES3KEJ.mjs.map +1 -0
- package/dist/io/browser.d.ts +41 -0
- package/dist/io/index.d.ts +7 -0
- package/dist/io/load.d.ts +46 -0
- package/dist/io/node-fs.d.ts +62 -0
- package/dist/io/node-save.d.ts +3 -0
- package/dist/io/node.d.ts +17 -0
- package/dist/io/save.d.ts +14 -0
- package/dist/io/sink.d.ts +54 -0
- package/dist/io/source.d.ts +14 -0
- package/dist/io.mjs +212 -0
- package/dist/io.mjs.map +1 -0
- package/dist/load-D5cbhoGx.mjs +1069 -0
- package/dist/load-D5cbhoGx.mjs.map +1 -0
- package/dist/manifest-Dps1-OpP.mjs +801 -0
- package/dist/manifest-Dps1-OpP.mjs.map +1 -0
- package/dist/node.d.ts +3 -0
- package/dist/node.mjs +308 -0
- package/dist/node.mjs.map +1 -0
- package/dist/packaging/core.d.ts +45 -0
- package/dist/packaging/custom.d.ts +62 -0
- package/dist/packaging/extended.d.ts +45 -0
- package/dist/packaging/index.d.ts +10 -0
- package/dist/packaging/manifest.d.ts +24 -0
- package/dist/packaging/relationships.d.ts +30 -0
- package/dist/packaging.mjs +2 -0
- package/dist/parser-DuLejQy1.mjs +156 -0
- package/dist/parser-DuLejQy1.mjs.map +1 -0
- package/dist/reader-D1fNW9k1.mjs +534 -0
- package/dist/reader-D1fNW9k1.mjs.map +1 -0
- package/dist/save-RohQtgEZ.mjs +745 -0
- package/dist/save-RohQtgEZ.mjs.map +1 -0
- package/dist/schema/core.d.ts +133 -0
- package/dist/schema/index.d.ts +3 -0
- package/dist/schema/serialize.d.ts +6 -0
- package/dist/schema.mjs +2 -0
- package/dist/serialize-55EnT30e.mjs +254 -0
- package/dist/serialize-55EnT30e.mjs.map +1 -0
- package/dist/serializer-BwbgHYJV.mjs +116 -0
- package/dist/serializer-BwbgHYJV.mjs.map +1 -0
- package/dist/streaming/index.d.ts +2 -0
- package/dist/streaming/read-only.d.ts +38 -0
- package/dist/streaming/write-only.d.ts +47 -0
- package/dist/streaming.mjs +612 -0
- package/dist/streaming.mjs.map +1 -0
- package/dist/styles/alignment.d.ts +33 -0
- package/dist/styles/alignment.schema.d.ts +3 -0
- package/dist/styles/borders.d.ts +40 -0
- package/dist/styles/borders.schema.d.ts +4 -0
- package/dist/styles/cell-style.d.ts +270 -0
- package/dist/styles/colors.d.ts +128 -0
- package/dist/styles/colors.schema.d.ts +3 -0
- package/dist/styles/differential.d.ts +41 -0
- package/dist/styles/fills.d.ts +54 -0
- package/dist/styles/fills.schema.d.ts +6 -0
- package/dist/styles/fonts.d.ts +44 -0
- package/dist/styles/fonts.schema.d.ts +3 -0
- package/dist/styles/index.d.ts +21 -0
- package/dist/styles/named-styles.d.ts +52 -0
- package/dist/styles/numbers.d.ts +39 -0
- package/dist/styles/numbers.schema.d.ts +3 -0
- package/dist/styles/protection.d.ts +9 -0
- package/dist/styles/protection.schema.d.ts +3 -0
- package/dist/styles/stylesheet-reader.d.ts +7 -0
- package/dist/styles/stylesheet-writer.d.ts +3 -0
- package/dist/styles/stylesheet.d.ts +95 -0
- package/dist/styles.mjs +4 -0
- package/dist/stylesheet-writer-C2eRmn22.mjs +8624 -0
- package/dist/stylesheet-writer-C2eRmn22.mjs.map +1 -0
- package/dist/table-DkX6UniA.mjs +113 -0
- package/dist/table-DkX6UniA.mjs.map +1 -0
- package/dist/tree-Bbs1C8Rc.mjs +192 -0
- package/dist/tree-Bbs1C8Rc.mjs.map +1 -0
- package/dist/units-rOMQqXh2.mjs +41 -0
- package/dist/units-rOMQqXh2.mjs.map +1 -0
- package/dist/user-shapes-DfmCGKB0.mjs +252 -0
- package/dist/user-shapes-DfmCGKB0.mjs.map +1 -0
- package/dist/utf8-D91g1XTG.mjs +143 -0
- package/dist/utf8-D91g1XTG.mjs.map +1 -0
- package/dist/utils/coordinate.d.ts +103 -0
- package/dist/utils/css.d.ts +18 -0
- package/dist/utils/datetime.d.ts +38 -0
- package/dist/utils/escape.d.ts +34 -0
- package/dist/utils/exceptions.d.ts +34 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/inference.d.ts +24 -0
- package/dist/utils/stable-stringify.d.ts +7 -0
- package/dist/utils/units.d.ts +14 -0
- package/dist/utils/utf8.d.ts +1 -0
- package/dist/utils.mjs +39 -0
- package/dist/utils.mjs.map +1 -0
- package/dist/workbook/calc-properties.d.ts +47 -0
- package/dist/workbook/defined-names.d.ts +121 -0
- package/dist/workbook/file-recovery.d.ts +11 -0
- package/dist/workbook/file-sharing.d.ts +14 -0
- package/dist/workbook/file-version.d.ts +13 -0
- package/dist/workbook/function-groups.d.ts +10 -0
- package/dist/workbook/index.d.ts +24 -0
- package/dist/workbook/protection.d.ts +35 -0
- package/dist/workbook/shared-strings.d.ts +57 -0
- package/dist/workbook/smart-tags.d.ts +13 -0
- package/dist/workbook/views.d.ts +89 -0
- package/dist/workbook/workbook-properties.d.ts +57 -0
- package/dist/workbook/workbook.d.ts +643 -0
- package/dist/workbook-HGYNRBlV.mjs +636 -0
- package/dist/workbook-HGYNRBlV.mjs.map +1 -0
- package/dist/workbook.mjs +58 -0
- package/dist/workbook.mjs.map +1 -0
- package/dist/worksheet/auto-filter.d.ts +34 -0
- package/dist/worksheet/cell-range.d.ts +121 -0
- package/dist/worksheet/comments-xml.d.ts +24 -0
- package/dist/worksheet/comments.d.ts +13 -0
- package/dist/worksheet/conditional-formatting.d.ts +150 -0
- package/dist/worksheet/custom-sheet-views.d.ts +43 -0
- package/dist/worksheet/data-consolidate.d.ts +29 -0
- package/dist/worksheet/data-validations.d.ts +72 -0
- package/dist/worksheet/dimensions.d.ts +40 -0
- package/dist/worksheet/errors.d.ts +40 -0
- package/dist/worksheet/hyperlinks.d.ts +42 -0
- package/dist/worksheet/index.d.ts +46 -0
- package/dist/worksheet/ole-objects.d.ts +37 -0
- package/dist/worksheet/page-setup.d.ts +173 -0
- package/dist/worksheet/phonetic.d.ts +11 -0
- package/dist/worksheet/properties.d.ts +34 -0
- package/dist/worksheet/protected-ranges.d.ts +19 -0
- package/dist/worksheet/protection.d.ts +44 -0
- package/dist/worksheet/reader.d.ts +38 -0
- package/dist/worksheet/scenarios.d.ts +36 -0
- package/dist/worksheet/smart-tags.d.ts +23 -0
- package/dist/worksheet/sort-state.d.ts +28 -0
- package/dist/worksheet/table-xml.d.ts +5 -0
- package/dist/worksheet/table.d.ts +80 -0
- package/dist/worksheet/views.d.ts +47 -0
- package/dist/worksheet/web-publish.d.ts +21 -0
- package/dist/worksheet/worksheet.d.ts +935 -0
- package/dist/worksheet/writer.d.ts +72 -0
- package/dist/worksheet-CmCNoIgD.mjs +1726 -0
- package/dist/worksheet-CmCNoIgD.mjs.map +1 -0
- package/dist/worksheet.mjs +247 -0
- package/dist/worksheet.mjs.map +1 -0
- package/dist/writer-DspzfkNA.mjs +221 -0
- package/dist/writer-DspzfkNA.mjs.map +1 -0
- package/dist/xml/index.d.ts +10 -0
- package/dist/xml/iterparse.d.ts +22 -0
- package/dist/xml/namespaces.d.ts +91 -0
- package/dist/xml/parser.d.ts +7 -0
- package/dist/xml/serializer.d.ts +14 -0
- package/dist/xml/stream-writer.d.ts +39 -0
- package/dist/xml/tree.d.ts +37 -0
- package/dist/xml.mjs +140 -0
- package/dist/xml.mjs.map +1 -0
- package/dist/zip/decompression-guard.d.ts +70 -0
- package/dist/zip/index.d.ts +6 -0
- package/dist/zip/random-access-reader.d.ts +16 -0
- package/dist/zip/reader.d.ts +45 -0
- package/dist/zip/writer.d.ts +65 -0
- package/dist/zip/zip64-patch.d.ts +12 -0
- package/dist/zip.mjs +3 -0
- package/package.json +147 -0
|
@@ -0,0 +1,643 @@
|
|
|
1
|
+
import type { Chartsheet } from '../chartsheet/chartsheet';
|
|
2
|
+
import { type ChartReference } from '../drawing/drawing';
|
|
3
|
+
import type { CoreProperties } from '../packaging/core';
|
|
4
|
+
import type { CustomProperties } from '../packaging/custom';
|
|
5
|
+
import type { ExtendedProperties } from '../packaging/extended';
|
|
6
|
+
import type { Stylesheet } from '../styles/stylesheet';
|
|
7
|
+
import { type CellValue } from '../cell/cell';
|
|
8
|
+
import type { Alignment } from '../styles/alignment';
|
|
9
|
+
import type { Border } from '../styles/borders';
|
|
10
|
+
import type { Fill } from '../styles/fills';
|
|
11
|
+
import type { Font } from '../styles/fonts';
|
|
12
|
+
import type { Protection } from '../styles/protection';
|
|
13
|
+
import type { LegacyComment } from '../worksheet/comments';
|
|
14
|
+
import type { Hyperlink } from '../worksheet/hyperlinks';
|
|
15
|
+
import type { CellsByKindCounts, Worksheet } from '../worksheet/worksheet';
|
|
16
|
+
export type SheetState = 'visible' | 'hidden' | 'veryHidden';
|
|
17
|
+
/**
|
|
18
|
+
* Discriminated union over the two kinds of sheet a workbook can host. Both
|
|
19
|
+
* variants share `title` (via `sheet.title`) plus the OOXML `sheetId` and
|
|
20
|
+
* `state` attributes; consumers narrow on `kind` to reach the worksheet- vs
|
|
21
|
+
* chartsheet-specific data.
|
|
22
|
+
*/
|
|
23
|
+
export type SheetRef = {
|
|
24
|
+
kind: 'worksheet';
|
|
25
|
+
sheet: Worksheet;
|
|
26
|
+
sheetId: number;
|
|
27
|
+
state: SheetState;
|
|
28
|
+
rId?: string;
|
|
29
|
+
} | {
|
|
30
|
+
kind: 'chartsheet';
|
|
31
|
+
sheet: Chartsheet;
|
|
32
|
+
sheetId: number;
|
|
33
|
+
state: SheetState;
|
|
34
|
+
rId?: string;
|
|
35
|
+
};
|
|
36
|
+
export interface Workbook {
|
|
37
|
+
sheets: SheetRef[];
|
|
38
|
+
/** Index into `sheets` of the sheet shown when Excel opens the file. */
|
|
39
|
+
activeSheetIndex: number;
|
|
40
|
+
/** Style pool; cells reference its cellXfs by index. */
|
|
41
|
+
styles: Stylesheet;
|
|
42
|
+
/** Date1904 mode toggles between Excel's two epoch systems. */
|
|
43
|
+
date1904: boolean;
|
|
44
|
+
/** Document properties (docProps/core.xml), typically auto-filled on save. */
|
|
45
|
+
properties?: CoreProperties;
|
|
46
|
+
appProperties?: ExtendedProperties;
|
|
47
|
+
customProperties?: CustomProperties;
|
|
48
|
+
/** Author display names, shared between threaded comments. */
|
|
49
|
+
authors: string[];
|
|
50
|
+
/** Workbook + sheet-scope defined names (named ranges, print areas etc). */
|
|
51
|
+
definedNames: import('./defined-names').DefinedName[];
|
|
52
|
+
/**
|
|
53
|
+
* Raw `xl/theme/theme1.xml` payload kept verbatim across read → write. The
|
|
54
|
+
* theme XML is large and seldom edited by writers; we just shuttle it.
|
|
55
|
+
*/
|
|
56
|
+
themeXml?: Uint8Array;
|
|
57
|
+
/**
|
|
58
|
+
* `xl/vbaProject.bin` payload (macro-enabled workbooks). Round-tripped
|
|
59
|
+
* byte-identical when present; the writer also promotes the workbook Override
|
|
60
|
+
* to `vnd.ms-excel.sheet.macroEnabled.main+xml`.
|
|
61
|
+
*/
|
|
62
|
+
vbaProject?: Uint8Array;
|
|
63
|
+
/** `xl/vbaProjectSignature.bin` payload, when the macros are signed. */
|
|
64
|
+
vbaSignature?: Uint8Array;
|
|
65
|
+
/**
|
|
66
|
+
* Pass-through bytes for parts we don't model (pivot tables, ActiveX
|
|
67
|
+
* controls, OLE embeddings, customUI ribbons, customXml items …). Keys are
|
|
68
|
+
* archive-relative paths; values are the raw bytes the loader pulled out of
|
|
69
|
+
* the zip and the writer pushes back in unchanged.
|
|
70
|
+
*/
|
|
71
|
+
passthrough?: Map<string, Uint8Array>;
|
|
72
|
+
/**
|
|
73
|
+
* Override content type per pass-through path. Excel uses these in
|
|
74
|
+
* `[Content_Types].xml` so manifest validation stays intact across
|
|
75
|
+
* round-trips. Paths without an explicit override fall back to the archive
|
|
76
|
+
* Default extension.
|
|
77
|
+
*/
|
|
78
|
+
passthroughContentTypes?: Map<string, string>;
|
|
79
|
+
/**
|
|
80
|
+
* Top-level `<workbook>` children that aren't `<sheets>` or `<definedNames>`
|
|
81
|
+
* (e.g. `<fileVersion>`, `<workbookPr>`, `<bookViews>`, `<calcPr>`,
|
|
82
|
+
* `<pivotCaches>`, `<extLst>`). Captured verbatim so re-saving keeps
|
|
83
|
+
* Excel-rendering fidelity for things we don't model. Split into the two
|
|
84
|
+
* halves the writer needs: anything before `<sheets>` is emitted ahead of the
|
|
85
|
+
* `<sheets>` element, the rest after `<definedNames>`.
|
|
86
|
+
*/
|
|
87
|
+
workbookXmlExtras?: {
|
|
88
|
+
beforeSheets: import('../xml/tree').XmlNode[];
|
|
89
|
+
afterSheets: import('../xml/tree').XmlNode[];
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* `<workbookProtection>` — locks structure / window / revision tracking with
|
|
93
|
+
* the modern hash quad or the legacy 16-bit hash. Round-tripped verbatim;
|
|
94
|
+
* password hashing helpers come later.
|
|
95
|
+
*/
|
|
96
|
+
workbookProtection?: import('./protection').WorkbookProtection;
|
|
97
|
+
/**
|
|
98
|
+
* `<bookViews>` — the workbook's window/tab-strip presets. Most workbooks
|
|
99
|
+
* have a single entry whose `firstSheet` / `activeTab` drive the tab the user
|
|
100
|
+
* sees first. Stored as an array because Excel allows multiple views (rare).
|
|
101
|
+
*/
|
|
102
|
+
bookViews?: import('./views').WorkbookView[];
|
|
103
|
+
/**
|
|
104
|
+
* `<customWorkbookViews>` — saved per-user view presets used by the
|
|
105
|
+
* deprecated "Shared Workbook" feature. Each entry carries its own window
|
|
106
|
+
* position, active sheet, and visibility toggles.
|
|
107
|
+
*/
|
|
108
|
+
customWorkbookViews?: import('./views').CustomWorkbookView[];
|
|
109
|
+
/** `<calcPr>` — calculation engine settings (calcMode / iterate / fullPrecision etc.). */
|
|
110
|
+
calcProperties?: import('./calc-properties').CalcProperties;
|
|
111
|
+
/** `<fileVersion>` — Office app/version metadata Excel records on save. */
|
|
112
|
+
fileVersion?: import('./file-version').FileVersion;
|
|
113
|
+
/** `<fileSharing>` — read-only-recommended toggle + write-protection password. */
|
|
114
|
+
fileSharing?: import('./file-sharing').FileSharing;
|
|
115
|
+
/**
|
|
116
|
+
* `<oleSize ref="…">` — bounding range Excel uses when the workbook is
|
|
117
|
+
* embedded as an OLE object inside another Office document.
|
|
118
|
+
*/
|
|
119
|
+
oleSize?: string;
|
|
120
|
+
/** `<fileRecoveryPr>` — autoRecover-style flags Excel writes after a recovery save. */
|
|
121
|
+
fileRecoveryPr?: import('./file-recovery').FileRecoveryProperties;
|
|
122
|
+
/**
|
|
123
|
+
* `<pivotCaches>` — links from workbook root to xl/pivotCache parts. The
|
|
124
|
+
* underlying parts survive via the passthrough archive; this typed array
|
|
125
|
+
* preserves the cacheId ↔ rId mapping for consumers that want to introspect
|
|
126
|
+
* the pivot links.
|
|
127
|
+
*/
|
|
128
|
+
pivotCaches?: ReadonlyArray<{
|
|
129
|
+
cacheId: number;
|
|
130
|
+
rId: string;
|
|
131
|
+
}>;
|
|
132
|
+
/**
|
|
133
|
+
* `<externalReferences>` — links from workbook root to xl/externalLinks
|
|
134
|
+
* parts. The numeric token in cross-workbook formulas like `[1]Sheet!A1` is
|
|
135
|
+
* the 1-based index into this array. Underlying parts continue via
|
|
136
|
+
* passthrough archive.
|
|
137
|
+
*/
|
|
138
|
+
externalReferences?: ReadonlyArray<{
|
|
139
|
+
rId: string;
|
|
140
|
+
}>;
|
|
141
|
+
/** `<smartTagPr>` — Excel 2003 smart-tag persistence flags. */
|
|
142
|
+
smartTagPr?: import('./smart-tags').SmartTagProperties;
|
|
143
|
+
/** `<smartTagTypes>` — Excel 2003 smart-tag type registrations. */
|
|
144
|
+
smartTagTypes?: ReadonlyArray<import('./smart-tags').SmartTagType>;
|
|
145
|
+
/** `<functionGroups>` — built-in + user-defined XLL function groups. */
|
|
146
|
+
functionGroups?: import('./function-groups').FunctionGroups;
|
|
147
|
+
/**
|
|
148
|
+
* `<workbookPr>` — VBA codeName, defaultThemeVersion, link-update prompt
|
|
149
|
+
* mode, etc. `date1904` is mirrored here for completeness but the canonical
|
|
150
|
+
* source remains `wb.date1904`.
|
|
151
|
+
*/
|
|
152
|
+
workbookProperties?: import('./workbook-properties').WorkbookProperties;
|
|
153
|
+
/**
|
|
154
|
+
* Workbook-level rels that don't match a modeled type. Re-emitted with their
|
|
155
|
+
* original Id so captured `<pivotCaches r:id="…"/>` etc. still resolve after
|
|
156
|
+
* a round-trip.
|
|
157
|
+
*/
|
|
158
|
+
workbookRelsExtras?: ReadonlyArray<{
|
|
159
|
+
id: string;
|
|
160
|
+
type: string;
|
|
161
|
+
target: string;
|
|
162
|
+
}>;
|
|
163
|
+
/**
|
|
164
|
+
* Original rIds for the modeled non-sheet workbook rels so a captured extras
|
|
165
|
+
* XML referencing one of them still resolves after re-save.
|
|
166
|
+
*/
|
|
167
|
+
workbookRelOriginalIds?: {
|
|
168
|
+
sharedStrings?: string;
|
|
169
|
+
styles?: string;
|
|
170
|
+
theme?: string;
|
|
171
|
+
vbaProject?: string;
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
/** Build an empty Workbook ready to host worksheets. */
|
|
175
|
+
export declare function createWorkbook(opts?: {
|
|
176
|
+
date1904?: boolean;
|
|
177
|
+
}): Workbook;
|
|
178
|
+
/**
|
|
179
|
+
* Validate a sheet title against Excel's character + length rules. Returns the
|
|
180
|
+
* reason string when the title is rejected; `undefined` when valid. The same
|
|
181
|
+
* rules apply to worksheets and chartsheets.
|
|
182
|
+
*
|
|
183
|
+
* Rules:
|
|
184
|
+
* - Type must be `string`; non-empty; length ≤ 31.
|
|
185
|
+
* - May not contain any of `:`, `\`, `/`, `?`, `*`, `[`, `]`.
|
|
186
|
+
* - May not start or end with an apostrophe `'`.
|
|
187
|
+
* - May not be the literal `"History"` (case-insensitive — Excel
|
|
188
|
+
* reserves that name for the change-tracking sheet).
|
|
189
|
+
*
|
|
190
|
+
* Uniqueness is **not** checked here; pass through `addWorksheet` /
|
|
191
|
+
* `renameSheet` for the workbook-aware duplicate check.
|
|
192
|
+
*/
|
|
193
|
+
export declare function validateSheetTitle(title: unknown): string | undefined;
|
|
194
|
+
/** Boolean form of {@link validateSheetTitle}. */
|
|
195
|
+
export declare const isValidSheetTitle: (title: unknown) => title is string;
|
|
196
|
+
/**
|
|
197
|
+
* Pick a unique sheet title based on `base`. If `base` itself is available,
|
|
198
|
+
* it's returned verbatim. Otherwise the helper appends ` (2)`, ` (3)`, … until
|
|
199
|
+
* it finds a free slot. The returned title always satisfies {@link
|
|
200
|
+
* validateSheetTitle} — if the base+suffix would exceed 31 chars, the base is
|
|
201
|
+
* truncated to fit.
|
|
202
|
+
*
|
|
203
|
+
* Excel treats sheet names as case-insensitive for uniqueness, so `Data` and
|
|
204
|
+
* `data` collide; the helper applies the same rule.
|
|
205
|
+
*
|
|
206
|
+
* Useful for "duplicate sheet" / "import" flows where you want Excel-like
|
|
207
|
+
* automatic uniqueification ("Sheet1 (2)").
|
|
208
|
+
*/
|
|
209
|
+
export declare function pickUniqueSheetTitle(wb: Workbook, base: string): string;
|
|
210
|
+
/** Add a Worksheet to the Workbook. Returns the sheet for further population. */
|
|
211
|
+
export declare function addWorksheet(wb: Workbook, title: string, opts?: {
|
|
212
|
+
index?: number;
|
|
213
|
+
state?: SheetState;
|
|
214
|
+
}): Worksheet;
|
|
215
|
+
/**
|
|
216
|
+
* 0-based tab-strip index of the sheet (worksheet *or* chartsheet) with the
|
|
217
|
+
* given title, or `-1` when not present. Useful when the caller wants to act on
|
|
218
|
+
* the index for `setActiveSheet` / `swapSheets` / similar operations without
|
|
219
|
+
* manually scanning `wb.sheets`.
|
|
220
|
+
*/
|
|
221
|
+
export declare function getSheetIndex(wb: Workbook, title: string): number;
|
|
222
|
+
/**
|
|
223
|
+
* True iff the workbook has a sheet (worksheet *or* chartsheet) with the given
|
|
224
|
+
* title. Thin shortcut over {@link getSheetIndex}.
|
|
225
|
+
*/
|
|
226
|
+
export declare function hasSheet(wb: Workbook, title: string): boolean;
|
|
227
|
+
/**
|
|
228
|
+
* Count sheets in the workbook, with optional kind/state filters. Mirrors the
|
|
229
|
+
* filter shape of {@link getSheetTitles} but skips the array allocation when
|
|
230
|
+
* the caller only needs the count.
|
|
231
|
+
*/
|
|
232
|
+
export declare function countSheets(wb: Workbook, opts?: {
|
|
233
|
+
kind?: 'worksheet' | 'chartsheet';
|
|
234
|
+
state?: SheetState;
|
|
235
|
+
}): number;
|
|
236
|
+
/**
|
|
237
|
+
* Sheet titles in tab-strip order. By default returns titles for every sheet
|
|
238
|
+
* (worksheets + chartsheets). Optional filters narrow to one kind
|
|
239
|
+
* (`'worksheet'` / `'chartsheet'`) or one state (`'visible' | 'hidden' |
|
|
240
|
+
* 'veryHidden'`).
|
|
241
|
+
*/
|
|
242
|
+
export declare function getSheetTitles(wb: Workbook, opts?: {
|
|
243
|
+
kind?: 'worksheet' | 'chartsheet';
|
|
244
|
+
state?: SheetState;
|
|
245
|
+
}): string[];
|
|
246
|
+
/**
|
|
247
|
+
* True iff the workbook has a **worksheet** (not a chartsheet) with the given
|
|
248
|
+
* title. Distinct from {@link hasSheet} (matches either kind) and {@link
|
|
249
|
+
* hasChartsheet} (chartsheets only).
|
|
250
|
+
*/
|
|
251
|
+
export declare function hasWorksheet(wb: Workbook, title: string): boolean;
|
|
252
|
+
/**
|
|
253
|
+
* True iff the workbook has a **chartsheet** (not a worksheet) with the given
|
|
254
|
+
* title. Distinct from {@link hasSheet}, which matches either kind. Use this
|
|
255
|
+
* when the caller needs to discriminate before calling chartsheet-only
|
|
256
|
+
* operations.
|
|
257
|
+
*/
|
|
258
|
+
export declare function hasChartsheet(wb: Workbook, title: string): boolean;
|
|
259
|
+
/** Look up a Worksheet by title. Returns undefined for missing names or chartsheets. */
|
|
260
|
+
export declare function getSheet(wb: Workbook, title: string): Worksheet | undefined;
|
|
261
|
+
/** Look up a Worksheet by index in the sheets array. Returns undefined for chartsheet slots. */
|
|
262
|
+
export declare function getSheetByIndex(wb: Workbook, idx: number): Worksheet | undefined;
|
|
263
|
+
/** Look up a Chartsheet by title. Returns undefined for missing names or worksheets. */
|
|
264
|
+
export declare function getChartsheet(wb: Workbook, title: string): Chartsheet | undefined;
|
|
265
|
+
/** Add a Chartsheet to the Workbook. Returns the chartsheet for further population. */
|
|
266
|
+
export declare function addChartsheet(wb: Workbook, title: string, opts?: {
|
|
267
|
+
index?: number;
|
|
268
|
+
state?: SheetState;
|
|
269
|
+
chart?: ChartReference;
|
|
270
|
+
}): Chartsheet;
|
|
271
|
+
/** All worksheet titles, in display order. */
|
|
272
|
+
export declare function sheetNames(wb: Workbook): string[];
|
|
273
|
+
/** Remove a sheet by title. No-op if the title is not registered. */
|
|
274
|
+
export declare function removeSheet(wb: Workbook, title: string): void;
|
|
275
|
+
/** Set the active sheet by title; throws on unknown title. */
|
|
276
|
+
export declare function setActiveSheet(wb: Workbook, title: string): void;
|
|
277
|
+
/**
|
|
278
|
+
* Rename a sheet from `oldTitle` to `newTitle`. Throws if no sheet matches
|
|
279
|
+
* `oldTitle`, or if `newTitle` collides with an existing sheet (Excel requires
|
|
280
|
+
* sheet names to be unique within a workbook).
|
|
281
|
+
*/
|
|
282
|
+
export declare function renameSheet(wb: Workbook, oldTitle: string, newTitle: string): void;
|
|
283
|
+
/**
|
|
284
|
+
* Set the visibility state on a sheet by title. Throws on unknown title.
|
|
285
|
+
* Refuses to hide the last visible sheet: an .xlsx with every sheet hidden
|
|
286
|
+
* fails to open in Excel ("Excel cannot use the object linking and embedding
|
|
287
|
+
* features because no sheet is visible"). Catching it here keeps the
|
|
288
|
+
* workbook recoverable instead of producing a save Excel will reject.
|
|
289
|
+
*/
|
|
290
|
+
export declare function setSheetState(wb: Workbook, title: string, state: SheetState): void;
|
|
291
|
+
/** Look up the current visibility state. Throws on unknown title. */
|
|
292
|
+
export declare function getSheetState(wb: Workbook, title: string): SheetState;
|
|
293
|
+
/**
|
|
294
|
+
* Hide a sheet (`state: 'hidden'`). Equivalent to right-click → Hide in Excel —
|
|
295
|
+
* the user can re-show it via the Unhide dialog.
|
|
296
|
+
*/
|
|
297
|
+
export declare function hideSheet(wb: Workbook, title: string): void;
|
|
298
|
+
/**
|
|
299
|
+
* Mark a sheet as very-hidden (`state: 'veryHidden'`). Excel won't surface it
|
|
300
|
+
* in the Unhide dialog — only reachable via VBA / API.
|
|
301
|
+
*/
|
|
302
|
+
export declare function veryHideSheet(wb: Workbook, title: string): void;
|
|
303
|
+
/** Make a hidden / veryHidden sheet visible. */
|
|
304
|
+
export declare function showSheet(wb: Workbook, title: string): void;
|
|
305
|
+
/**
|
|
306
|
+
* Bulk-update visibility state for many sheets in one call. `entries` is a
|
|
307
|
+
* `Record<title, state>` map; missing titles throw via the underlying
|
|
308
|
+
* `setSheetState`.
|
|
309
|
+
*/
|
|
310
|
+
export declare function setSheetStates(wb: Workbook, entries: Record<string, SheetState>): void;
|
|
311
|
+
/**
|
|
312
|
+
* Show every hidden / veryHidden worksheet. Returns the count unhidden. Useful
|
|
313
|
+
* for spreadsheet-wide auditing.
|
|
314
|
+
*/
|
|
315
|
+
export declare function showAllSheets(wb: Workbook): number;
|
|
316
|
+
/**
|
|
317
|
+
* Move a sheet to a new tab-strip position. `toIndex` is clamped to `[0,
|
|
318
|
+
* sheets.length - 1]`. Adjusts `activeSheetIndex` so the same sheet stays
|
|
319
|
+
* active across the move.
|
|
320
|
+
*/
|
|
321
|
+
export declare function moveSheet(wb: Workbook, title: string, toIndex: number): void;
|
|
322
|
+
/**
|
|
323
|
+
* Swap the tab-strip positions of two sheets by title. Both titles must exist;
|
|
324
|
+
* throws otherwise. `activeSheetIndex` follows the moved sheet so the same
|
|
325
|
+
* sheet stays active across the swap.
|
|
326
|
+
*/
|
|
327
|
+
export declare function swapSheets(wb: Workbook, titleA: string, titleB: string): void;
|
|
328
|
+
/**
|
|
329
|
+
* Duplicate a worksheet end-to-end and append it as `newTitle`. Mirrors Excel's
|
|
330
|
+
* "Move or Copy → Create a copy" command. Cells, dimensions, styles (via shared
|
|
331
|
+
* cellXf ids), comments, hyperlinks, conditional formatting, page setup, etc.
|
|
332
|
+
* all carry over verbatim — only fields that must stay workbook-unique get
|
|
333
|
+
* rewritten:
|
|
334
|
+
*
|
|
335
|
+
* - sheet `title` → `newTitle`
|
|
336
|
+
* - sheet `sheetId` → freshly allocated
|
|
337
|
+
* - each table's `id` → max(workbook table ids) + 1
|
|
338
|
+
* - each table's `displayName` → suffixed with `opts.tableSuffix`
|
|
339
|
+
* (default `"_2"`) so it doesn't collide with the original
|
|
340
|
+
*
|
|
341
|
+
* The new sheet is inserted at the optional `index` (default: appended).
|
|
342
|
+
*/
|
|
343
|
+
export declare function duplicateSheet(wb: Workbook, sourceTitle: string, newTitle: string, opts?: {
|
|
344
|
+
index?: number;
|
|
345
|
+
state?: SheetState;
|
|
346
|
+
tableSuffix?: string;
|
|
347
|
+
}): Worksheet;
|
|
348
|
+
/**
|
|
349
|
+
* Aggregate counts about a workbook's content. Useful for quick QA after large
|
|
350
|
+
* mutations or for surfacing a "what's in this file" banner. All counts walk
|
|
351
|
+
* the typed model — they do **not** save the workbook to bytes — so the cost is
|
|
352
|
+
* O(workbook content).
|
|
353
|
+
*/
|
|
354
|
+
export interface WorkbookStats {
|
|
355
|
+
/** Total worksheets (excludes chartsheets). */
|
|
356
|
+
worksheetCount: number;
|
|
357
|
+
/** Total chartsheets. */
|
|
358
|
+
chartsheetCount: number;
|
|
359
|
+
/** Sum of populated cells across every worksheet. */
|
|
360
|
+
cellCount: number;
|
|
361
|
+
/** Sum of formula cells. */
|
|
362
|
+
formulaCount: number;
|
|
363
|
+
/** Sum of legacyComments across every worksheet. */
|
|
364
|
+
commentCount: number;
|
|
365
|
+
/** Sum of hyperlinks across every worksheet. */
|
|
366
|
+
hyperlinkCount: number;
|
|
367
|
+
/** Sum of mergedCells ranges. */
|
|
368
|
+
mergedRangeCount: number;
|
|
369
|
+
/** Sum of Excel tables. */
|
|
370
|
+
tableCount: number;
|
|
371
|
+
/** Workbook-level defined names. */
|
|
372
|
+
definedNameCount: number;
|
|
373
|
+
/** Custom-property entry count, 0 when no docProps/custom.xml. */
|
|
374
|
+
customPropertyCount: number;
|
|
375
|
+
}
|
|
376
|
+
export declare function getWorkbookStats(wb: Workbook): WorkbookStats;
|
|
377
|
+
/**
|
|
378
|
+
* Workbook-wide value-kind histogram. Sums {@link countCellsByKind} across
|
|
379
|
+
* every Worksheet (chartsheets contribute no cells). Buckets have the same
|
|
380
|
+
* shape as the per-worksheet result; an empty workbook returns all-zero counts.
|
|
381
|
+
*/
|
|
382
|
+
export declare function getWorkbookCellsByKind(wb: Workbook): CellsByKindCounts;
|
|
383
|
+
/**
|
|
384
|
+
* Resolve a sheet-qualified A1 address (`'Sheet1!A1'`) to its Cell, or
|
|
385
|
+
* `undefined` when the cell isn't materialised. Throws on malformed addresses,
|
|
386
|
+
* missing sheets, or range inputs.
|
|
387
|
+
*/
|
|
388
|
+
export declare function getCellAtAddress(wb: Workbook, address: string): import('../cell/cell').Cell | undefined;
|
|
389
|
+
/**
|
|
390
|
+
* Set a single cell by sheet-qualified A1 address. Throws on malformed
|
|
391
|
+
* addresses, missing sheets, or range inputs.
|
|
392
|
+
*/
|
|
393
|
+
export declare function setCellAtAddress(wb: Workbook, address: string, value: CellValue): import('../cell/cell').Cell;
|
|
394
|
+
/**
|
|
395
|
+
* True iff every Worksheet in the workbook is empty (per {@link
|
|
396
|
+
* isWorksheetEmpty}). Chartsheets carry no cells so they never affect the
|
|
397
|
+
* result. A workbook with zero worksheets is also empty by this definition.
|
|
398
|
+
*
|
|
399
|
+
* Short-circuits on the first non-empty worksheet.
|
|
400
|
+
*/
|
|
401
|
+
export declare function isWorkbookEmpty(wb: Workbook): boolean;
|
|
402
|
+
/**
|
|
403
|
+
* Per-sheet entry inside {@link WorkbookOverview}. Holds enough metadata to
|
|
404
|
+
* make a "what's in this workbook" panel useful without forcing the caller to
|
|
405
|
+
* walk every worksheet themselves.
|
|
406
|
+
*/
|
|
407
|
+
export interface WorkbookSheetOverview {
|
|
408
|
+
title: string;
|
|
409
|
+
kind: 'worksheet' | 'chartsheet';
|
|
410
|
+
state: SheetState;
|
|
411
|
+
/** Populated cells in the sheet (0 for chartsheets). */
|
|
412
|
+
cellCount: number;
|
|
413
|
+
/** Populated formula cells (0 for chartsheets). */
|
|
414
|
+
formulaCount: number;
|
|
415
|
+
/** Tables registered on the sheet. */
|
|
416
|
+
tableCount: number;
|
|
417
|
+
/** Drawing items (charts + pictures) on the sheet. */
|
|
418
|
+
drawingItemCount: number;
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* High-level "what's in this workbook" snapshot. Combines the aggregate counts
|
|
422
|
+
* from {@link getWorkbookStats} and value-kind histogram from {@link
|
|
423
|
+
* getWorkbookCellsByKind} with per-sheet metadata. JSON-serialisable; suitable
|
|
424
|
+
* for a UI banner / debug dump.
|
|
425
|
+
*/
|
|
426
|
+
export interface WorkbookOverview {
|
|
427
|
+
worksheetCount: number;
|
|
428
|
+
chartsheetCount: number;
|
|
429
|
+
cellCount: number;
|
|
430
|
+
formulaCount: number;
|
|
431
|
+
commentCount: number;
|
|
432
|
+
hyperlinkCount: number;
|
|
433
|
+
mergedRangeCount: number;
|
|
434
|
+
tableCount: number;
|
|
435
|
+
definedNameCount: number;
|
|
436
|
+
customPropertyCount: number;
|
|
437
|
+
cellsByKind: CellsByKindCounts;
|
|
438
|
+
sheets: WorkbookSheetOverview[];
|
|
439
|
+
}
|
|
440
|
+
export declare function describeWorkbook(wb: Workbook): WorkbookOverview;
|
|
441
|
+
/**
|
|
442
|
+
* Debug-friendly snapshot of everything resolved for a single cell: its value,
|
|
443
|
+
* the full style chain (font / fill / border / alignment / protection /
|
|
444
|
+
* numberFormat), the applied hyperlink + comment, the merged range it sits
|
|
445
|
+
* inside (if any), and the names of any tables / the count of CF / DV blocks
|
|
446
|
+
* that target it.
|
|
447
|
+
*
|
|
448
|
+
* Designed for `console.log`-style introspection — JSON-serialisable and stable
|
|
449
|
+
* in shape regardless of which axes are populated.
|
|
450
|
+
*
|
|
451
|
+
* Throws when `sheetTitle` doesn't resolve. When `ref` is a valid A1 coordinate
|
|
452
|
+
* but no cell exists there, `exists` is `false` and the style chain reflects
|
|
453
|
+
* the workbook defaults.
|
|
454
|
+
*/
|
|
455
|
+
export interface CellSummary {
|
|
456
|
+
ref: string;
|
|
457
|
+
sheet: string;
|
|
458
|
+
exists: boolean;
|
|
459
|
+
value: CellValue | undefined;
|
|
460
|
+
styleId: number;
|
|
461
|
+
font: Font;
|
|
462
|
+
fill: Fill;
|
|
463
|
+
border: Border;
|
|
464
|
+
alignment: Alignment;
|
|
465
|
+
protection: Protection;
|
|
466
|
+
numberFormat: string;
|
|
467
|
+
hyperlink: Hyperlink | undefined;
|
|
468
|
+
comment: LegacyComment | undefined;
|
|
469
|
+
mergedRange: string | undefined;
|
|
470
|
+
inTables: string[];
|
|
471
|
+
inDataValidations: number;
|
|
472
|
+
inConditionalFormatting: number;
|
|
473
|
+
}
|
|
474
|
+
export declare function getCellSummary(wb: Workbook, sheetTitle: string, ref: string): CellSummary;
|
|
475
|
+
/**
|
|
476
|
+
* Iterate over every Worksheet in the workbook (skips chartsheets). Yields each
|
|
477
|
+
* worksheet in tab-strip order.
|
|
478
|
+
*/
|
|
479
|
+
export declare function iterWorksheets(wb: Workbook): IterableIterator<Worksheet>;
|
|
480
|
+
/**
|
|
481
|
+
* Iterate only over Worksheets whose tab-strip state is `'visible'`. Hidden /
|
|
482
|
+
* veryHidden sheets are skipped. Useful for reports that should ignore
|
|
483
|
+
* back-office sheets the author has hidden.
|
|
484
|
+
*/
|
|
485
|
+
export declare function iterVisibleWorksheets(wb: Workbook): IterableIterator<Worksheet>;
|
|
486
|
+
/**
|
|
487
|
+
* Iterate Worksheets matching the supplied state. Pass `'hidden'` to skim
|
|
488
|
+
* back-office sheets, `'veryHidden'` to find sheets only accessible via VBA,
|
|
489
|
+
* etc.
|
|
490
|
+
*/
|
|
491
|
+
export declare function iterWorksheetsByState(wb: Workbook, state: SheetState): IterableIterator<Worksheet>;
|
|
492
|
+
/**
|
|
493
|
+
* Iterate every cell across every worksheet in the workbook. Yields `{ sheet,
|
|
494
|
+
* cell }` pairs in tab-strip order, then row-then-column within each sheet.
|
|
495
|
+
* Useful for workbook-wide audits / find-and-replace passes.
|
|
496
|
+
*/
|
|
497
|
+
export declare function iterAllCells(wb: Workbook): IterableIterator<{
|
|
498
|
+
sheet: Worksheet;
|
|
499
|
+
cell: import('../cell/cell').Cell;
|
|
500
|
+
}>;
|
|
501
|
+
/**
|
|
502
|
+
* Collect every merged range across every worksheet. Each entry carries the
|
|
503
|
+
* merge bounds plus a back-reference to the owning sheet, in tab-strip order.
|
|
504
|
+
* Equivalent to walking `iterWorksheets` and concatenating each sheet's
|
|
505
|
+
* `mergedCells`.
|
|
506
|
+
*/
|
|
507
|
+
export declare function getAllMergedRanges(wb: Workbook): ReadonlyArray<{
|
|
508
|
+
sheet: Worksheet;
|
|
509
|
+
range: import('../worksheet/cell-range').CellRange;
|
|
510
|
+
}>;
|
|
511
|
+
/**
|
|
512
|
+
* Collect every hyperlink across every worksheet. Each entry pairs the
|
|
513
|
+
* hyperlink with a back-reference to the owning sheet, in tab-strip order.
|
|
514
|
+
*/
|
|
515
|
+
export declare function getAllHyperlinks(wb: Workbook): ReadonlyArray<{
|
|
516
|
+
sheet: Worksheet;
|
|
517
|
+
hyperlink: import('../worksheet/hyperlinks').Hyperlink;
|
|
518
|
+
}>;
|
|
519
|
+
/**
|
|
520
|
+
* Collect every legacy comment across every worksheet. Each entry pairs the
|
|
521
|
+
* comment with a back-reference to the owning sheet, in tab-strip order.
|
|
522
|
+
*/
|
|
523
|
+
export declare function getAllComments(wb: Workbook): ReadonlyArray<{
|
|
524
|
+
sheet: Worksheet;
|
|
525
|
+
comment: import('../worksheet/comments').LegacyComment;
|
|
526
|
+
}>;
|
|
527
|
+
/**
|
|
528
|
+
* Collect every Excel table across every worksheet. Each entry pairs the
|
|
529
|
+
* TableDefinition with a back-reference to the owning sheet, in tab-strip
|
|
530
|
+
* order.
|
|
531
|
+
*/
|
|
532
|
+
export declare function getAllTables(wb: Workbook): ReadonlyArray<{
|
|
533
|
+
sheet: Worksheet;
|
|
534
|
+
table: import('../worksheet/table').TableDefinition;
|
|
535
|
+
}>;
|
|
536
|
+
/**
|
|
537
|
+
* Locate an Excel table by `displayName` across the whole workbook. Excel
|
|
538
|
+
* enforces uniqueness at the workbook level, so the first match wins. Returns
|
|
539
|
+
* the owning sheet + the table itself, or `undefined` when nothing matches.
|
|
540
|
+
*/
|
|
541
|
+
export declare function findTable(wb: Workbook, displayName: string): {
|
|
542
|
+
sheet: Worksheet;
|
|
543
|
+
table: import('../worksheet/table').TableDefinition;
|
|
544
|
+
} | undefined;
|
|
545
|
+
/**
|
|
546
|
+
* First cell across the workbook satisfying `predicate`. Walks every worksheet
|
|
547
|
+
* in tab-strip order, then row-then-column within each sheet (same order as
|
|
548
|
+
* {@link iterAllCells}). Returns `{ sheet, cell }` for the match, or
|
|
549
|
+
* `undefined` when nothing matches.
|
|
550
|
+
*/
|
|
551
|
+
export declare function findCellInWorkbook(wb: Workbook, predicate: (cell: import('../cell/cell').Cell, sheet: Worksheet) => boolean): {
|
|
552
|
+
sheet: Worksheet;
|
|
553
|
+
cell: import('../cell/cell').Cell;
|
|
554
|
+
} | undefined;
|
|
555
|
+
/**
|
|
556
|
+
* Every cell across the workbook satisfying `predicate`. Same iteration order
|
|
557
|
+
* as {@link iterAllCells}. Returns an array of `{ sheet, cell }` matches.
|
|
558
|
+
*/
|
|
559
|
+
export declare function findCellsInWorkbook(wb: Workbook, predicate: (cell: import('../cell/cell').Cell, sheet: Worksheet) => boolean): ReadonlyArray<{
|
|
560
|
+
sheet: Worksheet;
|
|
561
|
+
cell: import('../cell/cell').Cell;
|
|
562
|
+
}>;
|
|
563
|
+
/**
|
|
564
|
+
* Workbook-wide find-and-replace. Same matching rule as `replaceCellValues` but
|
|
565
|
+
* walks every worksheet via {@link iterAllCells}. `search` is either an
|
|
566
|
+
* exact-string match (string-valued cells only) or a predicate `(value, cell,
|
|
567
|
+
* sheet) → boolean`. `replacement` is the new `CellValue`. Returns the count of
|
|
568
|
+
* cells changed across all sheets.
|
|
569
|
+
*/
|
|
570
|
+
export declare function replaceCellValuesInWorkbook(wb: Workbook, search: string | ((value: import('../cell/cell').CellValue, cell: import('../cell/cell').Cell, sheet: Worksheet) => boolean), replacement: import('../cell/cell').CellValue): number;
|
|
571
|
+
/**
|
|
572
|
+
* Collect every data-validation block across every worksheet. Each entry pairs
|
|
573
|
+
* the validation with a back-reference to the owning sheet, in tab-strip order.
|
|
574
|
+
*/
|
|
575
|
+
export declare function getAllDataValidations(wb: Workbook): ReadonlyArray<{
|
|
576
|
+
sheet: Worksheet;
|
|
577
|
+
validation: import('../worksheet/data-validations').DataValidation;
|
|
578
|
+
}>;
|
|
579
|
+
/**
|
|
580
|
+
* Collect every image (picture) DrawingItem across every worksheet, each paired
|
|
581
|
+
* with its owning sheet in tab-strip order.
|
|
582
|
+
*/
|
|
583
|
+
export declare function getAllImages(wb: Workbook): ReadonlyArray<{
|
|
584
|
+
sheet: Worksheet;
|
|
585
|
+
item: import('../drawing/drawing').DrawingItem;
|
|
586
|
+
}>;
|
|
587
|
+
/**
|
|
588
|
+
* Collect every chart DrawingItem across every worksheet, each paired with its
|
|
589
|
+
* owning sheet in tab-strip order.
|
|
590
|
+
*/
|
|
591
|
+
export declare function getAllCharts(wb: Workbook): ReadonlyArray<{
|
|
592
|
+
sheet: Worksheet;
|
|
593
|
+
item: import('../drawing/drawing').DrawingItem;
|
|
594
|
+
}>;
|
|
595
|
+
/**
|
|
596
|
+
* Collect every conditional-formatting block across every worksheet. Each entry
|
|
597
|
+
* pairs the CF block with a back-reference to the owning sheet, in tab-strip
|
|
598
|
+
* order.
|
|
599
|
+
*/
|
|
600
|
+
export declare function getAllConditionalFormatting(wb: Workbook): ReadonlyArray<{
|
|
601
|
+
sheet: Worksheet;
|
|
602
|
+
formatting: import('../worksheet/conditional-formatting').ConditionalFormatting;
|
|
603
|
+
}>;
|
|
604
|
+
/**
|
|
605
|
+
* Iterate over every Chartsheet in the workbook. Yields in tab-strip order,
|
|
606
|
+
* skipping regular worksheets.
|
|
607
|
+
*/
|
|
608
|
+
export declare function iterChartsheets(wb: Workbook): IterableIterator<Chartsheet>;
|
|
609
|
+
/** Convenience: array of every Worksheet in tab-strip order. */
|
|
610
|
+
export declare function listWorksheets(wb: Workbook): Worksheet[];
|
|
611
|
+
/** Convenience: array of every Chartsheet in tab-strip order. */
|
|
612
|
+
export declare function listChartsheets(wb: Workbook): Chartsheet[];
|
|
613
|
+
/** Currently active sheet (worksheet only), or undefined if the active slot is empty or a chartsheet. */
|
|
614
|
+
export declare function getActiveSheet(wb: Workbook): Worksheet | undefined;
|
|
615
|
+
/**
|
|
616
|
+
* Title of whichever sheet (worksheet *or* chartsheet) is currently marked
|
|
617
|
+
* active via `wb.activeSheetIndex`. Returns `undefined` for an empty workbook
|
|
618
|
+
* or an out-of-range index.
|
|
619
|
+
*
|
|
620
|
+
* Distinct from {@link getActiveSheet} (which only returns worksheets and
|
|
621
|
+
* yields `undefined` when the active slot is a chartsheet) — this matches
|
|
622
|
+
* `wb.activeSheetIndex` regardless of kind.
|
|
623
|
+
*/
|
|
624
|
+
export declare function getActiveSheetTitle(wb: Workbook): string | undefined;
|
|
625
|
+
/**
|
|
626
|
+
* True iff `title` matches the workbook's currently active sheet (any kind).
|
|
627
|
+
* Empty workbook returns `false` (no active sheet).
|
|
628
|
+
*/
|
|
629
|
+
export declare function isActiveSheet(wb: Workbook, title: string): boolean;
|
|
630
|
+
/** Read-only view onto the customXml/* pass-through parts. */
|
|
631
|
+
export declare function listCustomXmlParts(wb: Workbook): Array<{
|
|
632
|
+
path: string;
|
|
633
|
+
content: Uint8Array;
|
|
634
|
+
}>;
|
|
635
|
+
/**
|
|
636
|
+
* JSON.stringify replacer that drops the Stylesheet's internal dedup Maps. Use
|
|
637
|
+
* as `JSON.stringify(workbook, jsonReplacer)` when the workbook needs to
|
|
638
|
+
* round-trip through plain JSON (tests, debug dumps). The dedup maps are
|
|
639
|
+
* reconstructed lazily on first add.
|
|
640
|
+
*/
|
|
641
|
+
export declare function jsonReplacer(_key: string, value: unknown): unknown;
|
|
642
|
+
/** Companion reviver for {@link jsonReplacer}. */
|
|
643
|
+
export declare function jsonReviver(_key: string, value: unknown): unknown;
|