@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.
Files changed (220) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +319 -0
  3. package/THIRD_PARTY_NOTICES.md +56 -0
  4. package/dist/cell/cell.d.ts +234 -0
  5. package/dist/cell/index.d.ts +4 -0
  6. package/dist/cell/rich-text.d.ts +37 -0
  7. package/dist/cell-D9CaNKnU.mjs +320 -0
  8. package/dist/cell-D9CaNKnU.mjs.map +1 -0
  9. package/dist/cell-style-BEDjMX1y.mjs +1579 -0
  10. package/dist/cell-style-BEDjMX1y.mjs.map +1 -0
  11. package/dist/cell.mjs +2 -0
  12. package/dist/chart/chart-xml.d.ts +16 -0
  13. package/dist/chart/chart.d.ts +735 -0
  14. package/dist/chart/cx/chartex-xml.d.ts +6 -0
  15. package/dist/chart/cx/chartex.d.ts +279 -0
  16. package/dist/chart/index.d.ts +6 -0
  17. package/dist/chart/user-shapes-xml.d.ts +4 -0
  18. package/dist/chart/user-shapes.d.ts +61 -0
  19. package/dist/chart.mjs +232 -0
  20. package/dist/chart.mjs.map +1 -0
  21. package/dist/chartsheet/chartsheet-xml.d.ts +17 -0
  22. package/dist/chartsheet/chartsheet.d.ts +121 -0
  23. package/dist/chartsheet/index.d.ts +2 -0
  24. package/dist/chartsheet-C3-tqkPy.mjs +23 -0
  25. package/dist/chartsheet-C3-tqkPy.mjs.map +1 -0
  26. package/dist/chartsheet.mjs +2 -0
  27. package/dist/colors-ovWAwnZI.mjs +67 -0
  28. package/dist/colors-ovWAwnZI.mjs.map +1 -0
  29. package/dist/compat/numbers.d.ts +14 -0
  30. package/dist/coordinate-96Ecci4d.mjs +276 -0
  31. package/dist/coordinate-96Ecci4d.mjs.map +1 -0
  32. package/dist/datetime-B2ySVlXt.mjs +71 -0
  33. package/dist/datetime-B2ySVlXt.mjs.map +1 -0
  34. package/dist/defined-names-CviWmtQg.mjs +89 -0
  35. package/dist/defined-names-CviWmtQg.mjs.map +1 -0
  36. package/dist/differential-D4dg-qtZ.mjs +37 -0
  37. package/dist/differential-D4dg-qtZ.mjs.map +1 -0
  38. package/dist/drawing/anchor.d.ts +63 -0
  39. package/dist/drawing/dml/colors.d.ts +109 -0
  40. package/dist/drawing/dml/dml-xml.d.ts +35 -0
  41. package/dist/drawing/dml/effect.d.ts +92 -0
  42. package/dist/drawing/dml/fill.d.ts +115 -0
  43. package/dist/drawing/dml/geometry.d.ts +113 -0
  44. package/dist/drawing/dml/line.d.ts +41 -0
  45. package/dist/drawing/dml/shape-properties.d.ts +33 -0
  46. package/dist/drawing/dml/text.d.ts +218 -0
  47. package/dist/drawing/drawing-xml.d.ts +5 -0
  48. package/dist/drawing/drawing.d.ts +117 -0
  49. package/dist/drawing/image.d.ts +40 -0
  50. package/dist/drawing/index.d.ts +14 -0
  51. package/dist/drawing-BxzLuryn.mjs +415 -0
  52. package/dist/drawing-BxzLuryn.mjs.map +1 -0
  53. package/dist/drawing.mjs +119 -0
  54. package/dist/drawing.mjs.map +1 -0
  55. package/dist/escape-DFTE7ZJc.mjs +51 -0
  56. package/dist/escape-DFTE7ZJc.mjs.map +1 -0
  57. package/dist/exceptions-D-CFwxgm.mjs +37 -0
  58. package/dist/exceptions-D-CFwxgm.mjs.map +1 -0
  59. package/dist/formula/tokenizer.d.ts +61 -0
  60. package/dist/formula/translate.d.ts +67 -0
  61. package/dist/inference-B3ES3KEJ.mjs +42 -0
  62. package/dist/inference-B3ES3KEJ.mjs.map +1 -0
  63. package/dist/io/browser.d.ts +41 -0
  64. package/dist/io/index.d.ts +7 -0
  65. package/dist/io/load.d.ts +46 -0
  66. package/dist/io/node-fs.d.ts +62 -0
  67. package/dist/io/node-save.d.ts +3 -0
  68. package/dist/io/node.d.ts +17 -0
  69. package/dist/io/save.d.ts +14 -0
  70. package/dist/io/sink.d.ts +54 -0
  71. package/dist/io/source.d.ts +14 -0
  72. package/dist/io.mjs +212 -0
  73. package/dist/io.mjs.map +1 -0
  74. package/dist/load-D5cbhoGx.mjs +1069 -0
  75. package/dist/load-D5cbhoGx.mjs.map +1 -0
  76. package/dist/manifest-Dps1-OpP.mjs +801 -0
  77. package/dist/manifest-Dps1-OpP.mjs.map +1 -0
  78. package/dist/node.d.ts +3 -0
  79. package/dist/node.mjs +308 -0
  80. package/dist/node.mjs.map +1 -0
  81. package/dist/packaging/core.d.ts +45 -0
  82. package/dist/packaging/custom.d.ts +62 -0
  83. package/dist/packaging/extended.d.ts +45 -0
  84. package/dist/packaging/index.d.ts +10 -0
  85. package/dist/packaging/manifest.d.ts +24 -0
  86. package/dist/packaging/relationships.d.ts +30 -0
  87. package/dist/packaging.mjs +2 -0
  88. package/dist/parser-DuLejQy1.mjs +156 -0
  89. package/dist/parser-DuLejQy1.mjs.map +1 -0
  90. package/dist/reader-D1fNW9k1.mjs +534 -0
  91. package/dist/reader-D1fNW9k1.mjs.map +1 -0
  92. package/dist/save-RohQtgEZ.mjs +745 -0
  93. package/dist/save-RohQtgEZ.mjs.map +1 -0
  94. package/dist/schema/core.d.ts +133 -0
  95. package/dist/schema/index.d.ts +3 -0
  96. package/dist/schema/serialize.d.ts +6 -0
  97. package/dist/schema.mjs +2 -0
  98. package/dist/serialize-55EnT30e.mjs +254 -0
  99. package/dist/serialize-55EnT30e.mjs.map +1 -0
  100. package/dist/serializer-BwbgHYJV.mjs +116 -0
  101. package/dist/serializer-BwbgHYJV.mjs.map +1 -0
  102. package/dist/streaming/index.d.ts +2 -0
  103. package/dist/streaming/read-only.d.ts +38 -0
  104. package/dist/streaming/write-only.d.ts +47 -0
  105. package/dist/streaming.mjs +612 -0
  106. package/dist/streaming.mjs.map +1 -0
  107. package/dist/styles/alignment.d.ts +33 -0
  108. package/dist/styles/alignment.schema.d.ts +3 -0
  109. package/dist/styles/borders.d.ts +40 -0
  110. package/dist/styles/borders.schema.d.ts +4 -0
  111. package/dist/styles/cell-style.d.ts +270 -0
  112. package/dist/styles/colors.d.ts +128 -0
  113. package/dist/styles/colors.schema.d.ts +3 -0
  114. package/dist/styles/differential.d.ts +41 -0
  115. package/dist/styles/fills.d.ts +54 -0
  116. package/dist/styles/fills.schema.d.ts +6 -0
  117. package/dist/styles/fonts.d.ts +44 -0
  118. package/dist/styles/fonts.schema.d.ts +3 -0
  119. package/dist/styles/index.d.ts +21 -0
  120. package/dist/styles/named-styles.d.ts +52 -0
  121. package/dist/styles/numbers.d.ts +39 -0
  122. package/dist/styles/numbers.schema.d.ts +3 -0
  123. package/dist/styles/protection.d.ts +9 -0
  124. package/dist/styles/protection.schema.d.ts +3 -0
  125. package/dist/styles/stylesheet-reader.d.ts +7 -0
  126. package/dist/styles/stylesheet-writer.d.ts +3 -0
  127. package/dist/styles/stylesheet.d.ts +95 -0
  128. package/dist/styles.mjs +4 -0
  129. package/dist/stylesheet-writer-C2eRmn22.mjs +8624 -0
  130. package/dist/stylesheet-writer-C2eRmn22.mjs.map +1 -0
  131. package/dist/table-DkX6UniA.mjs +113 -0
  132. package/dist/table-DkX6UniA.mjs.map +1 -0
  133. package/dist/tree-Bbs1C8Rc.mjs +192 -0
  134. package/dist/tree-Bbs1C8Rc.mjs.map +1 -0
  135. package/dist/units-rOMQqXh2.mjs +41 -0
  136. package/dist/units-rOMQqXh2.mjs.map +1 -0
  137. package/dist/user-shapes-DfmCGKB0.mjs +252 -0
  138. package/dist/user-shapes-DfmCGKB0.mjs.map +1 -0
  139. package/dist/utf8-D91g1XTG.mjs +143 -0
  140. package/dist/utf8-D91g1XTG.mjs.map +1 -0
  141. package/dist/utils/coordinate.d.ts +103 -0
  142. package/dist/utils/css.d.ts +18 -0
  143. package/dist/utils/datetime.d.ts +38 -0
  144. package/dist/utils/escape.d.ts +34 -0
  145. package/dist/utils/exceptions.d.ts +34 -0
  146. package/dist/utils/index.d.ts +11 -0
  147. package/dist/utils/inference.d.ts +24 -0
  148. package/dist/utils/stable-stringify.d.ts +7 -0
  149. package/dist/utils/units.d.ts +14 -0
  150. package/dist/utils/utf8.d.ts +1 -0
  151. package/dist/utils.mjs +39 -0
  152. package/dist/utils.mjs.map +1 -0
  153. package/dist/workbook/calc-properties.d.ts +47 -0
  154. package/dist/workbook/defined-names.d.ts +121 -0
  155. package/dist/workbook/file-recovery.d.ts +11 -0
  156. package/dist/workbook/file-sharing.d.ts +14 -0
  157. package/dist/workbook/file-version.d.ts +13 -0
  158. package/dist/workbook/function-groups.d.ts +10 -0
  159. package/dist/workbook/index.d.ts +24 -0
  160. package/dist/workbook/protection.d.ts +35 -0
  161. package/dist/workbook/shared-strings.d.ts +57 -0
  162. package/dist/workbook/smart-tags.d.ts +13 -0
  163. package/dist/workbook/views.d.ts +89 -0
  164. package/dist/workbook/workbook-properties.d.ts +57 -0
  165. package/dist/workbook/workbook.d.ts +643 -0
  166. package/dist/workbook-HGYNRBlV.mjs +636 -0
  167. package/dist/workbook-HGYNRBlV.mjs.map +1 -0
  168. package/dist/workbook.mjs +58 -0
  169. package/dist/workbook.mjs.map +1 -0
  170. package/dist/worksheet/auto-filter.d.ts +34 -0
  171. package/dist/worksheet/cell-range.d.ts +121 -0
  172. package/dist/worksheet/comments-xml.d.ts +24 -0
  173. package/dist/worksheet/comments.d.ts +13 -0
  174. package/dist/worksheet/conditional-formatting.d.ts +150 -0
  175. package/dist/worksheet/custom-sheet-views.d.ts +43 -0
  176. package/dist/worksheet/data-consolidate.d.ts +29 -0
  177. package/dist/worksheet/data-validations.d.ts +72 -0
  178. package/dist/worksheet/dimensions.d.ts +40 -0
  179. package/dist/worksheet/errors.d.ts +40 -0
  180. package/dist/worksheet/hyperlinks.d.ts +42 -0
  181. package/dist/worksheet/index.d.ts +46 -0
  182. package/dist/worksheet/ole-objects.d.ts +37 -0
  183. package/dist/worksheet/page-setup.d.ts +173 -0
  184. package/dist/worksheet/phonetic.d.ts +11 -0
  185. package/dist/worksheet/properties.d.ts +34 -0
  186. package/dist/worksheet/protected-ranges.d.ts +19 -0
  187. package/dist/worksheet/protection.d.ts +44 -0
  188. package/dist/worksheet/reader.d.ts +38 -0
  189. package/dist/worksheet/scenarios.d.ts +36 -0
  190. package/dist/worksheet/smart-tags.d.ts +23 -0
  191. package/dist/worksheet/sort-state.d.ts +28 -0
  192. package/dist/worksheet/table-xml.d.ts +5 -0
  193. package/dist/worksheet/table.d.ts +80 -0
  194. package/dist/worksheet/views.d.ts +47 -0
  195. package/dist/worksheet/web-publish.d.ts +21 -0
  196. package/dist/worksheet/worksheet.d.ts +935 -0
  197. package/dist/worksheet/writer.d.ts +72 -0
  198. package/dist/worksheet-CmCNoIgD.mjs +1726 -0
  199. package/dist/worksheet-CmCNoIgD.mjs.map +1 -0
  200. package/dist/worksheet.mjs +247 -0
  201. package/dist/worksheet.mjs.map +1 -0
  202. package/dist/writer-DspzfkNA.mjs +221 -0
  203. package/dist/writer-DspzfkNA.mjs.map +1 -0
  204. package/dist/xml/index.d.ts +10 -0
  205. package/dist/xml/iterparse.d.ts +22 -0
  206. package/dist/xml/namespaces.d.ts +91 -0
  207. package/dist/xml/parser.d.ts +7 -0
  208. package/dist/xml/serializer.d.ts +14 -0
  209. package/dist/xml/stream-writer.d.ts +39 -0
  210. package/dist/xml/tree.d.ts +37 -0
  211. package/dist/xml.mjs +140 -0
  212. package/dist/xml.mjs.map +1 -0
  213. package/dist/zip/decompression-guard.d.ts +70 -0
  214. package/dist/zip/index.d.ts +6 -0
  215. package/dist/zip/random-access-reader.d.ts +16 -0
  216. package/dist/zip/reader.d.ts +45 -0
  217. package/dist/zip/writer.d.ts +65 -0
  218. package/dist/zip/zip64-patch.d.ts +12 -0
  219. package/dist/zip.mjs +3 -0
  220. package/package.json +147 -0
