@shbernal/ts-xlsx 3.0.0 → 3.1.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 (213) hide show
  1. package/README.md +4 -1
  2. package/dist/bytes.d.ts +7 -0
  3. package/dist/bytes.js +22 -0
  4. package/dist/core/address.d.ts +60 -2
  5. package/dist/core/address.js +40 -24
  6. package/dist/core/autofilter.d.ts +4 -3
  7. package/dist/core/autofilter.js +31 -30
  8. package/dist/core/axis-handle.d.ts +2 -0
  9. package/dist/core/axis-handle.js +5 -2
  10. package/dist/core/cell.d.ts +4 -3
  11. package/dist/core/cell.js +4 -6
  12. package/dist/core/clone.d.ts +29 -0
  13. package/dist/core/clone.js +24 -0
  14. package/dist/core/color-resolution.js +2 -4
  15. package/dist/core/column.d.ts +1 -0
  16. package/dist/core/column.js +3 -0
  17. package/dist/core/comment-thread.js +2 -1
  18. package/dist/core/conditional-formatting-overlay.d.ts +2 -1
  19. package/dist/core/conditional-formatting-overlay.js +2 -2
  20. package/dist/core/conditional-formatting.d.ts +9 -1
  21. package/dist/core/conditional-formatting.js +34 -18
  22. package/dist/core/containers.d.ts +12 -0
  23. package/dist/core/containers.js +5 -0
  24. package/dist/core/data-validation-overlay.d.ts +2 -1
  25. package/dist/core/data-validation-overlay.js +4 -4
  26. package/dist/core/data-validation.d.ts +6 -0
  27. package/dist/core/data-validation.js +15 -4
  28. package/dist/core/date-format.d.ts +20 -0
  29. package/dist/core/date-format.js +160 -0
  30. package/dist/core/date.d.ts +43 -8
  31. package/dist/core/date.js +18 -2
  32. package/dist/core/formula.d.ts +26 -0
  33. package/dist/core/formula.js +20 -4
  34. package/dist/core/grid-edits.d.ts +2 -3
  35. package/dist/core/grid-edits.js +69 -70
  36. package/dist/core/grid-shift.d.ts +58 -9
  37. package/dist/core/grid-shift.js +26 -4
  38. package/dist/core/image.d.ts +13 -9
  39. package/dist/core/image.js +7 -5
  40. package/dist/core/internal.d.ts +8 -2
  41. package/dist/core/limits.d.ts +23 -0
  42. package/dist/core/limits.js +4 -0
  43. package/dist/core/merge.d.ts +5 -4
  44. package/dist/core/merge.js +18 -19
  45. package/dist/core/pivot-table.js +63 -45
  46. package/dist/core/protection.js +2 -11
  47. package/dist/core/range.js +34 -30
  48. package/dist/core/row-input.js +2 -2
  49. package/dist/core/row.d.ts +1 -0
  50. package/dist/core/row.js +3 -0
  51. package/dist/core/style.d.ts +85 -70
  52. package/dist/core/style.js +92 -28
  53. package/dist/core/table-style.d.ts +1 -1
  54. package/dist/core/table-style.js +4 -4
  55. package/dist/core/table.d.ts +27 -9
  56. package/dist/core/table.js +51 -34
  57. package/dist/core/theme.js +6 -5
  58. package/dist/core/value.d.ts +9 -0
  59. package/dist/core/value.js +36 -34
  60. package/dist/core/workbook-media.d.ts +34 -0
  61. package/dist/core/workbook-media.js +44 -0
  62. package/dist/core/workbook-styles.d.ts +67 -1
  63. package/dist/core/workbook-vba.js +3 -2
  64. package/dist/core/workbook.d.ts +23 -2
  65. package/dist/core/workbook.js +24 -40
  66. package/dist/core/worksheet-comments.d.ts +2 -1
  67. package/dist/core/worksheet-comments.js +20 -13
  68. package/dist/core/worksheet-merges.d.ts +44 -0
  69. package/dist/core/worksheet-merges.js +59 -0
  70. package/dist/core/worksheet-model.d.ts +9 -1
  71. package/dist/core/worksheet-model.js +24 -9
  72. package/dist/core/worksheet.d.ts +55 -6
  73. package/dist/core/worksheet.js +36 -44
  74. package/dist/customui/ribbon.js +2 -1
  75. package/dist/entries/core.d.ts +18 -13
  76. package/dist/entries/core.js +12 -6
  77. package/dist/entries/xlsx.d.ts +1 -1
  78. package/dist/errors.d.ts +64 -0
  79. package/dist/errors.js +22 -0
  80. package/dist/hex.d.ts +8 -0
  81. package/dist/hex.js +3 -0
  82. package/dist/io/csv/delimiter.d.ts +9 -0
  83. package/dist/io/csv/delimiter.js +6 -0
  84. package/dist/io/csv/read.js +11 -4
  85. package/dist/io/csv/write.d.ts +9 -2
  86. package/dist/io/csv/write.js +9 -38
  87. package/dist/io/opc/inflate.js +14 -0
  88. package/dist/io/opc/namespaces.d.ts +16 -0
  89. package/dist/io/opc/namespaces.js +4 -0
  90. package/dist/io/opc/part-paths.d.ts +9 -0
  91. package/dist/io/opc/part-paths.js +1 -1
  92. package/dist/io/opc/read-opc.d.ts +54 -14
  93. package/dist/io/opc/read-opc.js +42 -20
  94. package/dist/io/opc/read-options.d.ts +5 -1
  95. package/dist/io/opc/sniff-format.d.ts +3 -3
  96. package/dist/io/opc/sniff-format.js +2 -2
  97. package/dist/io/style/xf-style.d.ts +23 -1
  98. package/dist/io/style/xf-style.js +8 -0
  99. package/dist/io/xlsb/formula.d.ts +2 -2
  100. package/dist/io/xlsb/formula.js +49 -34
  101. package/dist/io/xlsb/primitives.js +8 -14
  102. package/dist/io/xlsb/ptg-functions.d.ts +19 -10
  103. package/dist/io/xlsb/ptg-functions.js +385 -596
  104. package/dist/io/xlsb/read-styles.js +45 -81
  105. package/dist/io/xlsb/read-worksheet.d.ts +20 -1
  106. package/dist/io/xlsb/read-worksheet.js +73 -89
  107. package/dist/io/xlsb/read.d.ts +6 -3
  108. package/dist/io/xlsb/read.js +44 -23
  109. package/dist/io/xlsb/record-stream.d.ts +30 -0
  110. package/dist/io/xlsb/record-stream.js +20 -0
  111. package/dist/io/xlsb/record-types.d.ts +1 -5
  112. package/dist/io/xlsb/record-types.js +1 -5
  113. package/dist/io/xlsx/cell-accumulator.d.ts +8 -1
  114. package/dist/io/xlsx/cell-accumulator.js +32 -9
  115. package/dist/io/xlsx/cell-style-resolution.d.ts +25 -0
  116. package/dist/io/xlsx/cell-style-resolution.js +29 -0
  117. package/dist/io/xlsx/cell-value.d.ts +5 -3
  118. package/dist/io/xlsx/cell-value.js +13 -15
  119. package/dist/io/xlsx/color-xml.js +3 -2
  120. package/dist/io/xlsx/column-budget.d.ts +26 -0
  121. package/dist/io/xlsx/column-budget.js +22 -0
  122. package/dist/io/xlsx/comments.d.ts +6 -2
  123. package/dist/io/xlsx/comments.js +36 -32
  124. package/dist/io/xlsx/conditional-formatting.d.ts +6 -3
  125. package/dist/io/xlsx/conditional-formatting.js +30 -26
  126. package/dist/io/xlsx/data-validation.js +29 -27
  127. package/dist/io/xlsx/edit-vba.d.ts +7 -2
  128. package/dist/io/xlsx/edit-vba.js +14 -21
  129. package/dist/io/xlsx/font-xml.d.ts +7 -0
  130. package/dist/io/xlsx/font-xml.js +104 -0
  131. package/dist/io/xlsx/hyperlinks.d.ts +37 -5
  132. package/dist/io/xlsx/hyperlinks.js +22 -13
  133. package/dist/io/xlsx/images.js +11 -13
  134. package/dist/io/xlsx/namespaces.d.ts +16 -0
  135. package/dist/io/xlsx/namespaces.js +7 -0
  136. package/dist/io/xlsx/package-plan.d.ts +14 -2
  137. package/dist/io/xlsx/package-plan.js +39 -11
  138. package/dist/io/xlsx/pivot.js +8 -7
  139. package/dist/io/xlsx/read-parts.d.ts +59 -0
  140. package/dist/io/xlsx/read-parts.js +252 -0
  141. package/dist/io/xlsx/read-pivot.js +2 -1
  142. package/dist/io/xlsx/read-repair.d.ts +26 -0
  143. package/dist/io/xlsx/read-repair.js +39 -0
  144. package/dist/io/xlsx/{rich-runs.js → read-rich-runs.js} +6 -3
  145. package/dist/io/xlsx/read-rows.d.ts +18 -5
  146. package/dist/io/xlsx/read-rows.js +45 -31
  147. package/dist/io/xlsx/read-shared-strings.js +3 -2
  148. package/dist/io/xlsx/read-styles.d.ts +1 -6
  149. package/dist/io/xlsx/read-styles.js +6 -71
  150. package/dist/io/xlsx/read-workbook-xml.d.ts +36 -0
  151. package/dist/io/xlsx/read-workbook-xml.js +170 -0
  152. package/dist/io/xlsx/read-worksheet.d.ts +2 -1
  153. package/dist/io/xlsx/read-worksheet.js +35 -164
  154. package/dist/io/xlsx/read.d.ts +5 -12
  155. package/dist/io/xlsx/read.js +73 -406
  156. package/dist/io/xlsx/rich-text.js +1 -1
  157. package/dist/io/xlsx/row-position.d.ts +18 -0
  158. package/dist/io/xlsx/row-position.js +11 -0
  159. package/dist/io/xlsx/row-xml.d.ts +128 -0
  160. package/dist/io/xlsx/row-xml.js +203 -0
  161. package/dist/io/xlsx/shared-formulas.js +2 -2
  162. package/dist/io/xlsx/sheet-properties.d.ts +10 -1
  163. package/dist/io/xlsx/sheet-properties.js +145 -9
  164. package/dist/io/xlsx/style-elements.d.ts +43 -0
  165. package/dist/io/xlsx/style-elements.js +156 -0
  166. package/dist/io/xlsx/styles.d.ts +12 -3
  167. package/dist/io/xlsx/styles.js +5 -207
  168. package/dist/io/xlsx/tables.js +10 -14
  169. package/dist/io/xlsx/theme-xml.d.ts +26 -4
  170. package/dist/io/xlsx/theme-xml.js +107 -69
  171. package/dist/io/xlsx/threaded-comments.d.ts +8 -10
  172. package/dist/io/xlsx/threaded-comments.js +2 -1
  173. package/dist/io/xlsx/workbook-xml.d.ts +54 -4
  174. package/dist/io/xlsx/workbook-xml.js +60 -34
  175. package/dist/io/xlsx/worksheet-xml.d.ts +23 -70
  176. package/dist/io/xlsx/worksheet-xml.js +48 -229
  177. package/dist/io/xlsx/write-stream.d.ts +65 -16
  178. package/dist/io/xlsx/write-stream.js +50 -20
  179. package/dist/io/xlsx/write.d.ts +1 -2
  180. package/dist/io/xlsx/write.js +114 -74
  181. package/dist/rel-type.d.ts +16 -0
  182. package/dist/rel-type.js +6 -0
  183. package/dist/token-set.d.ts +13 -0
  184. package/dist/token-set.js +4 -1
  185. package/dist/vba/bytes.d.ts +14 -5
  186. package/dist/vba/bytes.js +16 -6
  187. package/dist/vba/cfb-format.d.ts +8 -0
  188. package/dist/vba/cfb-format.js +1 -0
  189. package/dist/vba/cfb-writer.d.ts +9 -0
  190. package/dist/vba/cfb-writer.js +12 -9
  191. package/dist/vba/cfb.d.ts +13 -1
  192. package/dist/vba/cfb.js +73 -51
  193. package/dist/vba/codepage.js +2 -1
  194. package/dist/vba/errors.d.ts +7 -0
  195. package/dist/vba/ms-ovba.js +51 -16
  196. package/dist/vba/project-editor.js +35 -40
  197. package/dist/vba/project.d.ts +11 -1
  198. package/dist/vba/project.js +27 -8
  199. package/dist/vba/vba-encoding.js +4 -5
  200. package/dist/xml/xml-attrs.d.ts +37 -0
  201. package/dist/xml/xml-attrs.js +30 -0
  202. package/dist/xml/xml-chars.d.ts +40 -0
  203. package/dist/xml/xml-chars.js +12 -0
  204. package/dist/xml/xml-namespaces.d.ts +31 -0
  205. package/dist/xml/xml-namespaces.js +50 -0
  206. package/dist/xml/xml-read.d.ts +72 -10
  207. package/dist/xml/xml-read.js +94 -18
  208. package/dist/xml/xml-scan.d.ts +15 -37
  209. package/dist/xml/xml-scan.js +12 -40
  210. package/dist/xml/xml.d.ts +28 -27
  211. package/dist/xml/xml.js +24 -24
  212. package/package.json +12 -7
  213. /package/dist/io/xlsx/{rich-runs.d.ts → read-rich-runs.d.ts} +0 -0
