@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.
- package/README.md +4 -1
- package/dist/bytes.d.ts +7 -0
- package/dist/bytes.js +22 -0
- package/dist/core/address.d.ts +60 -2
- package/dist/core/address.js +40 -24
- package/dist/core/autofilter.d.ts +4 -3
- package/dist/core/autofilter.js +31 -30
- package/dist/core/axis-handle.d.ts +2 -0
- package/dist/core/axis-handle.js +5 -2
- package/dist/core/cell.d.ts +4 -3
- package/dist/core/cell.js +4 -6
- package/dist/core/clone.d.ts +29 -0
- package/dist/core/clone.js +24 -0
- package/dist/core/color-resolution.js +2 -4
- package/dist/core/column.d.ts +1 -0
- package/dist/core/column.js +3 -0
- package/dist/core/comment-thread.js +2 -1
- package/dist/core/conditional-formatting-overlay.d.ts +2 -1
- package/dist/core/conditional-formatting-overlay.js +2 -2
- package/dist/core/conditional-formatting.d.ts +9 -1
- package/dist/core/conditional-formatting.js +34 -18
- package/dist/core/containers.d.ts +12 -0
- package/dist/core/containers.js +5 -0
- package/dist/core/data-validation-overlay.d.ts +2 -1
- package/dist/core/data-validation-overlay.js +4 -4
- package/dist/core/data-validation.d.ts +6 -0
- package/dist/core/data-validation.js +15 -4
- package/dist/core/date-format.d.ts +20 -0
- package/dist/core/date-format.js +160 -0
- package/dist/core/date.d.ts +43 -8
- package/dist/core/date.js +18 -2
- package/dist/core/formula.d.ts +26 -0
- package/dist/core/formula.js +20 -4
- package/dist/core/grid-edits.d.ts +2 -3
- package/dist/core/grid-edits.js +69 -70
- package/dist/core/grid-shift.d.ts +58 -9
- package/dist/core/grid-shift.js +26 -4
- package/dist/core/image.d.ts +13 -9
- package/dist/core/image.js +7 -5
- package/dist/core/internal.d.ts +8 -2
- package/dist/core/limits.d.ts +23 -0
- package/dist/core/limits.js +4 -0
- package/dist/core/merge.d.ts +5 -4
- package/dist/core/merge.js +18 -19
- package/dist/core/pivot-table.js +63 -45
- package/dist/core/protection.js +2 -11
- package/dist/core/range.js +34 -30
- package/dist/core/row-input.js +2 -2
- package/dist/core/row.d.ts +1 -0
- package/dist/core/row.js +3 -0
- package/dist/core/style.d.ts +85 -70
- package/dist/core/style.js +92 -28
- package/dist/core/table-style.d.ts +1 -1
- package/dist/core/table-style.js +4 -4
- package/dist/core/table.d.ts +27 -9
- package/dist/core/table.js +51 -34
- package/dist/core/theme.js +6 -5
- package/dist/core/value.d.ts +9 -0
- package/dist/core/value.js +36 -34
- package/dist/core/workbook-media.d.ts +34 -0
- package/dist/core/workbook-media.js +44 -0
- package/dist/core/workbook-styles.d.ts +67 -1
- package/dist/core/workbook-vba.js +3 -2
- package/dist/core/workbook.d.ts +23 -2
- package/dist/core/workbook.js +24 -40
- package/dist/core/worksheet-comments.d.ts +2 -1
- package/dist/core/worksheet-comments.js +20 -13
- package/dist/core/worksheet-merges.d.ts +44 -0
- package/dist/core/worksheet-merges.js +59 -0
- package/dist/core/worksheet-model.d.ts +9 -1
- package/dist/core/worksheet-model.js +24 -9
- package/dist/core/worksheet.d.ts +55 -6
- package/dist/core/worksheet.js +36 -44
- package/dist/customui/ribbon.js +2 -1
- package/dist/entries/core.d.ts +18 -13
- package/dist/entries/core.js +12 -6
- package/dist/entries/xlsx.d.ts +1 -1
- package/dist/errors.d.ts +64 -0
- package/dist/errors.js +22 -0
- package/dist/hex.d.ts +8 -0
- package/dist/hex.js +3 -0
- package/dist/io/csv/delimiter.d.ts +9 -0
- package/dist/io/csv/delimiter.js +6 -0
- package/dist/io/csv/read.js +11 -4
- package/dist/io/csv/write.d.ts +9 -2
- package/dist/io/csv/write.js +9 -38
- package/dist/io/opc/inflate.js +14 -0
- package/dist/io/opc/namespaces.d.ts +16 -0
- package/dist/io/opc/namespaces.js +4 -0
- package/dist/io/opc/part-paths.d.ts +9 -0
- package/dist/io/opc/part-paths.js +1 -1
- package/dist/io/opc/read-opc.d.ts +54 -14
- package/dist/io/opc/read-opc.js +42 -20
- package/dist/io/opc/read-options.d.ts +5 -1
- package/dist/io/opc/sniff-format.d.ts +3 -3
- package/dist/io/opc/sniff-format.js +2 -2
- package/dist/io/style/xf-style.d.ts +23 -1
- package/dist/io/style/xf-style.js +8 -0
- package/dist/io/xlsb/formula.d.ts +2 -2
- package/dist/io/xlsb/formula.js +49 -34
- package/dist/io/xlsb/primitives.js +8 -14
- package/dist/io/xlsb/ptg-functions.d.ts +19 -10
- package/dist/io/xlsb/ptg-functions.js +385 -596
- package/dist/io/xlsb/read-styles.js +45 -81
- package/dist/io/xlsb/read-worksheet.d.ts +20 -1
- package/dist/io/xlsb/read-worksheet.js +73 -89
- package/dist/io/xlsb/read.d.ts +6 -3
- package/dist/io/xlsb/read.js +44 -23
- package/dist/io/xlsb/record-stream.d.ts +30 -0
- package/dist/io/xlsb/record-stream.js +20 -0
- package/dist/io/xlsb/record-types.d.ts +1 -5
- package/dist/io/xlsb/record-types.js +1 -5
- package/dist/io/xlsx/cell-accumulator.d.ts +8 -1
- package/dist/io/xlsx/cell-accumulator.js +32 -9
- package/dist/io/xlsx/cell-style-resolution.d.ts +25 -0
- package/dist/io/xlsx/cell-style-resolution.js +29 -0
- package/dist/io/xlsx/cell-value.d.ts +5 -3
- package/dist/io/xlsx/cell-value.js +13 -15
- package/dist/io/xlsx/color-xml.js +3 -2
- package/dist/io/xlsx/column-budget.d.ts +26 -0
- package/dist/io/xlsx/column-budget.js +22 -0
- package/dist/io/xlsx/comments.d.ts +6 -2
- package/dist/io/xlsx/comments.js +36 -32
- package/dist/io/xlsx/conditional-formatting.d.ts +6 -3
- package/dist/io/xlsx/conditional-formatting.js +30 -26
- package/dist/io/xlsx/data-validation.js +29 -27
- package/dist/io/xlsx/edit-vba.d.ts +7 -2
- package/dist/io/xlsx/edit-vba.js +14 -21
- package/dist/io/xlsx/font-xml.d.ts +7 -0
- package/dist/io/xlsx/font-xml.js +104 -0
- package/dist/io/xlsx/hyperlinks.d.ts +37 -5
- package/dist/io/xlsx/hyperlinks.js +22 -13
- package/dist/io/xlsx/images.js +11 -13
- package/dist/io/xlsx/namespaces.d.ts +16 -0
- package/dist/io/xlsx/namespaces.js +7 -0
- package/dist/io/xlsx/package-plan.d.ts +14 -2
- package/dist/io/xlsx/package-plan.js +39 -11
- package/dist/io/xlsx/pivot.js +8 -7
- package/dist/io/xlsx/read-parts.d.ts +59 -0
- package/dist/io/xlsx/read-parts.js +252 -0
- package/dist/io/xlsx/read-pivot.js +2 -1
- package/dist/io/xlsx/read-repair.d.ts +26 -0
- package/dist/io/xlsx/read-repair.js +39 -0
- package/dist/io/xlsx/{rich-runs.js → read-rich-runs.js} +6 -3
- package/dist/io/xlsx/read-rows.d.ts +18 -5
- package/dist/io/xlsx/read-rows.js +45 -31
- package/dist/io/xlsx/read-shared-strings.js +3 -2
- package/dist/io/xlsx/read-styles.d.ts +1 -6
- package/dist/io/xlsx/read-styles.js +6 -71
- package/dist/io/xlsx/read-workbook-xml.d.ts +36 -0
- package/dist/io/xlsx/read-workbook-xml.js +170 -0
- package/dist/io/xlsx/read-worksheet.d.ts +2 -1
- package/dist/io/xlsx/read-worksheet.js +35 -164
- package/dist/io/xlsx/read.d.ts +5 -12
- package/dist/io/xlsx/read.js +73 -406
- package/dist/io/xlsx/rich-text.js +1 -1
- package/dist/io/xlsx/row-position.d.ts +18 -0
- package/dist/io/xlsx/row-position.js +11 -0
- package/dist/io/xlsx/row-xml.d.ts +128 -0
- package/dist/io/xlsx/row-xml.js +203 -0
- package/dist/io/xlsx/shared-formulas.js +2 -2
- package/dist/io/xlsx/sheet-properties.d.ts +10 -1
- package/dist/io/xlsx/sheet-properties.js +145 -9
- package/dist/io/xlsx/style-elements.d.ts +43 -0
- package/dist/io/xlsx/style-elements.js +156 -0
- package/dist/io/xlsx/styles.d.ts +12 -3
- package/dist/io/xlsx/styles.js +5 -207
- package/dist/io/xlsx/tables.js +10 -14
- package/dist/io/xlsx/theme-xml.d.ts +26 -4
- package/dist/io/xlsx/theme-xml.js +107 -69
- package/dist/io/xlsx/threaded-comments.d.ts +8 -10
- package/dist/io/xlsx/threaded-comments.js +2 -1
- package/dist/io/xlsx/workbook-xml.d.ts +54 -4
- package/dist/io/xlsx/workbook-xml.js +60 -34
- package/dist/io/xlsx/worksheet-xml.d.ts +23 -70
- package/dist/io/xlsx/worksheet-xml.js +48 -229
- package/dist/io/xlsx/write-stream.d.ts +65 -16
- package/dist/io/xlsx/write-stream.js +50 -20
- package/dist/io/xlsx/write.d.ts +1 -2
- package/dist/io/xlsx/write.js +114 -74
- package/dist/rel-type.d.ts +16 -0
- package/dist/rel-type.js +6 -0
- package/dist/token-set.d.ts +13 -0
- package/dist/token-set.js +4 -1
- package/dist/vba/bytes.d.ts +14 -5
- package/dist/vba/bytes.js +16 -6
- package/dist/vba/cfb-format.d.ts +8 -0
- package/dist/vba/cfb-format.js +1 -0
- package/dist/vba/cfb-writer.d.ts +9 -0
- package/dist/vba/cfb-writer.js +12 -9
- package/dist/vba/cfb.d.ts +13 -1
- package/dist/vba/cfb.js +73 -51
- package/dist/vba/codepage.js +2 -1
- package/dist/vba/errors.d.ts +7 -0
- package/dist/vba/ms-ovba.js +51 -16
- package/dist/vba/project-editor.js +35 -40
- package/dist/vba/project.d.ts +11 -1
- package/dist/vba/project.js +27 -8
- package/dist/vba/vba-encoding.js +4 -5
- package/dist/xml/xml-attrs.d.ts +37 -0
- package/dist/xml/xml-attrs.js +30 -0
- package/dist/xml/xml-chars.d.ts +40 -0
- package/dist/xml/xml-chars.js +12 -0
- package/dist/xml/xml-namespaces.d.ts +31 -0
- package/dist/xml/xml-namespaces.js +50 -0
- package/dist/xml/xml-read.d.ts +72 -10
- package/dist/xml/xml-read.js +94 -18
- package/dist/xml/xml-scan.d.ts +15 -37
- package/dist/xml/xml-scan.js +12 -40
- package/dist/xml/xml.d.ts +28 -27
- package/dist/xml/xml.js +24 -24
- package/package.json +12 -7
- /package/dist/io/xlsx/{rich-runs.d.ts → read-rich-runs.d.ts} +0 -0
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import {
|
|
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
|
|
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,
|
|
8
|
+
import { boolPresent, boolStrict, localName } from '../../xml/xml-scan.js';
|
|
9
9
|
import { CellAccumulator } from './cell-accumulator.js';
|
|
10
|
-
import {
|
|
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
|
-
|
|
110
|
-
|
|
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
|
|
92
|
+
const styleResolution = new CellStyleResolver();
|
|
93
|
+
const columnBudget = new ColumnRecordBudget();
|
|
94
|
+
const rowPosition = new RowPositionTracker();
|
|
139
95
|
const finalizeCellFromState = () => {
|
|
140
|
-
const styleIndex = cell.styleIndex
|
|
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,
|
|
111
|
+
applyColumn(sheet, attrs, xfStyles, styleResolution, columnBudget);
|
|
160
112
|
break;
|
|
161
|
-
case 'row':
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
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
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
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
|
-
|
|
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
|
|
259
|
-
|
|
260
|
-
|
|
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
|
|
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
|
-
}
|
package/dist/io/xlsx/read.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Workbook
|
|
2
|
-
import {
|
|
3
|
-
|
|
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?:
|
|
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;
|