@@ -0,0 +1,935 @@
1
+ import type { CellValue } from '../cell/cell';
2
+ import { type Cell } from '../cell/cell';
3
+ import { type InlineFont, type TextRun } from '../cell/rich-text';
4
+ import type { Drawing } from '../drawing/drawing';
5
+ import { type Color } from '../styles/colors';
6
+ import type { AutoFilter } from './auto-filter';
7
+ import { type CellRange } from './cell-range';
8
+ import type { LegacyComment } from './comments';
9
+ import type { ConditionalFormatting } from './conditional-formatting';
10
+ import type { DataValidation } from './data-validations';
11
+ import { type ColumnDimension, type RowDimension } from './dimensions';
12
+ import type { DataConsolidate } from './data-consolidate';
13
+ import type { ScenarioList } from './scenarios';
14
+ import type { CellWatch, IgnoredError } from './errors';
15
+ import type { HeaderFooter, PageBreak, PageMargins, PageSetup, PrintOptions } from './page-setup';
16
+ import type { WorksheetPhoneticProperties } from './phonetic';
17
+ import { type SheetProperties } from './properties';
18
+ import type { SheetProtection } from './protection';
19
+ import type { ProtectedRange } from './protected-ranges';
20
+ import type { SortState } from './sort-state';
21
+ import type { WebPublishItem, WorksheetCustomProperty } from './web-publish';
22
+ import { type Hyperlink } from './hyperlinks';
23
+ import type { TableDefinition } from './table';
24
+ import { type SheetView } from './views';
25
+ export interface Worksheet {
26
+ title: string;
27
+ /** Sparse store: row index → (col index → Cell). */
28
+ rows: Map<number, Map<number, Cell>>;
29
+ /**
30
+ * Highest row index touched by `appendRow`; used to keep appendRow O(1)
31
+ * without re-scanning the row map. Direct setCell / deleteCell may move the
32
+ * actual maximum elsewhere.
33
+ */
34
+ _appendRowCursor: number;
35
+ /**
36
+ * Merged cell ranges. The top-left cell holds the value; the rest are mostly
37
+ * invisible to Excel until unmerge restores them. We persist the list as
38
+ * plain CellRange[] so mergeCells / unmergeCells can mutate it without
39
+ * rebuilding any helper structures.
40
+ */
41
+ mergedCells: CellRange[];
42
+ /**
43
+ * Per-bookView display settings. Most workbooks have exactly one view. The
44
+ * list stays empty until something — read or API — populates it; a lone
45
+ * default view doesn't earn its keep on the wire.
46
+ */
47
+ views: SheetView[];
48
+ /**
49
+ * Per-column metadata keyed by the entry's `min` index. The value's
50
+ * `min`/`max` may cover a multi-column run; iteration over the map yields one
51
+ * entry per run, in `min`-ascending order.
52
+ */
53
+ columnDimensions: Map<number, ColumnDimension>;
54
+ /** Per-row metadata keyed by 1-based row index. */
55
+ rowDimensions: Map<number, RowDimension>;
56
+ /** Default column width (characters) when not overridden by a column dimension. */
57
+ defaultColumnWidth?: number;
58
+ /** Default row height (points) when not overridden by a row dimension. */
59
+ defaultRowHeight?: number;
60
+ /**
61
+ * Highest outline depth used among `rowDimensions`. Excel uses this to size
62
+ * the outline button strip on the left of the row numbers. Auto-computed by
63
+ * the writer when undefined — set explicitly to override.
64
+ */
65
+ outlineLevelRow?: number;
66
+ /** Highest outline depth used among `columnDimensions`. Auto-computed by the writer when undefined. */
67
+ outlineLevelCol?: number;
68
+ /** "Custom row heights present" hint — Excel uses this to skip default-height rendering. */
69
+ customHeight?: boolean;
70
+ /** "Show rows of zero height as one row" — for hidden rows the outline collapse uses this. */
71
+ zeroHeight?: boolean;
72
+ /** Apply a thick top border to every row by default. */
73
+ thickTop?: boolean;
74
+ /** Apply a thick bottom border to every row by default. */
75
+ thickBottom?: boolean;
76
+ /** Excel's "base column width" (characters) — defaults to 8 when unset. */
77
+ baseColWidth?: number;
78
+ /** Hyperlinks. External URLs round-trip via worksheet rels; internal jumps stay inline. */
79
+ hyperlinks: Hyperlink[];
80
+ /** Data validation entries. */
81
+ dataValidations: DataValidation[];
82
+ /** AutoFilter — at most one per sheet. Excel reuses the `_xlnm._FilterDatabase` defined name. */
83
+ autoFilter?: AutoFilter;
84
+ /** Excel Table objects. Each lives in its own xl/tables/tableN.xml part. */
85
+ tables: TableDefinition[];
86
+ /** Legacy comments. Persisted as `xl/commentsN.xml` + a placeholder VML drawing. */
87
+ legacyComments: LegacyComment[];
88
+ /** Conditional formatting blocks. */
89
+ conditionalFormatting: ConditionalFormatting[];
90
+ /**
91
+ * `<sheetPr>` properties — VBA codeName, tab strip color, outline /
92
+ * page-setup defaults, etc. Top-level `<sheetPr>` lives just before
93
+ * `<dimension>` per ECMA-376 ordering.
94
+ */
95
+ sheetProperties?: SheetProperties;
96
+ /**
97
+ * Sheet-protection state. When `sheet=true` Excel locks the sheet against
98
+ * edits (subject to the per-action allow flags here). Password hashing
99
+ * helpers come later — for now `saltValue` / `spinCount` / `algorithmName` /
100
+ * `hashValue` round-trip verbatim.
101
+ */
102
+ sheetProtection?: SheetProtection;
103
+ /**
104
+ * `<protectedRanges>` — per-range edit-allowance overrides used when the
105
+ * sheet is otherwise protected (Review → Allow Edit Ranges).
106
+ */
107
+ protectedRanges: ProtectedRange[];
108
+ /**
109
+ * `<sortState>` — last-applied sort criteria. Excel persists this so the rows
110
+ * come back in the same order after a save/load cycle.
111
+ */
112
+ sortState?: SortState;
113
+ /**
114
+ * `<picture r:id="…"/>` — sheet background image (Page Layout → Background).
115
+ * The rId points at a media part registered in the worksheet rels (preserved
116
+ * via the existing relsExtras machinery).
117
+ */
118
+ backgroundPictureRId?: string;
119
+ /**
120
+ * `<legacyDrawingHF r:id="…"/>` — VML drawing used for header/footer
121
+ * background images on print. Parallel to legacyDrawing (which carries
122
+ * comment markers); the rels link rides relsExtras.
123
+ */
124
+ legacyDrawingHFRId?: string;
125
+ /**
126
+ * `<smartTags>` — per-cell smart-tag annotations (Excel 2003 era). Pairs with
127
+ * the workbook-level smartTagTypes registry.
128
+ */
129
+ smartTags: import('./smart-tags').CellSmartTags[];
130
+ /**
131
+ * `<customSheetViews>` — saved per-user view presets for this worksheet
132
+ * (Excel's "Custom Views" feature). Each entry snapshots zoom / gridline /
133
+ * formula / heading toggles plus its own page-setup block and break list.
134
+ */
135
+ customSheetViews: import('./custom-sheet-views').CustomSheetView[];
136
+ /**
137
+ * `<oleObjects>` — embedded OLE objects (linked Word documents, Equation
138
+ * editor formulas, etc.). The objectPr child is round-tripped verbatim as an
139
+ * XmlNode.
140
+ */
141
+ oleObjects: import('./ole-objects').OleObject[];
142
+ /**
143
+ * `<controls>` — form controls (checkboxes / list boxes / spin buttons placed
144
+ * via the Developer tab). The controlPr child is round-tripped verbatim.
145
+ */
146
+ controls: import('./ole-objects').FormControl[];
147
+ /** `<printOptions>` — gridlines, headings, horizontal/vertical centering on the printed page. */
148
+ printOptions?: PrintOptions;
149
+ /** `<pageMargins>` — six required margins in inches. */
150
+ pageMargins?: PageMargins;
151
+ /** `<pageSetup>` — paper size / orientation / scale / fitToPage / DPI etc. */
152
+ pageSetup?: PageSetup;
153
+ /** `<headerFooter>` — odd/even/first header + footer mini-format strings + flags. */
154
+ headerFooter?: HeaderFooter;
155
+ /** Manual horizontal page breaks (`<rowBreaks>`). Each entry's `id` is the row above which a new page begins. */
156
+ rowBreaks: PageBreak[];
157
+ /** Manual vertical page breaks (`<colBreaks>`). Each entry's `id` is the column to the left of which a new page begins. */
158
+ colBreaks: PageBreak[];
159
+ /**
160
+ * Worksheet-level `<customProperties>` — per-sheet user metadata that
161
+ * SharePoint workflows attach (separate from the workbook-level
162
+ * `docProps/custom.xml` part). The `rId` points at a Custom XML part
163
+ * registered in the worksheet rels (already preserved via `relsExtras`).
164
+ */
165
+ customProperties: WorksheetCustomProperty[];
166
+ /** `<webPublishItems>` — Excel 2007's "Publish to web" entries. Almost always empty in modern files. */
167
+ webPublishItems: WebPublishItem[];
168
+ /**
169
+ * `<phoneticPr>` — East-Asian furigana rendering hints (font index + IME
170
+ * conversion mode + alignment). Common in Japanese workbooks.
171
+ */
172
+ phoneticPr?: WorksheetPhoneticProperties;
173
+ /**
174
+ * `<dataConsolidate>` — config for Data → Consolidate. Carries the
175
+ * aggregation function and the source-range list.
176
+ */
177
+ dataConsolidate?: DataConsolidate;
178
+ /** `<scenarios>` — the Scenario Manager's saved input-cell overrides. */
179
+ scenarios?: ScenarioList;
180
+ /** Cells pinned in Excel's Watch Window (`<cellWatches><cellWatch r="…"/></cellWatches>`). */
181
+ cellWatches: CellWatch[];
182
+ /**
183
+ * Per-region "ignore this error class" rules (`<ignoredErrors>`). Suppresses
184
+ * the small green-triangle warning for the listed checks.
185
+ */
186
+ ignoredErrors: IgnoredError[];
187
+ /**
188
+ * Spreadsheet drawing — at most one per worksheet. Hosts charts / pictures /
189
+ * shapes. Persisted as `xl/drawings/drawingN.xml` plus a worksheet-rels
190
+ * entry; on the wire the worksheet body emits `<drawing r:id>`.
191
+ */
192
+ drawing?: Drawing;
193
+ /**
194
+ * Per-sheet rels entries we don't model (pivotTable / queryTable / slicer /
195
+ * printerSettings / customProperty / oleObject etc.). Re-emitted verbatim so
196
+ * Excel still resolves the captured passthrough parts after a round-trip.
197
+ */
198
+ relsExtras?: ReadonlyArray<{
199
+ id: string;
200
+ type: string;
201
+ target: string;
202
+ }>;
203
+ /**
204
+ * Top-level `<worksheet>` children we don't model — `<sheetPr>`,
205
+ * `<printOptions>`, `<pageMargins>`, `<pageSetup>`, `<headerFooter>`,
206
+ * `<rowBreaks>`, `<colBreaks>`, `<oleObjects>`, `<controls>`, `<picture>`,
207
+ * `<extLst>`, etc. Captured as XmlNodes; the writer emits them in two
208
+ * anchored slots so common ECMA-376 ordering survives a round-trip even
209
+ * though we don't track every position individually:
210
+ * - `beforeSheetData` → emitted before our `<dimension>` (typical for
211
+ * `<sheetPr>`).
212
+ * - `afterSheetData` → emitted between our `<hyperlinks>` and
213
+ * `<drawing>` block, which lands page setup / extLst / oleObjects in roughly
214
+ * the right place. Excel reads back regardless of strict ECMA position;
215
+ * openpyxl-emitted files round-trip cleanly.
216
+ */
217
+ bodyExtras?: {
218
+ beforeSheetData: import('../xml/tree').XmlNode[];
219
+ afterSheetData: import('../xml/tree').XmlNode[];
220
+ };
221
+ }
222
+ /** Build a Worksheet shell. */
223
+ export declare function makeWorksheet(title: string): Worksheet;
224
+ /** Resolve a 1-based or "A1" coordinate; returns the populated Cell or undefined. */
225
+ export declare function getCell(ws: Worksheet, row: number, col: number): Cell | undefined;
226
+ /**
227
+ * Create or update a Cell at (row, col). Existing cells keep their styleId /
228
+ * hyperlinkId / commentId unless explicitly overridden.
229
+ */
230
+ export declare function setCell(ws: Worksheet, row: number, col: number, value?: CellValue, styleId?: number): Cell;
231
+ /** Delete a single cell from the sheet. Empty rows are pruned. */
232
+ export declare function deleteCell(ws: Worksheet, row: number, col: number): void;
233
+ /**
234
+ * Delete every populated cell inside a range. Returns the number of cells
235
+ * removed. Row maps that go empty are pruned. Column / row dimensions, merges,
236
+ * comments etc. are left untouched.
237
+ */
238
+ export declare function clearRange(ws: Worksheet, range: string): number;
239
+ /**
240
+ * Wipe every populated cell on the worksheet, leaving styles, dimensions,
241
+ * merges, comments, hyperlinks etc. intact. Returns the count of cells removed.
242
+ * Useful when a sheet should be re-filled from scratch but its formatting kept.
243
+ */
244
+ export declare function clearAllCells(ws: Worksheet): number;
245
+ /**
246
+ * Append a row of values starting at the next empty row. Returns the row index
247
+ * (1-based). Mirrors openpyxl's `Worksheet.append`. `null` / `undefined`
248
+ * entries leave the cell empty.
249
+ */
250
+ export declare function appendRow(ws: Worksheet, values: ReadonlyArray<CellValue | undefined>): number;
251
+ /**
252
+ * Bulk version of {@link appendRow}: append a 2D array of values one row at a
253
+ * time. Returns `{firstRow, lastRow}` — both 1-based, inclusive. An empty input
254
+ * returns `{firstRow, lastRow: firstRow - 1}` so callers can detect the no-op
255
+ * without throwing.
256
+ *
257
+ * Common usage: `appendRows(ws, csvParsedRows)` for fast import.
258
+ */
259
+ export declare function appendRows(ws: Worksheet, rows: ReadonlyArray<ReadonlyArray<CellValue | undefined>>): {
260
+ firstRow: number;
261
+ lastRow: number;
262
+ };
263
+ /**
264
+ * Write a 2D array of values to the sheet starting at the given A1 anchor cell.
265
+ * Distinct from {@link appendRows} (which always writes past
266
+ * `_appendRowCursor`) — this lets you place a block at an arbitrary location,
267
+ * e.g. mid-sheet table updates.
268
+ *
269
+ * `null` / `undefined` entries leave the corresponding cell **untouched**
270
+ * (existing cell + style are preserved). Pre-existing cells inside the written
271
+ * rectangle are overwritten in place, so their `styleId` survives the write.
272
+ *
273
+ * Returns the bounding-box of the written area as 1-based inclusive
274
+ * coordinates. An empty rows array returns `undefined` rather than an invalid
275
+ * zero-area range.
276
+ */
277
+ export declare function writeRange(ws: Worksheet, startRef: string, values: ReadonlyArray<ReadonlyArray<CellValue | undefined>>): {
278
+ minRow: number;
279
+ maxRow: number;
280
+ minCol: number;
281
+ maxCol: number;
282
+ } | undefined;
283
+ export interface IterRowsOptions {
284
+ minRow?: number;
285
+ maxRow?: number;
286
+ minCol?: number;
287
+ maxCol?: number;
288
+ }
289
+ /**
290
+ * Iterate the worksheet rows rectangularly. Yields one row per row in
291
+ * `[minRow, maxRow]` — including entirely empty rows — and each yielded row
292
+ * has length `maxCol - minCol + 1`. Missing cell positions are `undefined`
293
+ * (no placeholder Cell allocations).
294
+ *
295
+ * Defaults: `minRow=1`, `maxRow=getMaxRow(ws)`, `minCol=1`,
296
+ * `maxCol=getMaxCol(ws)`. The default extent is the populated bounding box,
297
+ * not the 1M × 16K sheet limit, so the rectangular default doesn't iterate
298
+ * the whole grid for a small sheet.
299
+ *
300
+ * To iterate populated rows only, filter:
301
+ * `[...iterRows(ws)].filter(row => row.some((c) => c !== undefined))`. To
302
+ * iterate populated cells without row boundaries, use {@link iterCells}.
303
+ */
304
+ export declare function iterRows(ws: Worksheet, opts?: IterRowsOptions): IterableIterator<(Cell | undefined)[]>;
305
+ /**
306
+ * Same rectangular iteration as {@link iterRows}, but yields each cell's
307
+ * `.value`. Missing cell positions become `null` — already the canonical empty
308
+ * marker in `CellValue`.
309
+ */
310
+ export declare function iterValues(ws: Worksheet, opts?: IterRowsOptions): IterableIterator<CellValue[]>;
311
+ /**
312
+ * Yield every populated cell in the worksheet as a flat stream (row-major,
313
+ * columns ascending). Distinct from {@link iterRows} which yields one row
314
+ * per row in the bounding box — use this when the caller wants only the
315
+ * populated cells without row boundaries or rectangular padding.
316
+ */
317
+ export declare function iterCells(ws: Worksheet, opts?: IterRowsOptions): IterableIterator<Cell>;
318
+ /** Effective max row index based on populated cells (0 when empty). */
319
+ export declare function getMaxRow(ws: Worksheet): number;
320
+ /** Effective max column index based on populated cells (0 when empty). */
321
+ export declare function getMaxCol(ws: Worksheet): number;
322
+ /**
323
+ * Sorted list of every row index that holds at least one populated cell.
324
+ * Returns `[]` for an empty worksheet. Useful when a caller wants to iterate
325
+ * only the rows the user actually populated, without walking 1..maxRow in dense
326
+ * fashion.
327
+ */
328
+ export declare function getPopulatedRowIndices(ws: Worksheet): number[];
329
+ /**
330
+ * Sorted list of every column index that holds at least one populated cell
331
+ * anywhere on the sheet. Distinct columns only; returns `[]` for an empty
332
+ * worksheet.
333
+ */
334
+ export declare function getPopulatedColumnIndices(ws: Worksheet): number[];
335
+ /**
336
+ * Tally populated cells by value kind. Useful for stats / debugging dashboards
337
+ * that want a quick "this sheet has N strings, M formulas, K dates" snapshot.
338
+ *
339
+ * Buckets:
340
+ * - `null`: empty cells (cell exists but value is null)
341
+ * - `string`: plain strings
342
+ * - `number`: numeric primitives
343
+ * - `boolean`: TRUE / FALSE
344
+ * - `date`: native `Date` instances
345
+ * - `duration`: `{ kind: 'duration', ms }` values
346
+ * - `error`: `#REF!` / `#VALUE!` / etc. error values
347
+ * - `rich-text`: `{ kind: 'rich-text', runs }` values
348
+ * - `formula`: `FormulaValue` (regardless of cached value type)
349
+ */
350
+ export interface CellsByKindCounts {
351
+ null: number;
352
+ string: number;
353
+ number: number;
354
+ boolean: number;
355
+ date: number;
356
+ duration: number;
357
+ error: number;
358
+ 'rich-text': number;
359
+ formula: number;
360
+ }
361
+ /**
362
+ * Bucket a single CellValue into one of the {@link CellsByKindCounts} keys.
363
+ * Shared between {@link countCellsByKind} and the workbook-wide overview so
364
+ * the two never drift in how they classify (e.g. `Date` vs `duration`).
365
+ */
366
+ export declare function classifyCellValue(v: import('../cell/cell').CellValue): keyof CellsByKindCounts;
367
+ export declare function countCellsByKind(ws: Worksheet): CellsByKindCounts;
368
+ /**
369
+ * Sheet-qualified A1 address for a cell — `'Sheet1!A1'` for plain titles,
370
+ * `'\'Quarter 1\'!A1'` for titles needing quoting (spaces, apostrophes,
371
+ * punctuation, leading-digit). Round-trips with {@link parseSheetRange}.
372
+ *
373
+ * Useful when constructing formulas / defined-names that reference a specific
374
+ * cell across sheets without hand-rolling the quote logic.
375
+ */
376
+ export declare function getCellAddress(ws: Worksheet, c: Cell): string;
377
+ /**
378
+ * Sheet-qualified A1 range address — `'Sheet1!A1:B5'` for plain titles,
379
+ * `'\'Quarter 1\'!A1:B5'` for titles needing quoting. Pass any A1-style range
380
+ * string (single cell `'A1'`, rectangle `'A1:B5'`, row span `'1:5'`, column
381
+ * span `'A:E'`); the helper does no validation on `range` itself — that's the
382
+ * caller's responsibility.
383
+ */
384
+ export declare function getRangeAddress(ws: Worksheet, range: string): string;
385
+ /**
386
+ * True iff the worksheet has zero non-empty cells. Equivalent to
387
+ * `getNonEmptyCellCount(ws) === 0` but short-circuits on the first non-null
388
+ * value found, so the cost is O(first non-empty cell) rather than O(populated
389
+ * cells).
390
+ */
391
+ export declare function isWorksheetEmpty(ws: Worksheet): boolean;
392
+ /**
393
+ * Count non-empty cells. Distinct from {@link countCells} which counts every
394
+ * materialised cell (including ones whose `value === null`): this skips cells
395
+ * with a `null` value, plus optionally formulas / rich-text per the opts.
396
+ *
397
+ * Useful for "how many real values does this sheet contain" stats vs the
398
+ * materialised footprint.
399
+ */
400
+ export declare function getNonEmptyCellCount(ws: Worksheet, opts?: {
401
+ includeFormulas?: boolean;
402
+ includeRichText?: boolean;
403
+ }): number;
404
+ /** Total populated cell count. */
405
+ export declare function countCells(ws: Worksheet): number;
406
+ /**
407
+ * Bounding-box of the populated cells: `{ minRow, maxRow, minCol, maxCol }`
408
+ * covering every cell in `ws.rows`. Returns `undefined` when the sheet is
409
+ * empty. Walks the sparse store once.
410
+ */
411
+ export declare function getDataExtent(ws: Worksheet): {
412
+ minRow: number;
413
+ maxRow: number;
414
+ minCol: number;
415
+ maxCol: number;
416
+ } | undefined;
417
+ /**
418
+ * Same as {@link getDataExtent} but returns the canonical `"A1:E10"` range
419
+ * string for the bounding box, or `undefined` when the sheet is empty.
420
+ */
421
+ export declare function getDataExtentRef(ws: Worksheet): string | undefined;
422
+ /**
423
+ * Iterate every populated cell, yielding those for which `predicate` returns
424
+ * true. Iteration order is row-then-column ascending. Cells whose `.value ===
425
+ * null` (empty placeholders carrying only style or comment metadata) are still
426
+ * visited.
427
+ */
428
+ export declare function findCells(ws: Worksheet, predicate: (c: Cell) => boolean): IterableIterator<Cell>;
429
+ /** First populated cell satisfying `predicate`, or `undefined`. */
430
+ export declare function findFirstCell(ws: Worksheet, predicate: (c: Cell) => boolean): Cell | undefined;
431
+ /**
432
+ * Find-and-replace across populated string cells. `search` matches either an
433
+ * exact-string equal (when given a string) or every cell whose value satisfies
434
+ * the predicate (when given a function). `replacement` is the new value for
435
+ * each match. Returns the count of cells changed. Non-string-valued cells are
436
+ * skipped when `search` is a string; predicate-based searches see every cell.
437
+ */
438
+ export declare function replaceCellValues(ws: Worksheet, search: string | ((value: CellValue, cell: Cell) => boolean), replacement: CellValue): number;
439
+ /**
440
+ * Range-scoped find-and-replace. Same matching rules as {@link
441
+ * replaceCellValues} (string → exact-equal on string-valued cells; function →
442
+ * predicate over every populated cell), but only cells inside the rectangular
443
+ * `range` are visited. Returns the count changed.
444
+ */
445
+ export declare function replaceInRange(ws: Worksheet, range: string, search: string | ((value: CellValue, cell: Cell) => boolean), replacement: CellValue): number;
446
+ /**
447
+ * Iterate the populated cells inside a rectangular range. Cells that don't
448
+ * exist in the sparse store are skipped (no auto-allocate). Use {@link
449
+ * applyToRange} when you need every coordinate visited regardless of
450
+ * population.
451
+ */
452
+ export declare function getCellsInRange(ws: Worksheet, range: string): IterableIterator<Cell>;
453
+ /**
454
+ * Set a cell's value to a rich-text run array. Accepts either a pre-built
455
+ * `RichText` (frozen array of TextRun) or a fresh `Array<{ text, font? }>`
456
+ * shape — `makeRichText` normalises and freezes the runs in either case.
457
+ * Returns the cell.
458
+ */
459
+ export declare function setCellRichText(ws: Worksheet, row: number, col: number, runs: ReadonlyArray<TextRun | {
460
+ text: string;
461
+ font?: InlineFont;
462
+ }>, styleId?: number): Cell;
463
+ /**
464
+ * Set a cell's value to a normal Excel formula. Combines `setCell` with
465
+ * `setFormula`. The leading `=` is stripped if present so callers can pass
466
+ * `'=A1+1'` or `'A1+1'` interchangeably.
467
+ */
468
+ export declare function setCellFormula(ws: Worksheet, row: number, col: number, formula: string, opts?: {
469
+ cachedValue?: number | string | boolean;
470
+ styleId?: number;
471
+ }): Cell;
472
+ /**
473
+ * Set a cell's value to an array (CSE) formula spanning `ref`. Lands the
474
+ * formula on the top-left cell of the range — Excel reads the `ref` attribute
475
+ * to know how far the result spreads. Equivalent to `setCell` +
476
+ * `setArrayFormula`. Leading `=` is stripped.
477
+ */
478
+ export declare function setCellArrayFormula(ws: Worksheet, row: number, col: number, ref: string, formula: string, opts?: {
479
+ cachedValue?: number | string | boolean;
480
+ styleId?: number;
481
+ }): Cell;
482
+ /** Resolve an "A1" coordinate to a numeric (col, row) pair on the sheet. */
483
+ export declare function setCellByCoord(ws: Worksheet, coord: string, value?: CellValue, styleId?: number): Cell;
484
+ /** Convenience getter accepting an "A1" coordinate. */
485
+ export declare function getCellByCoord(ws: Worksheet, coord: string): Cell | undefined;
486
+ /**
487
+ * Merge a range. The top-left cell keeps its value; every other cell in the
488
+ * range is dropped from `ws.rows` so the on-wire `<sheetData>` won't carry
489
+ * phantom cells underneath the merge. Mirrors openpyxl's
490
+ * `MergedCellRange.format()`. Idempotent for an identical range, throws when
491
+ * the range overlaps an existing merge.
492
+ */
493
+ export declare function mergeCells(ws: Worksheet, refOrRange: string | CellRange): CellRange;
494
+ /** Drop a previously-merged range. No-op if the range isn't registered. */
495
+ export declare function unmergeCells(ws: Worksheet, refOrRange: string | CellRange): boolean;
496
+ /** Read-only iterator over the worksheet's merged ranges. */
497
+ export declare function getMergedCells(ws: Worksheet): ReadonlyArray<CellRange>;
498
+ /** True iff (row, col) sits inside any merged range — top-left included. */
499
+ export declare function isMergedCell(ws: Worksheet, row: number, col: number): boolean;
500
+ /**
501
+ * Look up the merged range covering (row, col), or `undefined` if the
502
+ * coordinate isn't inside any merge. Lets callers introspect a merge without
503
+ * iterating `getMergedCells` themselves.
504
+ */
505
+ export declare function getMergedRangeAt(ws: Worksheet, row: number, col: number): CellRange | undefined;
506
+ /**
507
+ * Drop the merge that contains (row, col), if any. Returns `true` when a merge
508
+ * was unregistered. Useful when callers know a cell coordinate but not the
509
+ * original merge bounds.
510
+ */
511
+ export declare function unmergeCellsAt(ws: Worksheet, row: number, col: number): boolean;
512
+ /**
513
+ * Drop every merged range on the worksheet. Returns the count of merges
514
+ * removed. Cells that were inside the merges keep their values — only the merge
515
+ * metadata is gone.
516
+ */
517
+ export declare function removeAllMergedRanges(ws: Worksheet): number;
518
+ /**
519
+ * Freeze rows / columns above + left of `topLeftRef` ("B2" → 1 row + 1 col).
520
+ * Pass `undefined` to clear any existing freeze. Targets the workbook's primary
521
+ * SheetView (`ws.views[0]`); creates one if absent.
522
+ */
523
+ export declare function setFreezePanes(ws: Worksheet, topLeftRef: string | undefined): void;
524
+ /** Inverse of {@link setFreezePanes}; returns the top-left ref or undefined when no freeze is active. */
525
+ export declare function getFreezePanes(ws: Worksheet): string | undefined;
526
+ /**
527
+ * Freeze the top `count` rows. Equivalent to `setFreezePanes(ws, "A${count +
528
+ * 1}")` — Excel's "Freeze Top Row" is `freezeRows(ws, 1)`.
529
+ */
530
+ export declare function freezeRows(ws: Worksheet, count: number): void;
531
+ /**
532
+ * Freeze the leftmost `count` columns. Equivalent to `setFreezePanes(ws,
533
+ * "${columnLetter(count + 1)}1")` — Excel's "Freeze First Column" is
534
+ * `freezeColumns(ws, 1)`.
535
+ */
536
+ export declare function freezeColumns(ws: Worksheet, count: number): void;
537
+ /** Freeze both top `rows` rows AND left `cols` columns. */
538
+ export declare function freezePanes(ws: Worksheet, rows: number, cols: number): void;
539
+ /** Drop the freeze pane on the primary view. */
540
+ export declare const unfreezePanes: (ws: Worksheet) => void;
541
+ /**
542
+ * Freeze the header row (row 1) so it stays visible while scrolling. Equivalent
543
+ * to Excel's "View → Freeze Top Row". Shortcut for `freezeRows(ws, 1)`.
544
+ */
545
+ export declare const freezeFirstRow: (ws: Worksheet) => void;
546
+ /**
547
+ * Freeze the leftmost column (column A) so it stays visible while scrolling
548
+ * horizontally. Equivalent to Excel's "View → Freeze First Column". Shortcut
549
+ * for `freezeColumns(ws, 1)`.
550
+ */
551
+ export declare const freezeFirstColumn: (ws: Worksheet) => void;
552
+ /**
553
+ * Freeze both row 1 and column A so the header row + label column stay visible.
554
+ * Equivalent to selecting B2 and "View → Freeze Panes". Shortcut for
555
+ * `freezePanes(ws, 1, 1)`.
556
+ */
557
+ export declare const freezeFirstRowAndColumn: (ws: Worksheet) => void;
558
+ /**
559
+ * Set the sheet tab strip colour. Accepts either a hex string (`"FF0070C0"`) or
560
+ * a partial `Color` object (`{ theme: 4, tint: 0.4 }`).
561
+ */
562
+ export declare function setSheetTabColor(ws: Worksheet, color: string | Partial<Color>): Color;
563
+ /** Drop the sheet tab strip colour. */
564
+ export declare function removeSheetTabColor(ws: Worksheet): void;
565
+ /** Toggle gridline display on the primary SheetView. */
566
+ export declare function setShowGridLines(ws: Worksheet, show: boolean): void;
567
+ /** Toggle row + column header display on the primary SheetView. */
568
+ export declare function setShowRowColHeaders(ws: Worksheet, show: boolean): void;
569
+ /** Toggle "Show Formulas" mode on the primary SheetView. */
570
+ export declare function setShowFormulas(ws: Worksheet, show: boolean): void;
571
+ /** Toggle "Show a zero in cells that have a zero value" on the primary SheetView. */
572
+ export declare function setShowZeros(ws: Worksheet, show: boolean): void;
573
+ /** Toggle right-to-left layout on the primary SheetView. */
574
+ export declare function setRightToLeft(ws: Worksheet, rtl: boolean): void;
575
+ /**
576
+ * Set the zoom scale (percent) on the primary SheetView. Excel accepts integer
577
+ * percentages in `[10, 400]`.
578
+ */
579
+ export declare function setSheetZoom(ws: Worksheet, scale: number): void;
580
+ /** Switch the sheet view between Excel's "Normal" / "Page Break Preview" / "Page Layout" modes. */
581
+ export declare function setSheetViewMode(ws: Worksheet, mode: 'normal' | 'pageBreakPreview' | 'pageLayout'): void;
582
+ /**
583
+ * Set the active cell on the primary SheetView. The active cell is the one
584
+ * Excel highlights with the dark border when the sheet is opened. Updates the
585
+ * existing Selection; creates one if missing. Pass an "A1"-style ref.
586
+ */
587
+ export declare function setActiveCell(ws: Worksheet, ref: string): void;
588
+ /**
589
+ * Set the selected range (sqref) on the primary SheetView. Accepts a single
590
+ * cell ("A1"), a single range ("A1:B5"), or a multi-cell range string ("A1
591
+ * C3:D4"). Leaves activeCell untouched unless absent — in which case it's set
592
+ * to the first ref of `sqref`.
593
+ */
594
+ export declare function setSelectedRange(ws: Worksheet, sqref: string): void;
595
+ /**
596
+ * Set values across a rectangular range from a 2-D array. `rows[0]` is laid
597
+ * down starting at the top-left of `range`; subsequent rows follow. `null` /
598
+ * `undefined` entries skip the cell. Useful for dropping a header + data block
599
+ * in one call.
600
+ */
601
+ export declare function setRangeValues(ws: Worksheet, range: string, rows: ReadonlyArray<ReadonlyArray<CellValue | null | undefined>>): void;
602
+ /**
603
+ * Iterate over every cell coordinate in a range, calling `visit` once per (row,
604
+ * col). Allocates the cell on first touch so callers can mutate it freely.
605
+ */
606
+ export declare function applyToRange(ws: Worksheet, range: string, visit: (cell: Cell, row: number, col: number) => void): void;
607
+ /**
608
+ * Read a rectangular range as a dense 2-D array of values. Empty cells yield
609
+ * `null`. The shape is `[maxRow - minRow + 1] × [maxCol - minCol + 1]`. Inverse
610
+ * of {@link setRangeValues}.
611
+ */
612
+ export declare function getRangeValues(ws: Worksheet, range: string): (CellValue | null)[][];
613
+ /**
614
+ * Copy every populated cell from `source` to `target` (within the same
615
+ * worksheet, or across worksheets via `targetWs`). Cells are shallow-cloned:
616
+ * `value` and `styleId` carry over but `row`/`col` are rewritten. The target's
617
+ * existing cells in the destination extent are overwritten; cells outside are
618
+ * untouched.
619
+ *
620
+ * The source and target ranges define the top-left corner — their dimensions
621
+ * need not match. If the target range is smaller than the source, only the
622
+ * cells that fit within the target's extent are copied; if larger, only the
623
+ * source's extent is filled.
624
+ *
625
+ * Returns the number of cells copied.
626
+ */
627
+ export declare function copyRange(ws: Worksheet, source: string, target: string, opts?: {
628
+ targetWs?: Worksheet;
629
+ }): number;
630
+ /**
631
+ * Move every populated cell from `source` to `target`. Equivalent to
632
+ * `copyRange` followed by clearing the source. When the ranges overlap on the
633
+ * same sheet, the copy walks in the direction that preserves data — high-to-low
634
+ * along any axis where the move shifts forward, low-to-high otherwise — so
635
+ * cells aren't overwritten before they've been read. Returns the number of
636
+ * cells moved.
637
+ */
638
+ export declare function moveRange(ws: Worksheet, source: string, target: string, opts?: {
639
+ targetWs?: Worksheet;
640
+ }): number;
641
+ /**
642
+ * Read all populated values in a single column. Returns one `(CellValue |
643
+ * null)` per row in `[minRow, maxRow]` (defaults to row 1 .. `getMaxRow(ws)`).
644
+ * Empty cells yield `null`. Returns `[]` when the worksheet is empty.
645
+ */
646
+ export declare function getColumnValues(ws: Worksheet, col: number, opts?: {
647
+ minRow?: number;
648
+ maxRow?: number;
649
+ }): (CellValue | null)[];
650
+ /**
651
+ * Read all populated values in a single row. Returns one `(CellValue | null)`
652
+ * per column in `[minCol, maxCol]` (defaults to col 1 .. `getMaxCol(ws)` when
653
+ * the row exists, otherwise `[]`).
654
+ */
655
+ export declare function getRowValues(ws: Worksheet, row: number, opts?: {
656
+ minCol?: number;
657
+ maxCol?: number;
658
+ }): (CellValue | null)[];
659
+ /**
660
+ * Enumerate the populated cells of a row in column order. Unlike {@link
661
+ * getRowValues}, this skips empty columns and yields the cell objects (not just
662
+ * their values). Returns `[]` when the row is absent or empty.
663
+ */
664
+ export declare function getCellsInRow(ws: Worksheet, row: number): Cell[];
665
+ /**
666
+ * Enumerate the populated cells of a column in row order. Walks the row map and
667
+ * collects whichever rows carry the column. Returns `[]` when the worksheet has
668
+ * no cell in that column.
669
+ */
670
+ export declare function getCellsInColumn(ws: Worksheet, col: number): Cell[];
671
+ /**
672
+ * Look up the ColumnDimension covering `col`. The search walks every registered
673
+ * entry's `min..max` range; that's fine for the typical spreadsheet (a handful
674
+ * of column entries) and stays simple.
675
+ */
676
+ export declare function getColumnDimension(ws: Worksheet, col: number): ColumnDimension | undefined;
677
+ /**
678
+ * Set a single-column ColumnDimension entry covering `col`. Shadows any
679
+ * existing run that overlaps — runs are not split for now (callers that need
680
+ * range-spanning entries can write directly into `ws.columnDimensions`).
681
+ */
682
+ export declare function setColumnDimension(ws: Worksheet, col: number, opts: Partial<Omit<ColumnDimension, 'min' | 'max'>>): ColumnDimension;
683
+ /** Convenience: set a column's width, leaving other fields untouched. */
684
+ export declare function setColumnWidth(ws: Worksheet, col: number, width: number): ColumnDimension;
685
+ /** Convenience: hide a column. */
686
+ export declare function hideColumn(ws: Worksheet, col: number): ColumnDimension;
687
+ /**
688
+ * Convenience: unhide a column. Drops the `hidden` flag from the column's
689
+ * dimension entry (and removes the entry altogether when no other fields
690
+ * remain).
691
+ */
692
+ export declare function unhideColumn(ws: Worksheet, col: number): void;
693
+ /** Bulk-hide every column in `[fromCol, toCol]`. */
694
+ export declare function hideColumns(ws: Worksheet, fromCol: number, toCol: number): void;
695
+ /** Bulk-unhide every column in `[fromCol, toCol]`. */
696
+ export declare function unhideColumns(ws: Worksheet, fromCol: number, toCol: number): void;
697
+ /**
698
+ * Set the default column width (characters) for cells without an explicit
699
+ * ColumnDimension entry. Mirrors Excel's "Default Width" dialog. Pass
700
+ * `undefined` to clear.
701
+ */
702
+ export declare function setDefaultColumnWidth(ws: Worksheet, width: number | undefined): void;
703
+ /**
704
+ * Set the default row height (points) for rows without an explicit RowDimension
705
+ * entry. Mirrors Excel's "Default Row Height" dialog. Pass `undefined` to
706
+ * clear.
707
+ */
708
+ export declare function setDefaultRowHeight(ws: Worksheet, height: number | undefined): void;
709
+ /**
710
+ * Mirror Excel's "Data → Group → Rows" by stamping every row in `[fromRow,
711
+ * toRow]` with an outline depth of `level` (default 1). Allocates a
712
+ * RowDimension for each row that doesn't already have one. Ungroup with {@link
713
+ * ungroupRows}.
714
+ */
715
+ export declare function groupRows(ws: Worksheet, fromRow: number, toRow: number, level?: number): void;
716
+ /**
717
+ * Drop the outline grouping for every row in `[fromRow, toRow]`. Removes the
718
+ * `outlineLevel` field from each affected RowDimension.
719
+ */
720
+ export declare function ungroupRows(ws: Worksheet, fromRow: number, toRow: number): void;
721
+ /**
722
+ * Mirror Excel's "Data → Group → Columns" by stamping every column in
723
+ * `[fromCol, toCol]` with an outline depth of `level` (default 1).
724
+ */
725
+ export declare function groupColumns(ws: Worksheet, fromCol: number, toCol: number, level?: number): void;
726
+ /**
727
+ * Drop the outline grouping for every column in `[fromCol, toCol]`. Removes the
728
+ * `outlineLevel` field from each affected ColumnDimension.
729
+ */
730
+ export declare function ungroupColumns(ws: Worksheet, fromCol: number, toCol: number): void;
731
+ /**
732
+ * Collapse a row outline group: hide every row in `[fromRow, toRow]` and mark
733
+ * them `collapsed: true`. Mirrors Excel's `−` button on a grouped row strip.
734
+ * Rows must already carry an `outlineLevel` from {@link groupRows} for the
735
+ * collapse to render correctly.
736
+ */
737
+ export declare function collapseRowGroup(ws: Worksheet, fromRow: number, toRow: number): void;
738
+ /**
739
+ * Expand a row outline group: drop the `hidden` and `collapsed` flags on every
740
+ * row in `[fromRow, toRow]`. Leaves `outlineLevel` and other dimensions intact.
741
+ */
742
+ export declare function expandRowGroup(ws: Worksheet, fromRow: number, toRow: number): void;
743
+ /**
744
+ * Collapse a column outline group: hide + mark `collapsed: true` for every
745
+ * column in `[fromCol, toCol]`. Columns must already carry an `outlineLevel`
746
+ * from {@link groupColumns} for the collapse to render correctly.
747
+ */
748
+ export declare function collapseColumnGroup(ws: Worksheet, fromCol: number, toCol: number): void;
749
+ /**
750
+ * Expand a column outline group: drop `hidden` and `collapsed` from every
751
+ * column in `[fromCol, toCol]`. Leaves `outlineLevel` intact.
752
+ */
753
+ export declare function expandColumnGroup(ws: Worksheet, fromCol: number, toCol: number): void;
754
+ /**
755
+ * Approximate autofit for a column. Scans every populated cell in `col` (or in
756
+ * `[opts.minRow, opts.maxRow]`), measures `cellValueAsString` length, and sets
757
+ * the column width to `max(length) + padding`, clamped to `[opts.min ?? 4,
758
+ * opts.max ?? 80]` and bounded above by Excel's hard limit of 255.
759
+ *
760
+ * Note: this is a string-length approximation — Excel sizes columns with the
761
+ * font's actual character-width metrics. For plain ASCII in the default Calibri
762
+ * 11 face the result is usually within ±1 width unit; CJK / wide glyphs need
763
+ * extra padding.
764
+ *
765
+ * Pass `opts.workbook` (or use the `Wb` variant via `autofitColumns`) to enable
766
+ * font-aware scaling — each cell's length is scaled by `(cellFont.size / 11)`
767
+ * so 22pt headings get roughly 2× width.
768
+ */
769
+ export declare function autofitColumn(ws: Worksheet, col: number, opts?: {
770
+ minRow?: number;
771
+ maxRow?: number;
772
+ padding?: number;
773
+ min?: number;
774
+ max?: number;
775
+ workbook?: {
776
+ styles: {
777
+ cellXfs: ReadonlyArray<{
778
+ fontId: number;
779
+ }>;
780
+ fonts: ReadonlyArray<{
781
+ size?: number;
782
+ }>;
783
+ };
784
+ };
785
+ }): ColumnDimension | undefined;
786
+ /**
787
+ * Approximate autofit for every column with at least one populated cell. Walks
788
+ * the worksheet once collecting per-column widest-length + applies {@link
789
+ * autofitColumn} per column. `opts.workbook` enables font-size-aware scaling;
790
+ * without it the helper falls back to plain string length.
791
+ */
792
+ export declare function autofitColumns(ws: Worksheet, opts?: {
793
+ padding?: number;
794
+ min?: number;
795
+ max?: number;
796
+ workbook?: {
797
+ styles: {
798
+ cellXfs: ReadonlyArray<{
799
+ fontId: number;
800
+ }>;
801
+ fonts: ReadonlyArray<{
802
+ size?: number;
803
+ }>;
804
+ };
805
+ };
806
+ }): void;
807
+ /**
808
+ * Set widths for many columns in one call. `widths` maps either:
809
+ * - an array `[12, 16, 20]` interpreted positionally starting at
810
+ * column `startCol` (default 1), or
811
+ * - a `Record<number, number>` keyed by 1-based column index.
812
+ * Each entry sets `customWidth: true`.
813
+ */
814
+ export declare function setColumnWidths(ws: Worksheet, widths: ReadonlyArray<number> | Record<number, number>, startCol?: number): void;
815
+ /** Look up a row's dimension entry. */
816
+ export declare function getRowDimension(ws: Worksheet, row: number): RowDimension | undefined;
817
+ export declare function setRowDimension(ws: Worksheet, row: number, opts: Partial<RowDimension>): RowDimension;
818
+ /** Convenience: set a row's height, marking customHeight=true. */
819
+ export declare function setRowHeight(ws: Worksheet, row: number, height: number): RowDimension;
820
+ /**
821
+ * Set heights for many rows in one call. `heights` accepts an array (positional
822
+ * from `startRow`, default 1) or a `Record<number, number>` keyed by 1-based
823
+ * row index. Each entry sets `customHeight: true`.
824
+ */
825
+ export declare function setRowHeights(ws: Worksheet, heights: ReadonlyArray<number> | Record<number, number>, startRow?: number): void;
826
+ /** Convenience: hide a row. */
827
+ export declare function hideRow(ws: Worksheet, row: number): RowDimension;
828
+ /**
829
+ * Convenience: unhide a row. Drops the `hidden` flag from the row's dimension
830
+ * entry (and removes the entry altogether when no other fields remain).
831
+ */
832
+ export declare function unhideRow(ws: Worksheet, row: number): void;
833
+ /** Bulk-hide every row in `[fromRow, toRow]`. */
834
+ export declare function hideRows(ws: Worksheet, fromRow: number, toRow: number): void;
835
+ /** Bulk-unhide every row in `[fromRow, toRow]`. */
836
+ export declare function unhideRows(ws: Worksheet, fromRow: number, toRow: number): void;
837
+ /**
838
+ * Replace any prior hyperlink on the same `ref` with the given options. Pass `{
839
+ * target }` for an external URL, `{ location }` for an internal jump, or both.
840
+ * Returns the resulting Hyperlink record.
841
+ */
842
+ export declare function setHyperlink(ws: Worksheet, ref: string, opts: {
843
+ target?: string;
844
+ location?: string;
845
+ display?: string;
846
+ tooltip?: string;
847
+ }): Hyperlink;
848
+ /** Remove the hyperlink registered against `ref`. Returns true if anything was removed. */
849
+ export declare function removeHyperlink(ws: Worksheet, ref: string): boolean;
850
+ /** Drop every hyperlink on the worksheet. Returns the count removed. */
851
+ export declare function removeAllHyperlinks(ws: Worksheet): number;
852
+ /** Look up a hyperlink by its ref. */
853
+ export declare function getHyperlink(ws: Worksheet, ref: string): Hyperlink | undefined;
854
+ /** Read-only snapshot of every hyperlink on the sheet. */
855
+ export declare function listHyperlinks(ws: Worksheet): ReadonlyArray<Hyperlink>;
856
+ /**
857
+ * Resolve a cell to its hyperlink (if any). Walks every hyperlink entry on the
858
+ * worksheet and returns the first whose `ref` (a single cell `"A1"` or a range
859
+ * `"A1:B5"`) covers the cell's coordinate. Returns `undefined` when no entry
860
+ * matches.
861
+ */
862
+ export declare function getCellHyperlink(ws: Worksheet, c: Cell): Hyperlink | undefined;
863
+ /**
864
+ * Resolve a cell to its legacy comment (if any). Same matching rule as {@link
865
+ * getCellHyperlink} — the comment's `ref` may be a single cell or a range, and
866
+ * the first containing entry wins.
867
+ */
868
+ export declare function getCellComment(ws: Worksheet, c: Cell): LegacyComment | undefined;
869
+ /** Append a DataValidation entry. */
870
+ export declare function addDataValidation(ws: Worksheet, dv: DataValidation): DataValidation;
871
+ /** Drop every validation whose sqref overlaps `ref` (string parse). Returns count removed. */
872
+ export declare function removeDataValidations(ws: Worksheet, predicate: (dv: DataValidation) => boolean): number;
873
+ /** Read-only snapshot of every data validation block on the sheet. */
874
+ export declare function listDataValidations(ws: Worksheet): ReadonlyArray<DataValidation>;
875
+ /** Drop every data validation block on the worksheet. Returns the count removed. */
876
+ export declare function removeAllDataValidations(ws: Worksheet): number;
877
+ /** Set or replace the worksheet's AutoFilter. Pass `undefined` to clear. */
878
+ export declare function setAutoFilter(ws: Worksheet, filter: AutoFilter | undefined): void;
879
+ /** Read the current AutoFilter, if any. */
880
+ export declare function getAutoFilter(ws: Worksheet): AutoFilter | undefined;
881
+ /** Append a table. The id and displayName must be workbook-unique — the caller is responsible. */
882
+ export declare function addTable(ws: Worksheet, table: TableDefinition): TableDefinition;
883
+ /** Look up a table by displayName. */
884
+ export declare function getTable(ws: Worksheet, displayName: string): TableDefinition | undefined;
885
+ /** Read-only snapshot of every Excel table defined on the sheet. */
886
+ export declare function listTables(ws: Worksheet): ReadonlyArray<TableDefinition>;
887
+ /** Drop a table by displayName. Returns true when something was removed. */
888
+ export declare function removeTable(ws: Worksheet, displayName: string): boolean;
889
+ /** Drop every Excel table on the worksheet. Returns the count removed. */
890
+ export declare function removeAllTables(ws: Worksheet): number;
891
+ /** Add or replace the comment at `ref`. */
892
+ export declare function setComment(ws: Worksheet, opts: {
893
+ ref: string;
894
+ author: string;
895
+ text: string;
896
+ }): LegacyComment;
897
+ export declare function getComment(ws: Worksheet, ref: string): LegacyComment | undefined;
898
+ export declare function removeComment(ws: Worksheet, ref: string): boolean;
899
+ /** Read-only snapshot of every legacy comment on the sheet. */
900
+ export declare function listComments(ws: Worksheet): ReadonlyArray<LegacyComment>;
901
+ /** Drop every legacy comment on the worksheet. Returns the count removed. */
902
+ export declare function removeAllComments(ws: Worksheet): number;
903
+ /**
904
+ * Replace just the text of an existing comment, leaving its ref and author
905
+ * untouched. Returns `true` when the comment was found.
906
+ */
907
+ export declare function editCommentText(ws: Worksheet, ref: string, newText: string): boolean;
908
+ /**
909
+ * Replace just the author of an existing comment, leaving its ref and text
910
+ * untouched. Returns `true` when the comment was found.
911
+ */
912
+ export declare function editCommentAuthor(ws: Worksheet, ref: string, newAuthor: string): boolean;
913
+ /**
914
+ * Rename every comment authored by `oldName` to `newName`. Returns the number
915
+ * of comments updated. Useful when consolidating comments after a team handoff
916
+ * (Excel's commentsN.xml dedups authors at save time, so a single rename
917
+ * collapses cleanly).
918
+ */
919
+ export declare function renameCommentAuthor(ws: Worksheet, oldName: string, newName: string): number;
920
+ /** Filter every legacy comment by author. */
921
+ export declare function findCommentsByAuthor(ws: Worksheet, author: string): ReadonlyArray<LegacyComment>;
922
+ /** Append a conditional formatting block. */
923
+ export declare function addConditionalFormatting(ws: Worksheet, cf: ConditionalFormatting): ConditionalFormatting;
924
+ /** All conditional formatting blocks (read-only view). */
925
+ export declare function getConditionalFormatting(ws: Worksheet): ReadonlyArray<ConditionalFormatting>;
926
+ /** Drop every conditional-formatting block on the worksheet. Returns the count removed. */
927
+ export declare function removeAllConditionalFormatting(ws: Worksheet): number;
928
+ /** Pin a cell to the Watch Window. Returns the pushed entry. */
929
+ export declare function addCellWatch(ws: Worksheet, watch: CellWatch): CellWatch;
930
+ /** Remove cell watches matching `predicate`. Returns the count removed. */
931
+ export declare function removeCellWatches(ws: Worksheet, predicate: (w: CellWatch) => boolean): number;
932
+ /** Append an ignored-error region. */
933
+ export declare function addIgnoredError(ws: Worksheet, ie: IgnoredError): IgnoredError;
934
+ /** Remove ignored-error entries matching `predicate`. Returns the count removed. */
935
+ export declare function removeIgnoredErrors(ws: Worksheet, predicate: (ie: IgnoredError) => boolean): number;