@@ -1,13 +1,17 @@
1
- import { MAX_COLUMN, MAX_ROW, tryDecodeRange } from '../../core/address.js';
1
+ import { tryDecodeRange } from '../../core/address.js';
2
2
  import { isCustomFilterOperator, } from '../../core/autofilter.js';
3
3
  import { INTERNAL } from '../../core/internal.js';
4
- import { HEADER_FOOTER_ELEMENTS, MARGIN_SIDES, PAGE_SETUP_FACETS, PRINT_OPTION_FLAGS, } from '../../core/page-setup.js';
5
- import { SHEET_PROTECTION_FLAGS, } from '../../core/protection.js';
4
+ import { HEADER_FOOTER_ELEMENTS } from '../../core/page-setup.js';
6
5
  import { assignStyleFacets } from '../../core/style.js';
6
+ import { decodeSpreadsheetText, numFinite, numInteger } from '../../xml/xml-attrs.js';
7
7
  import {} from '../../xml/xml-read.js';
8
- import { boolPresent, boolStrict, boolTristate, decodeSpreadsheetText, localName, numFinite, numInteger, } from '../../xml/xml-scan.js';
8
+ import { boolPresent, boolStrict, localName } from '../../xml/xml-scan.js';
9
9
  import { CellAccumulator } from './cell-accumulator.js';
