@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,173 @@
1
+ export interface PrintOptions {
2
+ /** Center the printed sheet horizontally on the page. */
3
+ horizontalCentered?: boolean;
4
+ /** Center the printed sheet vertically on the page. */
5
+ verticalCentered?: boolean;
6
+ /** Print row + column headings (the A B C / 1 2 3 strips). */
7
+ headings?: boolean;
8
+ /** Print sheet gridlines. */
9
+ gridLines?: boolean;
10
+ /** Mirrors a quirky Excel companion flag for `gridLines`. */
11
+ gridLinesSet?: boolean;
12
+ }
13
+ /** Page margins in inches. ECMA-376 §18.3.1.62. All six fields are required when the element is present. */
14
+ export interface PageMargins {
15
+ left: number;
16
+ right: number;
17
+ top: number;
18
+ bottom: number;
19
+ header: number;
20
+ footer: number;
21
+ }
22
+ export type PageOrientation = 'default' | 'portrait' | 'landscape';
23
+ export type PageOrder = 'downThenOver' | 'overThenDown';
24
+ export type CellCommentMode = 'none' | 'asDisplayed' | 'atEnd';
25
+ export type PrintErrorMode = 'displayed' | 'blank' | 'dash' | 'NA';
26
+ export interface PageSetup {
27
+ paperSize?: number;
28
+ scale?: number;
29
+ firstPageNumber?: number;
30
+ fitToWidth?: number;
31
+ fitToHeight?: number;
32
+ pageOrder?: PageOrder;
33
+ orientation?: PageOrientation;
34
+ usePrinterDefaults?: boolean;
35
+ blackAndWhite?: boolean;
36
+ draft?: boolean;
37
+ cellComments?: CellCommentMode;
38
+ useFirstPageNumber?: boolean;
39
+ errors?: PrintErrorMode;
40
+ horizontalDpi?: number;
41
+ verticalDpi?: number;
42
+ copies?: number;
43
+ /** Optional `r:id` referencing an external printerSettings part — round-tripped verbatim. */
44
+ rId?: string;
45
+ /** Paper height (UniversalMeasure, e.g. "297mm"). */
46
+ paperHeight?: string;
47
+ /** Paper width (UniversalMeasure). */
48
+ paperWidth?: string;
49
+ }
50
+ export interface HeaderFooter {
51
+ differentFirst?: boolean;
52
+ differentOddEven?: boolean;
53
+ /** Mirror Excel's "scale header/footer with document" toggle. Default true. */
54
+ scaleWithDoc?: boolean;
55
+ /** Mirror Excel's "align header/footer with margins" toggle. Default true. */
56
+ alignWithMargins?: boolean;
57
+ /**
58
+ * Mini-format string. Excel uses `&L` / `&C` / `&R` to split the three
59
+ * sections, plus codes like `&P` (page number), `&N` (page count), `&F` (file
60
+ * name), `&A` (sheet name), `&D` / `&T` (date / time). We round-trip the
61
+ * literal text — no parsing into sections.
62
+ */
63
+ oddHeader?: string;
64
+ oddFooter?: string;
65
+ evenHeader?: string;
66
+ evenFooter?: string;
67
+ firstHeader?: string;
68
+ firstFooter?: string;
69
+ }
70
+ export declare const makePageMargins: (opts?: Partial<PageMargins>) => PageMargins;
71
+ export declare const makePrintOptions: (opts?: PrintOptions) => PrintOptions;
72
+ export declare const makePageSetup: (opts?: PageSetup) => PageSetup;
73
+ export declare const makeHeaderFooter: (opts?: HeaderFooter) => HeaderFooter;
74
+ /**
75
+ * One manual page break. `id` is the row (for rowBreaks) or column (for
76
+ * colBreaks) index where the break sits; `min`/`max` constrain the orthogonal
77
+ * range Excel honours; `man=true` means a user-placed break (default true).
78
+ * `pt` indicates a "pivot table" break — rare.
79
+ */
80
+ export interface PageBreak {
81
+ id?: number;
82
+ min?: number;
83
+ max?: number;
84
+ man?: boolean;
85
+ pt?: boolean;
86
+ }
87
+ export declare const makePageBreak: (opts?: PageBreak) => PageBreak;
88
+ import type { Worksheet } from './worksheet';
89
+ /** Set page orientation on `ws.pageSetup` (allocates if missing). */
90
+ export declare const setPageOrientation: (ws: Worksheet, orientation: PageOrientation) => void;
91
+ /** Set paper size code (Excel uses ECMA-376 §3.3 paper-size enums; 1=Letter, 9=A4 etc.). */
92
+ export declare const setPaperSize: (ws: Worksheet, paperSize: number) => void;
93
+ /** Set the print scale percentage (10..400). */
94
+ export declare const setPrintScale: (ws: Worksheet, scale: number) => void;
95
+ /** Set fitToWidth + fitToHeight (Excel "Fit to N pages wide × M tall" UI). */
96
+ export declare const setFitToPage: (ws: Worksheet, opts: {
97
+ width?: number;
98
+ height?: number;
99
+ }) => void;
100
+ /** Replace ws.pageMargins with the provided values (uses Excel defaults for missing axes). */
101
+ export declare const setPageMargins: (ws: Worksheet, opts?: Partial<PageMargins>) => void;
102
+ export type HeaderFooterSection = 'odd' | 'even' | 'first';
103
+ /** Set the header text for a given section. Excel uses `&L` / `&C` / `&R` codes inside the string. */
104
+ export declare const setHeader: (ws: Worksheet, section: HeaderFooterSection, text: string) => void;
105
+ /** Set the footer text for a given section. */
106
+ export declare const setFooter: (ws: Worksheet, section: HeaderFooterSection, text: string) => void;
107
+ /**
108
+ * Excel's reserved header / footer code tokens. Drop these into the left /
109
+ * center / right text inputs of {@link buildHeaderFooterText} (or directly into
110
+ * a setHeader / setFooter string) to render dynamic values at print time.
111
+ */
112
+ export declare const HEADER_FOOTER_CODES: Readonly<{
113
+ /** Current page number. */
114
+ pageNumber: "&P";
115
+ /** Total number of pages. */
116
+ pageCount: "&N";
117
+ /** Print date. */
118
+ date: "&D";
119
+ /** Print time. */
120
+ time: "&T";
121
+ /** File path + name. */
122
+ filePath: "&Z&F";
123
+ /** File name only. */
124
+ fileName: "&F";
125
+ /** Sheet name. */
126
+ sheetName: "&A";
127
+ /** Embedded image (Excel inserts via "Insert Picture" — `&G` is the placeholder). */
128
+ picture: "&G";
129
+ }>;
130
+ /**
131
+ * Build a header / footer string from optional left / center / right fragments
132
+ * using Excel's `&L` / `&C` / `&R` markers. An empty fragment is omitted (no
133
+ * marker emitted) so a center-only header doesn't leave a stray `&L` prefix.
134
+ * Returns `''` when all three fragments are undefined.
135
+ */
136
+ export declare const buildHeaderFooterText: (parts: {
137
+ left?: string;
138
+ center?: string;
139
+ right?: string;
140
+ }) => string;
141
+ /**
142
+ * Set a header by left / center / right parts. `section` defaults to `'odd'`
143
+ * (the standard pages); pass `'first'` or `'even'` to target the alternate
144
+ * sections (Excel auto-flips the corresponding differentOddEven /
145
+ * differentFirst flag).
146
+ */
147
+ export declare const setHeaderText: (ws: Worksheet, parts: {
148
+ left?: string;
149
+ center?: string;
150
+ right?: string;
151
+ }, section?: HeaderFooterSection) => void;
152
+ /** Same shape as {@link setHeaderText} but writes the corresponding footer slot. */
153
+ export declare const setFooterText: (ws: Worksheet, parts: {
154
+ left?: string;
155
+ center?: string;
156
+ right?: string;
157
+ }, section?: HeaderFooterSection) => void;
158
+ /** Push a manual horizontal page break above the given row (1-based). Defaults to `man=true`. */
159
+ export declare const addRowBreak: (ws: Worksheet, row: number) => PageBreak;
160
+ /** Push a manual vertical page break to the left of the given column (1-based). Defaults to `man=true`. */
161
+ export declare const addColBreak: (ws: Worksheet, col: number) => PageBreak;
162
+ /** Toggle "Print gridlines". Mirrors Excel's "Page Layout → Sheet Options → Gridlines: Print". */
163
+ export declare const setPrintGridLines: (ws: Worksheet, on: boolean) => void;
164
+ /** Toggle "Print row and column headings" (the A B C / 1 2 3 strips on the printed page). */
165
+ export declare const setPrintHeadings: (ws: Worksheet, on: boolean) => void;
166
+ /**
167
+ * Toggle horizontal / vertical centering on the printed page. Pass either field
168
+ * to leave the other untouched.
169
+ */
170
+ export declare const setPrintCentered: (ws: Worksheet, opts: {
171
+ horizontal?: boolean;
172
+ vertical?: boolean;
173
+ }) => void;
@@ -0,0 +1,11 @@
1
+ export type PhoneticType = 'halfwidthKatakana' | 'fullwidthKatakana' | 'Hiragana' | 'noConversion';
2
+ export type PhoneticAlignment = 'noControl' | 'left' | 'center' | 'distributed';
3
+ export interface WorksheetPhoneticProperties {
4
+ /** Font index in the workbook's stylesheet for the furigana glyphs. */
5
+ fontId?: number;
6
+ /** Conversion mode the IME should default to when adding furigana. */
7
+ type?: PhoneticType;
8
+ /** Horizontal alignment of the furigana strip relative to the base text. */
9
+ alignment?: PhoneticAlignment;
10
+ }
11
+ export declare const makeWorksheetPhoneticProperties: (opts?: WorksheetPhoneticProperties) => WorksheetPhoneticProperties;
@@ -0,0 +1,34 @@
1
+ import type { Color } from '../styles/colors';
2
+ export interface OutlineProperties {
3
+ applyStyles?: boolean;
4
+ /** "Summary rows below detail" — Excel default true. */
5
+ summaryBelow?: boolean;
6
+ /** "Summary columns to right of detail" — Excel default true. */
7
+ summaryRight?: boolean;
8
+ showOutlineSymbols?: boolean;
9
+ }
10
+ export interface PageSetupProperties {
11
+ autoPageBreaks?: boolean;
12
+ fitToPage?: boolean;
13
+ }
14
+ export interface SheetProperties {
15
+ /** VBA codeName for the sheet ("Sheet1" by default but localizable). */
16
+ codeName?: string;
17
+ enableFormatConditionsCalculation?: boolean;
18
+ /** Whether the sheet has an active filter set up. */
19
+ filterMode?: boolean;
20
+ /** Whether the sheet is published to a SharePoint Excel Services list. */
21
+ published?: boolean;
22
+ /** Sync* attrs control multi-sheet scroll synchronisation. */
23
+ syncHorizontal?: boolean;
24
+ syncRef?: string;
25
+ syncVertical?: boolean;
26
+ /** "Lotus 1-2-3 transition" toggles — almost never seen in modern files. */
27
+ transitionEvaluation?: boolean;
28
+ transitionEntry?: boolean;
29
+ /** Tab strip colour for this sheet (the coloured stripe at the bottom). */
30
+ tabColor?: Color;
31
+ outlinePr?: OutlineProperties;
32
+ pageSetUpPr?: PageSetupProperties;
33
+ }
34
+ export declare const makeSheetProperties: (opts?: SheetProperties) => SheetProperties;
@@ -0,0 +1,19 @@
1
+ import type { MultiCellRange } from './cell-range';
2
+ export interface ProtectedRange {
3
+ /** Range to expose for editing while the sheet is protected. */
4
+ sqref: MultiCellRange;
5
+ /** Display name shown in the dialog. */
6
+ name: string;
7
+ /** Legacy 16-bit hex password. */
8
+ password?: string;
9
+ /** Optional security descriptor (Windows ACL string). */
10
+ securityDescriptor?: string;
11
+ algorithmName?: string;
12
+ hashValue?: string;
13
+ saltValue?: string;
14
+ spinCount?: number;
15
+ }
16
+ export declare const makeProtectedRange: (opts: Partial<ProtectedRange> & {
17
+ sqref: MultiCellRange;
18
+ name: string;
19
+ }) => ProtectedRange;
@@ -0,0 +1,44 @@
1
+ export interface SheetProtection {
2
+ /** Master toggle — when true the sheet is protected. */
3
+ sheet?: boolean;
4
+ /** Allow operations on drawing objects when sheet is protected. */
5
+ objects?: boolean;
6
+ /** Allow operations on scenarios when sheet is protected. */
7
+ scenarios?: boolean;
8
+ formatCells?: boolean;
9
+ formatColumns?: boolean;
10
+ formatRows?: boolean;
11
+ insertColumns?: boolean;
12
+ insertRows?: boolean;
13
+ insertHyperlinks?: boolean;
14
+ deleteColumns?: boolean;
15
+ deleteRows?: boolean;
16
+ selectLockedCells?: boolean;
17
+ selectUnlockedCells?: boolean;
18
+ sort?: boolean;
19
+ autoFilter?: boolean;
20
+ pivotTables?: boolean;
21
+ /** Base-64 salt for the password hash. */
22
+ saltValue?: string;
23
+ /** Number of hash iterations. */
24
+ spinCount?: number;
25
+ /** Hash algorithm name, e.g. "SHA-512". */
26
+ algorithmName?: string;
27
+ /** Base-64 hashed password. */
28
+ hashValue?: string;
29
+ }
30
+ export declare const makeSheetProtection: (opts?: SheetProtection) => SheetProtection;
31
+ import type { Worksheet } from './worksheet';
32
+ /**
33
+ * Lock a worksheet with Excel's "Protect Sheet" defaults. Pass `overrides` to
34
+ * allow specific actions while otherwise locked (e.g. `{ sort: true,
35
+ * autoFilter: true }` for "allow sort + filter on locked sheet"). Password-hash
36
+ * fields can be supplied as a quad (algorithmName / hashValue / saltValue /
37
+ * spinCount); plaintext passwords are out of scope until the D-tier hashing
38
+ * helper lands.
39
+ */
40
+ export declare const protectSheet: (ws: Worksheet, overrides?: Partial<SheetProtection>) => SheetProtection;
41
+ /** Drop the typed sheet-protection record. */
42
+ export declare const unprotectSheet: (ws: Worksheet) => void;
43
+ /** Quick-lock helper that mirrors Excel's "Allow users to edit ranges → Protect Sheet" defaults. */
44
+ export declare const isSheetProtected: (ws: Worksheet) => boolean;
@@ -0,0 +1,38 @@
1
+ import type { Drawing } from '../drawing/drawing';
2
+ import type { Relationships } from '../packaging/relationships';
3
+ import { type XmlNode } from '../xml/tree';
4
+ import type { LegacyComment } from './comments';
5
+ import type { HeaderFooter, PageMargins, PageSetup } from './page-setup';
6
+ import type { WebPublishItem } from './web-publish';
7
+ import type { TableDefinition } from './table';
8
+ import { type Worksheet } from './worksheet';
9
+ /** Inputs the worksheet reader needs from the surrounding workbook context. */
10
+ export interface WorksheetReadContext {
11
+ /** Resolved shared-strings table. Pass `[]` when no sst is present. */
12
+ sharedStrings: ReadonlyArray<string>;
13
+ /** This worksheet's `_rels/sheetN.xml.rels`. Used to resolve external hyperlink targets and table parts. */
14
+ rels?: Relationships;
15
+ /** Resolves a worksheet-rels rId pointing at xl/tables/tableN.xml into a parsed TableDefinition. */
16
+ loadTable?: (relId: string) => TableDefinition | undefined;
17
+ /**
18
+ * Loader for comments parts (rels Type=…/comments). Called once per matching
19
+ * rel; the reader appends every returned LegacyComment onto
20
+ * `ws.legacyComments`.
21
+ */
22
+ loadComments?: (relId: string) => ReadonlyArray<LegacyComment> | undefined;
23
+ /**
24
+ * Loader for the worksheet's drawing part. Called once when the worksheet
25
+ * inline carries `<drawing r:id="...">`.
26
+ */
27
+ loadDrawing?: (relId: string) => Drawing | undefined;
28
+ }
29
+ /**
30
+ * Parse a `xl/worksheets/sheetN.xml` payload into a fully-populated Worksheet.
31
+ * The returned worksheet's `title` matches the `title` argument; the XML
32
+ * doesn't carry the sheet name (it lives in `workbook.xml`).
33
+ */
34
+ export declare function parseWorksheetXml(bytes: Uint8Array | string, title: string, ctx: WorksheetReadContext): Worksheet;
35
+ export declare const parseWebPublishItem: (node: XmlNode) => WebPublishItem | undefined;
36
+ export declare const parsePageMargins: (node: XmlNode) => PageMargins | undefined;
37
+ export declare const parsePageSetup: (node: XmlNode) => PageSetup | undefined;
38
+ export declare const parseHeaderFooter: (node: XmlNode) => HeaderFooter | undefined;
@@ -0,0 +1,36 @@
1
+ import type { MultiCellRange } from './cell-range';
2
+ /** One <inputCells> entry — a single (cell, override-value) pair. */
3
+ export interface ScenarioInputCell {
4
+ /** Single-cell ref, e.g. "B5". */
5
+ ref: string;
6
+ /** Stored as a string on the wire (Excel uses int / float / text format codes via numFmtId). */
7
+ val: string;
8
+ /** Mark this entry as deleted in the scenario history. */
9
+ deleted?: boolean;
10
+ /** Marks an undone change in the scenario history. */
11
+ undone?: boolean;
12
+ /** Number-format index used to display the override. */
13
+ numFmtId?: number;
14
+ }
15
+ export interface Scenario {
16
+ name: string;
17
+ inputCells: ScenarioInputCell[];
18
+ /** When true, Excel disables editing the scenario unless the workbook protection password is supplied. */
19
+ locked?: boolean;
20
+ /** Hide the scenario from the picker dialog. */
21
+ hidden?: boolean;
22
+ user?: string;
23
+ comment?: string;
24
+ }
25
+ export interface ScenarioList {
26
+ scenarios: Scenario[];
27
+ /** Index of the currently active scenario. */
28
+ current?: number;
29
+ /** Index of the scenario shown by default. */
30
+ show?: number;
31
+ /** Range that the scenarios change (output cells). */
32
+ sqref?: MultiCellRange;
33
+ }
34
+ export declare const makeScenarioInputCell: (opts: ScenarioInputCell) => ScenarioInputCell;
35
+ export declare const makeScenario: (opts: Scenario) => Scenario;
36
+ export declare const makeScenarioList: (opts?: Partial<ScenarioList>) => ScenarioList;
@@ -0,0 +1,23 @@
1
+ export interface CellSmartTagProperty {
2
+ key: string;
3
+ val: string;
4
+ }
5
+ export interface CellSmartTag {
6
+ /** 0-based index into the workbook's smartTagTypes list. */
7
+ type: number;
8
+ properties: CellSmartTagProperty[];
9
+ deleted?: boolean;
10
+ xmlBased?: boolean;
11
+ }
12
+ export interface CellSmartTags {
13
+ /** Single-cell ref ("A1"). */
14
+ ref: string;
15
+ tags: CellSmartTag[];
16
+ }
17
+ export declare const makeCellSmartTagProperty: (key: string, val: string) => CellSmartTagProperty;
18
+ export declare const makeCellSmartTag: (opts: Partial<CellSmartTag> & {
19
+ type: number;
20
+ }) => CellSmartTag;
21
+ export declare const makeCellSmartTags: (opts: Partial<CellSmartTags> & {
22
+ ref: string;
23
+ }) => CellSmartTags;
@@ -0,0 +1,28 @@
1
+ export type SortBy = 'value' | 'cellColor' | 'fontColor' | 'icon';
2
+ export type SortMethod = 'stroke' | 'pinYin';
3
+ export type SortIconSet = '3Arrows' | '3ArrowsGray' | '3Flags' | '3TrafficLights1' | '3TrafficLights2' | '3Signs' | '3Symbols' | '3Symbols2' | '4Arrows' | '4ArrowsGray' | '4RedToBlack' | '4Rating' | '4TrafficLights' | '5Arrows' | '5ArrowsGray' | '5Rating' | '5Quarters';
4
+ export interface SortCondition {
5
+ /** Column or row that drives this sort key. */
6
+ ref: string;
7
+ descending?: boolean;
8
+ sortBy?: SortBy;
9
+ /** Reference to a custom-list defined name. */
10
+ customList?: string;
11
+ /** Differential-style index (`<dxf>` slot in the stylesheet). */
12
+ dxfId?: number;
13
+ iconSet?: SortIconSet;
14
+ iconId?: number;
15
+ }
16
+ export interface SortState {
17
+ /** Range the sort applies to (`A1:D20`). */
18
+ ref: string;
19
+ conditions: SortCondition[];
20
+ /** Sort columns instead of rows (rare). */
21
+ columnSort?: boolean;
22
+ caseSensitive?: boolean;
23
+ sortMethod?: SortMethod;
24
+ }
25
+ export declare const makeSortCondition: (opts: SortCondition) => SortCondition;
26
+ export declare const makeSortState: (opts: Partial<SortState> & {
27
+ ref: string;
28
+ }) => SortState;
@@ -0,0 +1,5 @@
1
+ import type { TableDefinition } from './table';
2
+ /** Parse a `xl/tables/tableN.xml` payload. */
3
+ export declare function parseTableXml(bytes: Uint8Array | string): TableDefinition;
4
+ /** Serialise a TableDefinition to its `xl/tables/tableN.xml` bytes. */
5
+ export declare function tableToBytes(table: TableDefinition): Uint8Array;
@@ -0,0 +1,80 @@
1
+ import type { Workbook } from '../workbook/workbook';
2
+ import type { AutoFilter } from './auto-filter';
3
+ import type { Worksheet } from './worksheet';
4
+ export interface TableColumn {
5
+ /** 1-based column id (per-table). */
6
+ id: number;
7
+ /** Header name. */
8
+ name: string;
9
+ /** Totals-row aggregation function. */
10
+ totalsRowFunction?: 'sum' | 'min' | 'max' | 'count' | 'countNums' | 'average' | 'stdDev' | 'var' | 'custom';
11
+ /** Override label for the totals row. */
12
+ totalsRowLabel?: string;
13
+ /** Custom totals-row formula text. */
14
+ totalsRowFormula?: string;
15
+ /** Calculated-column formula. */
16
+ calculatedColumnFormula?: string;
17
+ }
18
+ export interface TableStyleInfo {
19
+ /** Built-in style name (TableStyleMedium2, etc) or custom. */
20
+ name?: string;
21
+ showFirstColumn?: boolean;
22
+ showLastColumn?: boolean;
23
+ showRowStripes?: boolean;
24
+ showColumnStripes?: boolean;
25
+ }
26
+ export interface TableDefinition {
27
+ /** Workbook-unique id (`<table id="N">`). */
28
+ id: number;
29
+ /** Workbook-unique displayName — Excel surfaces this in formulas. */
30
+ displayName: string;
31
+ /** Optional friendly name; usually matches `displayName`. */
32
+ name?: string;
33
+ /** Range covered by the table, e.g. "A1:E10". */
34
+ ref: string;
35
+ /** Number of header rows. Defaults to 1; 0 means a header-less table. */
36
+ headerRowCount?: number;
37
+ /** Number of totals rows. */
38
+ totalsRowCount?: number;
39
+ /** Whether the totals row is currently visible. */
40
+ totalsRowShown?: boolean;
41
+ styleInfo?: TableStyleInfo;
42
+ columns: TableColumn[];
43
+ autoFilter?: AutoFilter;
44
+ /** Worksheet-rels rId — populated on read; the writer assigns its own. */
45
+ rId?: string;
46
+ }
47
+ export declare function makeTableColumn(opts: {
48
+ id: number;
49
+ name: string;
50
+ }): TableColumn;
51
+ export declare function makeTableDefinition(opts: {
52
+ id: number;
53
+ displayName: string;
54
+ ref: string;
55
+ name?: string;
56
+ columns?: TableColumn[];
57
+ headerRowCount?: number;
58
+ totalsRowCount?: number;
59
+ totalsRowShown?: boolean;
60
+ styleInfo?: TableStyleInfo;
61
+ autoFilter?: AutoFilter;
62
+ }): TableDefinition;
63
+ /**
64
+ * High-level wrapper that builds a TableDefinition + pushes it onto `ws.tables`
65
+ * in one call. Auto-assigns the workbook-unique `id`, derives `displayName`
66
+ * from the supplied `name`, and constructs `TableColumn` records (1-based ids)
67
+ * from a string-array shorthand.
68
+ */
69
+ export declare const addExcelTable: (wb: Workbook, ws: Worksheet, opts: {
70
+ name: string;
71
+ ref: string;
72
+ columns: ReadonlyArray<string | TableColumn>;
73
+ style?: string;
74
+ styleInfo?: TableStyleInfo;
75
+ headerRowCount?: number;
76
+ totalsRowCount?: number;
77
+ totalsRowShown?: boolean;
78
+ autoFilter?: AutoFilter;
79
+ displayName?: string;
80
+ }) => TableDefinition;
@@ -0,0 +1,47 @@
1
+ export type PaneType = 'bottomRight' | 'topRight' | 'bottomLeft' | 'topLeft';
2
+ export type PaneState = 'split' | 'frozen' | 'frozenSplit';
3
+ export type SheetViewMode = 'normal' | 'pageBreakPreview' | 'pageLayout';
4
+ export interface Pane {
5
+ /** Column-axis split. Number of columns frozen on the left. */
6
+ xSplit?: number;
7
+ /** Row-axis split. Number of rows frozen on top. */
8
+ ySplit?: number;
9
+ /** First visible cell of the bottom-right pane. */
10
+ topLeftCell?: string;
11
+ /** Which pane is active when the sheet is opened. Defaults to `bottomRight` for full freezes. */
12
+ activePane?: PaneType;
13
+ state: PaneState;
14
+ }
15
+ export interface Selection {
16
+ pane?: PaneType;
17
+ activeCell?: string;
18
+ sqref?: string;
19
+ }
20
+ export interface SheetView {
21
+ /** Index into the parent workbook's bookViews list. Defaults to 0. */
22
+ workbookViewId: number;
23
+ tabSelected?: boolean;
24
+ showGridLines?: boolean;
25
+ showRowColHeaders?: boolean;
26
+ showFormulas?: boolean;
27
+ showZeros?: boolean;
28
+ rightToLeft?: boolean;
29
+ view?: SheetViewMode;
30
+ topLeftCell?: string;
31
+ zoomScale?: number;
32
+ zoomScaleNormal?: number;
33
+ pane?: Pane;
34
+ selection?: Selection;
35
+ }
36
+ /** Build a SheetView with sensible defaults. */
37
+ export declare function makeSheetView(opts?: Partial<SheetView>): SheetView;
38
+ /**
39
+ * Build a frozen Pane from a top-left coordinate. Per Excel semantics:
40
+ * - "B2" → freeze 1 row + 1 col → xSplit=1, ySplit=1, activePane='bottomRight'
41
+ * - "A2" → freeze 1 row only → ySplit=1, activePane='bottomLeft'
42
+ * - "B1" → freeze 1 col only → xSplit=1, activePane='topRight'
43
+ * - "A1" → no freeze; throws (caller should clear `ws.views[].pane`).
44
+ */
45
+ export declare function makeFreezePane(topLeftRef: string): Pane;
46
+ /** Inverse of {@link makeFreezePane}. Returns the top-left ref of the bottomRight pane, or undefined. */
47
+ export declare function freezePaneRef(view: SheetView): string | undefined;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * One <customProperty>. The `rId` points at a Custom XML part registered in the
3
+ * worksheet rels (e.g. for SharePoint sync metadata).
4
+ */
5
+ export interface WorksheetCustomProperty {
6
+ name: string;
7
+ /** Worksheet-rels rId pointing at the Custom XML part backing this entry. */
8
+ rId?: string;
9
+ }
10
+ export interface WebPublishItem {
11
+ id: number;
12
+ divId: string;
13
+ sourceType: 'sheet' | 'printArea' | 'autoFilter' | 'range' | 'chart' | 'pivotTable' | 'query' | 'label';
14
+ sourceRef?: string;
15
+ sourceObject?: string;
16
+ destinationFile: string;
17
+ title?: string;
18
+ autoRepublish?: boolean;
19
+ }
20
+ export declare const makeWorksheetCustomProperty: (opts: WorksheetCustomProperty) => WorksheetCustomProperty;
21
+ export declare const makeWebPublishItem: (opts: WebPublishItem) => WebPublishItem;