10
- import { parseColor } from './color-xml.js';
10
+ import { CellStyleResolver } from './cell-style-resolution.js';
11
+ import { ColumnRecordBudget, takeColumnSpan } from './column-budget.js';
12
+ import { admitting } from './read-repair.js';
13
+ import { RowPositionTracker } from './row-position.js';
14
+ import { applySheetProperties, PageBreakAccumulator, parseSheetProtection, } from './sheet-properties.js';
11
15
  const HEADER_FOOTER_CHILDREN = new Set(HEADER_FOOTER_ELEMENTS);
12
16
  function isHeaderFooterElement(local) {
13
17
  return HEADER_FOOTER_CHILDREN.has(local);
@@ -22,31 +26,6 @@ function pendingFilterCriteria(values, blank, predicates, and) {
22
26
  }
23
27
  return null;
24
28
  }
25
- function parseSheetProtection(attrs) {
26
- if (boolTristate(attrs.sheet) === false)
27
- return undefined;
28
- const flags = {};
29
- for (const { key } of SHEET_PROTECTION_FLAGS) {
30
- const raw = attrs[key];
31
- if (raw !== undefined)
32
- flags[key] = !boolStrict(raw);
33
- }
34
- const { algorithmName, hashValue, saltValue, spinCount } = attrs;
35
- const spin = numInteger(spinCount, 0);
36
- if (algorithmName !== undefined &&
37
- hashValue !== undefined &&
38
- saltValue !== undefined &&
39
- spin !== undefined) {
40
- const credential = {
41
- algorithmName,
42
- hashValue,
43
- saltValue,
44
- spinCount: spin,
45
- };
46
- return { flags, credential };
47
- }
48
- return { flags };
49
- }
50
29
  class AutoFilterAccumulator {
51
30
  #ref = null;
52
31
  #columns = [];
@@ -106,42 +85,15 @@ class AutoFilterAccumulator {
106
85
  this.#columns = [];
107
86
  }
108
87
  }
109
- class PageBreakAccumulator {
110
- #target = null;
111
- begin(target) {
112
- this.#target = target;
113
- }
114
- end() {
115
- this.#target = null;
116
- }
117
- add(attrs) {
118
- if (this.#target === null)
119
- return;
120
- const id = numInteger(attrs.id, 1);
121
- if (id === undefined)
122
- return;
123
- const brk = { id };
124
- const max = numInteger(attrs.max, 0);
125
- if (max !== undefined)
126
- brk.max = max;
127
- if (boolStrict(attrs.man))
128
- brk.man = true;
129
- this.#target.push(brk);
130
- }
131
- }
132
- export function worksheetPass(sheet, sharedStrings, xfStyles) {
133
- const cell = new CellAccumulator({ richRuns: true });
134
- let rowStyle = -1;
135
- let rowCustomFormat = false;
88
+ export function worksheetPass(sheet, sharedStrings, xfStyles, dateEpoch) {
89
+ const cell = new CellAccumulator({ richRuns: true, dateEpoch });
136
90
  const autoFilter = new AutoFilterAccumulator();
137
91
  const pageBreaks = new PageBreakAccumulator();
138
- const columnStyle = new Map();
92
+ const styleResolution = new CellStyleResolver();
93
+ const columnBudget = new ColumnRecordBudget();
94
+ const rowPosition = new RowPositionTracker();
139
95
  const finalizeCellFromState = () => {
140
- const styleIndex = cell.styleIndex >= 0
141
- ? cell.styleIndex
142
- : rowCustomFormat && rowStyle >= 0
143
- ? rowStyle
144
- : (columnStyle.get(cell.col) ?? -1);
96
+ const styleIndex = styleResolution.indexFor(cell.col, cell.styleIndex);
145
97
  const style = styleIndex >= 0 ? xfStyles[styleIndex] : xfStyles[0];
146
98
  cell.finalize(sheet, sharedStrings, style);
147
99
  };
@@ -156,22 +108,25 @@ export function worksheetPass(sheet, sharedStrings, xfStyles) {
156
108
  }
157
109
  switch (local) {
158
110
  case 'col':
159
- applyColumn(sheet, attrs, xfStyles, columnStyle);
111
+ applyColumn(sheet, attrs, xfStyles, styleResolution, columnBudget);
160
112
  break;
161
- case 'row':
162
- applyRow(sheet, attrs);
163
- rowStyle = numInteger(attrs.s, 0) ?? -1;
164
- rowCustomFormat = boolStrict(attrs.customFormat);
113
+ case 'row': {
114
+ const { number, inGrid } = rowPosition.open(attrs);
115
+ if (inGrid)
116
+ applyRow(sheet, number, attrs);
117
+ cell.openRow(inGrid ? number : -1);
118
+ styleResolution.openRow(attrs);
165
119
  break;
120
+ }
166
121
  case 'mergeCell':
167
122
  if (attrs.ref !== undefined && attrs.ref !== '') {
168
- try {
169
- sheet.mergeCells(attrs.ref);
170
- }
171
- catch {
172
- }
123
+ const ref = attrs.ref;
124
+ admitting(() => {
125
+ sheet.mergeCells(ref);
126
+ });
173
127
  }
174
128
  break;
129
+ case 'sheetPr':
175
130
  case 'tabColor':
176
131
  case 'outlinePr':
177
132
  case 'sheetView':
@@ -235,8 +190,7 @@ export function worksheetPass(sheet, sharedStrings, xfStyles) {
235
190
  }
236
191
  switch (local) {
237
192
  case 'row':
238
- rowStyle = -1;
239
- rowCustomFormat = false;
193
+ styleResolution.closeRow();
240
194
  break;
241
195
  case 'filterColumn':
242
196
  autoFilter.endColumn();
@@ -255,56 +209,11 @@ export function worksheetPass(sheet, sharedStrings, xfStyles) {
255
209
  };
256
210
  return { handlers, closeEmptyElements: WORKSHEET_EMPTY_CLOSES };
257
211
  }
258
- function applySheetProperties(local, attrs, sheet) {
259
- switch (local) {
260
- case 'tabColor':
261
- sheet.tabColor = parseColor(attrs);
262
- break;
263
- case 'outlinePr':
264
- if (attrs.summaryBelow !== undefined)
265
- sheet.outline.summaryBelow = boolPresent(attrs.summaryBelow);
266
- if (attrs.summaryRight !== undefined)
267
- sheet.outline.summaryRight = boolPresent(attrs.summaryRight);
268
- break;
269
- case 'sheetView':
270
- if (attrs.showGridLines !== undefined && !boolPresent(attrs.showGridLines)) {
271
- sheet.view.showGridLines = false;
272
- }
273
- break;
274
- case 'pane':
275
- if (attrs.state === 'frozen' || attrs.state === 'frozenSplit') {
276
- sheet.view.state = 'frozen';
277
- const xSplit = numInteger(attrs.xSplit, 0);
278
- const ySplit = numInteger(attrs.ySplit, 0);
279
- if (xSplit !== undefined)
280
- sheet.view.xSplit = xSplit;
281
- if (ySplit !== undefined)
282
- sheet.view.ySplit = ySplit;
283
- if (attrs.topLeftCell !== undefined)
284
- sheet.view.topLeftCell = attrs.topLeftCell;
285
- }
286
- break;
287
- case 'pageSetUpPr':
288
- if (attrs.fitToPage !== undefined)
289
- sheet.pageSetup.fitToPage = boolPresent(attrs.fitToPage);
290
- break;
291
- case 'printOptions':
292
- applyPrintOptions(sheet.printOptions, attrs);
293
- break;
294
- case 'pageMargins':
295
- applyMargins(sheet.pageMargins, attrs);
296
- break;
297
- case 'pageSetup':
298
- applyPageSetup(sheet.pageSetup, attrs);
299
- break;
300
- }
301
- }
302
- function applyColumn(sheet, attrs, xfStyles, columnStyle) {
303
- const min = numInteger(attrs.min, 1);
304
- const max = numInteger(attrs.max, 1);
305
- if (min === undefined || max === undefined || min > MAX_COLUMN)
212
+ function applyColumn(sheet, attrs, xfStyles, styleResolution, budget) {
213
+ const span = takeColumnSpan(attrs, budget);
214
+ if (span === undefined)
306
215
  return;
307
- const last = Math.min(max, MAX_COLUMN);
216
+ const { first: min, last } = span;
308
217
  const width = numFinite(attrs.width);
309
218
  const hidden = boolStrict(attrs.hidden);
310
219
  const styleIndex = numInteger(attrs.style, 0) ?? -1;
@@ -322,14 +231,10 @@ function applyColumn(sheet, attrs, xfStyles, columnStyle) {
322
231
  column.collapsed = true;
323
232
  if (style !== undefined)
324
233
  assignStyleFacets(column, style);
325
- if (styleIndex >= 0)
326
- columnStyle.set(index, styleIndex);
327
234
  }
235
+ styleResolution.noteColumnSpan(min, last, attrs);
328
236
  }
329
- function applyRow(sheet, attrs) {
330
- const number = numInteger(attrs.r, 1);
331
- if (number === undefined || number > MAX_ROW)
332
- return;
237
+ function applyRow(sheet, number, attrs) {
333
238
  const row = sheet.getRow(number);
334
239
  const height = numFinite(attrs.ht);
335
240
  if (height !== undefined && boolPresent(attrs.customHeight))
@@ -342,37 +247,3 @@ function applyRow(sheet, attrs) {
342
247
  if (boolStrict(attrs.collapsed))
343
248
  row.collapsed = true;
344
249
  }
345
- function applyPrintOptions(printOptions, attrs) {
346
- for (const flag of PRINT_OPTION_FLAGS) {
347
- const value = boolTristate(attrs[flag]);
348
- if (value !== undefined)
349
- printOptions[flag] = value;
350
- }
351
- }
352
- function applyMargins(margins, attrs) {
353
- for (const side of MARGIN_SIDES) {
354
- const value = numFinite(attrs[side]);
355
- if (value !== undefined)
356
- margins[side] = value;
357
- }
358
- }
359
- function applyPageSetup(pageSetup, attrs) {
360
- for (const facet of PAGE_SETUP_FACETS) {
361
- const raw = attrs[facet.key];
362
- switch (facet.kind) {
363
- case 'count': {
364
- const value = numInteger(raw, 0);
365
- if (value !== undefined)
366
- pageSetup[facet.key] = value;
367
- break;
368
- }
369
- case 'token':
370
- if (raw !== undefined && facet.isValid(raw))
371
- assignPageSetupToken(pageSetup, facet.key, raw);
372
- break;
373
- }
374
- }
375
- }
376
- function assignPageSetupToken(pageSetup, key, raw) {
377
- pageSetup[key] = raw;
378
- }
@@ -1,9 +1,9 @@
1
- import { Workbook, type WorkbookView } from '../../core/workbook.ts';
2
- import { type WorksheetState } from '../../core/worksheet.ts';
3
- import type { ReadXlsxOptions } from '../opc/read-options.ts';
4
- export type { ReadXlsxOptions } from '../opc/read-options.ts';
1
+ import { Workbook } from '../../core/workbook.ts';
2
+ import type { ReadPackageOptions } from '../opc/read-options.ts';
3
+ export type { ReadPackageOptions } from '../opc/read-options.ts';
5
4
  export type { StyleTable, XfStyle } from '../style/xf-style.ts';
6
5
  export { parseStyleTable } from './read-styles.ts';
6
+ export { type SheetEntry, workbookPropertiesPass, workbookSheetsPass, workbookViewPass, } from './read-workbook-xml.ts';
7
7
  /**
8
8
  * Read a spreadsheet package into a {@link Workbook}.
9
9
  *
@@ -19,11 +19,4 @@ export { parseStyleTable } from './read-styles.ts';
19
19
  * @throws {PackageReadError} if the input is a ZIP that cannot be unpacked: a corrupt or
20
20
  * truncated archive, or one exceeding the inflate bound (a probable zip bomb).
21
21
  */
22
- export declare function readXlsx(data: Uint8Array, options?: ReadXlsxOptions): Workbook;
23
- export interface SheetEntry {
24
- readonly name: string;
25
- readonly relId: string;
26
- readonly state?: WorksheetState['state'];
27
- }
28
- export declare function parseWorkbookSheets(xml: string): SheetEntry[];
29
- export declare function applyWorkbookView(view: WorkbookView, xml: string): void;
22
+ export declare function readXlsx(data: Uint8Array, options?: ReadPackageOptions): Workbook;