xls-codec 1.0.1 → 2.0.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 (124) hide show
  1. package/README.md +128 -23
  2. package/dist/biff/bof-writer.cjs +18 -0
  3. package/dist/biff/bof-writer.d.cts +5 -0
  4. package/dist/biff/bof-writer.d.ts +5 -0
  5. package/dist/biff/bof-writer.js +17 -0
  6. package/dist/biff/builder.cjs +48 -0
  7. package/dist/biff/builder.d.cts +17 -0
  8. package/dist/biff/builder.d.ts +17 -0
  9. package/dist/biff/builder.js +47 -0
  10. package/dist/biff/cursor.cjs +4 -0
  11. package/dist/biff/cursor.d.cts +1 -27
  12. package/dist/biff/cursor.d.ts +1 -27
  13. package/dist/biff/cursor.js +4 -0
  14. package/dist/biff/errors.cjs +7 -0
  15. package/dist/biff/errors.d.cts +3 -1
  16. package/dist/biff/errors.d.ts +3 -1
  17. package/dist/biff/errors.js +7 -1
  18. package/dist/biff/print-setup.cjs +108 -0
  19. package/dist/biff/print-setup.d.cts +2 -0
  20. package/dist/biff/print-setup.d.ts +2 -0
  21. package/dist/biff/print-setup.js +103 -0
  22. package/dist/biff/ptg-functions.cjs +383 -0
  23. package/dist/biff/ptg-functions.d.cts +7 -0
  24. package/dist/biff/ptg-functions.d.ts +7 -0
  25. package/dist/biff/ptg-functions.js +381 -0
  26. package/dist/biff/ptg.cjs +319 -0
  27. package/dist/biff/ptg.d.cts +2 -0
  28. package/dist/biff/ptg.d.ts +2 -0
  29. package/dist/biff/ptg.js +318 -0
  30. package/dist/biff/record-types.cjs +60 -0
  31. package/dist/biff/record-types.d.cts +41 -1
  32. package/dist/biff/record-types.d.ts +41 -1
  33. package/dist/biff/record-types.js +41 -1
  34. package/dist/biff/record-writer.cjs +29 -0
  35. package/dist/biff/record-writer.d.cts +7 -0
  36. package/dist/biff/record-writer.d.ts +7 -0
  37. package/dist/biff/record-writer.js +27 -0
  38. package/dist/biff/string-writer.cjs +58 -0
  39. package/dist/biff/string-writer.d.cts +13 -0
  40. package/dist/biff/string-writer.d.ts +13 -0
  41. package/dist/biff/string-writer.js +55 -0
  42. package/dist/biff/strings.d.cts +1 -1
  43. package/dist/biff/strings.d.ts +1 -1
  44. package/dist/biff/substreams.d.cts +1 -20
  45. package/dist/biff/substreams.d.ts +1 -20
  46. package/dist/biff/write-errors.cjs +10 -0
  47. package/dist/biff/write-errors.d.cts +6 -0
  48. package/dist/biff/write-errors.d.ts +6 -0
  49. package/dist/biff/write-errors.js +9 -0
  50. package/dist/biff/xf-colors.cjs +374 -0
  51. package/dist/biff/xf-colors.d.cts +2 -0
  52. package/dist/biff/xf-colors.d.ts +2 -0
  53. package/dist/biff/xf-colors.js +339 -0
  54. package/dist/biff/xf-writer.cjs +96 -0
  55. package/dist/biff/xf-writer.d.cts +29 -0
  56. package/dist/biff/xf-writer.d.ts +29 -0
  57. package/dist/biff/xf-writer.js +90 -0
  58. package/dist/container.cjs +13 -4
  59. package/dist/container.d.cts +10 -3
  60. package/dist/container.d.ts +10 -3
  61. package/dist/container.js +12 -4
  62. package/dist/content.cjs +123 -18
  63. package/dist/content.js +123 -18
  64. package/dist/cursor-VMtw9uVP.d.cts +30 -0
  65. package/dist/cursor-VMtw9uVP.d.ts +30 -0
  66. package/dist/index.cjs +71 -5
  67. package/dist/index.d.cts +20 -10
  68. package/dist/index.d.ts +20 -10
  69. package/dist/index.js +17 -7
  70. package/dist/metadata.cjs +14 -0
  71. package/dist/metadata.d.cts +6 -0
  72. package/dist/metadata.d.ts +6 -0
  73. package/dist/metadata.js +13 -0
  74. package/dist/print-names-D-njuzVw.d.cts +41 -0
  75. package/dist/print-names-DUlpVE00.d.ts +41 -0
  76. package/dist/print-setup-B_ihDvm5.d.cts +57 -0
  77. package/dist/print-setup-B_ihDvm5.d.ts +57 -0
  78. package/dist/ptg-B2K8t3js.d.cts +21 -0
  79. package/dist/ptg-B2K8t3js.d.ts +21 -0
  80. package/dist/serial.cjs +41 -0
  81. package/dist/serial.d.cts +7 -1
  82. package/dist/serial.d.ts +7 -1
  83. package/dist/serial.js +39 -1
  84. package/dist/substreams-D7dQiJbp.d.ts +21 -0
  85. package/dist/substreams-Ddtvn_Vr.d.cts +21 -0
  86. package/dist/units.cjs +37 -0
  87. package/dist/units.d.cts +15 -1
  88. package/dist/units.d.ts +15 -1
  89. package/dist/units.js +33 -1
  90. package/dist/workbook/globals-writer.cjs +122 -0
  91. package/dist/workbook/globals-writer.d.cts +39 -0
  92. package/dist/workbook/globals-writer.d.ts +39 -0
  93. package/dist/workbook/globals-writer.js +120 -0
  94. package/dist/workbook/globals.cjs +72 -8
  95. package/dist/workbook/globals.d.cts +26 -2
  96. package/dist/workbook/globals.d.ts +26 -2
  97. package/dist/workbook/globals.js +71 -7
  98. package/dist/workbook/print-names.cjs +241 -0
  99. package/dist/workbook/print-names.d.cts +2 -0
  100. package/dist/workbook/print-names.d.ts +2 -0
  101. package/dist/workbook/print-names.js +238 -0
  102. package/dist/workbook/sheet-writer.cjs +277 -0
  103. package/dist/workbook/sheet-writer.d.cts +12 -0
  104. package/dist/workbook/sheet-writer.d.ts +12 -0
  105. package/dist/workbook/sheet-writer.js +276 -0
  106. package/dist/workbook/sheet.cjs +125 -17
  107. package/dist/workbook/sheet.d.cts +38 -4
  108. package/dist/workbook/sheet.d.ts +38 -4
  109. package/dist/workbook/sheet.js +125 -17
  110. package/dist/write.cjs +311 -0
  111. package/dist/write.d.cts +13 -0
  112. package/dist/write.d.ts +13 -0
  113. package/dist/write.js +309 -0
  114. package/dist/written-cells.cjs +26 -0
  115. package/dist/written-cells.d.cts +16 -0
  116. package/dist/written-cells.d.ts +16 -0
  117. package/dist/written-cells.js +24 -0
  118. package/dist/xf-colors-CehHZtBy.d.cts +91 -0
  119. package/dist/xf-colors-CpykR3B9.d.ts +91 -0
  120. package/package.json +4 -3
  121. package/dist/number-format.cjs +0 -298
  122. package/dist/number-format.d.cts +0 -32
  123. package/dist/number-format.d.ts +0 -32
  124. package/dist/number-format.js +0 -296
@@ -0,0 +1,318 @@
1
+ import { BlockCursor } from "./cursor.js";
2
+ import { readShortXLUnicodeString } from "./strings.js";
3
+ import { errorTextOf } from "./errors.js";
4
+ import { FTAB_FIXED_ARITY, FTAB_NAMES } from "./ptg-functions.js";
5
+ import { columnIndexToLetters } from "document-schema.js";
6
+ //#region src/biff/ptg.ts
7
+ const PRECEDENCE_COMPARISON = 1;
8
+ const PRECEDENCE_CONCAT = 2;
9
+ const PRECEDENCE_ADD_SUB = 3;
10
+ const PRECEDENCE_MUL_DIV = 4;
11
+ const PRECEDENCE_POWER = 5;
12
+ const PRECEDENCE_PERCENT = 6;
13
+ const PRECEDENCE_UNARY = 7;
14
+ const PRECEDENCE_ATOMIC = 8;
15
+ function pushAtomic(stack, text) {
16
+ stack.push({
17
+ text,
18
+ precedence: PRECEDENCE_ATOMIC
19
+ });
20
+ }
21
+ function wrapBelow(operand, minimum) {
22
+ return operand.precedence < minimum ? `(${operand.text})` : operand.text;
23
+ }
24
+ function wrapAtOrBelow(operand, minimum) {
25
+ return operand.precedence <= minimum ? `(${operand.text})` : operand.text;
26
+ }
27
+ /** Pops two operands and pushes their combination -- the left wrapped only if its own precedence is strictly lower than this operator's, the right wrapped if its precedence is lower than or equal to it (see the module comment for why the same rule is correct for every operator here). Returns false, changing nothing, when fewer than two operands are on the stack -- a malformed token stream this reader declines to guess at rather than reading past. */
28
+ function applyBinary(stack, symbol, precedence) {
29
+ const right = stack.pop();
30
+ const left = stack.pop();
31
+ if (left === void 0 || right === void 0) return false;
32
+ stack.push({
33
+ text: `${wrapBelow(left, precedence)}${symbol}${wrapAtOrBelow(right, precedence)}`,
34
+ precedence
35
+ });
36
+ return true;
37
+ }
38
+ function applyPrefix(stack, symbol) {
39
+ const operand = stack.pop();
40
+ if (operand === void 0) return false;
41
+ stack.push({
42
+ text: `${symbol}${wrapBelow(operand, PRECEDENCE_UNARY)}`,
43
+ precedence: PRECEDENCE_UNARY
44
+ });
45
+ return true;
46
+ }
47
+ function applyPercent(stack) {
48
+ const operand = stack.pop();
49
+ if (operand === void 0) return false;
50
+ stack.push({
51
+ text: `${wrapBelow(operand, PRECEDENCE_PERCENT)}%`,
52
+ precedence: PRECEDENCE_PERCENT
53
+ });
54
+ return true;
55
+ }
56
+ /** PtgParen ([MS-XLS] 2.5.198.80): a pure display token restating parentheses the formula's own author typed, regardless of whether the grouping they express is otherwise necessary. Wrapped unconditionally rather than through precedence comparison, since the point is to reproduce exactly what was there, not to decide afresh whether it was needed. */
57
+ function applyParen(stack) {
58
+ const operand = stack.pop();
59
+ if (operand === void 0) return false;
60
+ stack.push({
61
+ text: `(${operand.text})`,
62
+ precedence: PRECEDENCE_ATOMIC
63
+ });
64
+ return true;
65
+ }
66
+ /** Pops exactly `arity` operands (in argument order) and pushes `name(arg1,arg2,...)`. A function call's own arguments never need wrapping regardless of what built them -- the parentheses already bound them unambiguously -- so every argument is taken as its bare text. */
67
+ function applyFunctionCall(stack, name, arity) {
68
+ if (stack.length < arity) return false;
69
+ const args = stack.splice(stack.length - arity, arity);
70
+ stack.push({
71
+ text: `${name}(${args.map((operand) => operand.text).join(",")})`,
72
+ precedence: PRECEDENCE_ATOMIC
73
+ });
74
+ return true;
75
+ }
76
+ /** PtgAttrSum ([MS-XLS] 2.5.198.41): the optimisation a real producer emits in place of a PtgFuncVar call to SUM with a single reference-class argument, wrapping whatever is already on top of the stack. */
77
+ function applySum(stack) {
78
+ return applyFunctionCall(stack, "SUM", 1);
79
+ }
80
+ function quoteStringLiteral(value) {
81
+ return `"${value.replaceAll("\"", "\"\"")}"`;
82
+ }
83
+ const COLUMN_INDEX_MASK = 16383;
84
+ const COLUMN_RELATIVE_BIT = 16384;
85
+ const ROW_RELATIVE_BIT = 32768;
86
+ function pointFrom(row, columnField) {
87
+ return {
88
+ row,
89
+ column: columnField & COLUMN_INDEX_MASK,
90
+ columnAbsolute: (columnField & COLUMN_RELATIVE_BIT) === 0,
91
+ rowAbsolute: (columnField & ROW_RELATIVE_BIT) === 0
92
+ };
93
+ }
94
+ function formatPoint(point) {
95
+ return `${`${point.columnAbsolute ? "$" : ""}${columnIndexToLetters(point.column)}`}${`${point.rowAbsolute ? "$" : ""}${point.row + 1}`}`;
96
+ }
97
+ /** RgceLoc ([MS-XLS] 2.5.198.109): a single cell reference, as PtgRef/PtgRef3d carry it -- a plain row then a ColRelU column field. */
98
+ function readLoc(cursor) {
99
+ return pointFrom(cursor.u16(), cursor.u16());
100
+ }
101
+ /** RgceArea ([MS-XLS] 2.5.198.105): a rectangular range, as PtgArea/PtgArea3d carry it -- both row bounds, then both corners' own ColRelU column fields. */
102
+ function readArea(cursor) {
103
+ const rowFirst = cursor.u16();
104
+ const rowLast = cursor.u16();
105
+ const columnFirstField = cursor.u16();
106
+ const columnLastField = cursor.u16();
107
+ return [pointFrom(rowFirst, columnFirstField), pointFrom(rowLast, columnLastField)];
108
+ }
109
+ const SIMPLE_SHEET_NAME_RE = /^[A-Za-z_][A-Za-z0-9_.]*$/;
110
+ function quoteSheetLabel(label) {
111
+ return SIMPLE_SHEET_NAME_RE.test(label) ? label : `'${label.replaceAll("'", "''")}'`;
112
+ }
113
+ /** The `'Sheet'!` or `'First:Last'!` prefix a 3D reference's own ixti resolves to, or undefined when this reader does not resolve it (see WorkbookGlobals.sheetRanges) -- an unresolved ixti aborts the whole formula's parse, the same as any other unsupported token. */
114
+ function resolveSheetLabel(ixti, context) {
115
+ const range = context.sheetRanges[ixti];
116
+ if (range === void 0) return;
117
+ const first = context.sheets[range.firstSheetIndex]?.name;
118
+ const last = context.sheets[range.lastSheetIndex]?.name;
119
+ if (first === void 0 || last === void 0) return;
120
+ return `${quoteSheetLabel(range.firstSheetIndex === range.lastSheetIndex ? first : `${first}:${last}`)}!`;
121
+ }
122
+ const PTG_ADD = 3;
123
+ const PTG_SUB = 4;
124
+ const PTG_MUL = 5;
125
+ const PTG_DIV = 6;
126
+ const PTG_POWER = 7;
127
+ const PTG_CONCAT = 8;
128
+ const PTG_LT = 9;
129
+ const PTG_LE = 10;
130
+ const PTG_EQ = 11;
131
+ const PTG_GE = 12;
132
+ const PTG_GT = 13;
133
+ const PTG_NE = 14;
134
+ const PTG_UPLUS = 18;
135
+ const PTG_UMINUS = 19;
136
+ const PTG_PERCENT = 20;
137
+ const PTG_PAREN = 21;
138
+ const PTG_MISSARG = 22;
139
+ const PTG_STR = 23;
140
+ const PTG_ERR = 28;
141
+ const PTG_BOOL = 29;
142
+ const PTG_INT = 30;
143
+ const PTG_NUM = 31;
144
+ const PTG_FUNC_REF = 33;
145
+ const PTG_FUNC_VALUE = 65;
146
+ const PTG_FUNC_ARRAY = 97;
147
+ const PTG_FUNCVAR_REF = 34;
148
+ const PTG_FUNCVAR_VALUE = 66;
149
+ const PTG_FUNCVAR_ARRAY = 98;
150
+ const PTG_REF_REF = 36;
151
+ const PTG_REF_VALUE = 68;
152
+ const PTG_REF_ARRAY = 100;
153
+ const PTG_AREA_REF = 37;
154
+ const PTG_AREA_VALUE = 69;
155
+ const PTG_AREA_ARRAY = 101;
156
+ const PTG_REF3D_REF = 58;
157
+ const PTG_REF3D_VALUE = 90;
158
+ const PTG_REF3D_ARRAY = 122;
159
+ const PTG_AREA3D_REF = 59;
160
+ const PTG_AREA3D_VALUE = 91;
161
+ const PTG_AREA3D_ARRAY = 123;
162
+ const PTG_ATTR_OPCODE = 25;
163
+ const PTG_ATTR_SEMI = 1;
164
+ const PTG_ATTR_IF = 2;
165
+ const PTG_ATTR_CHOOSE = 4;
166
+ const PTG_ATTR_GOTO = 8;
167
+ const PTG_ATTR_SUM = 16;
168
+ const PTG_ATTR_BAXCEL_A = 32;
169
+ const PTG_ATTR_BAXCEL_B = 33;
170
+ const PTG_ATTR_SPACE = 64;
171
+ const PTG_ATTR_SPACE_SEMI = 65;
172
+ /** The four bytes every PtgAttr subtype but PtgAttrChoose occupies: the shared opcode, the subtype flag byte (already consumed by the caller), and two more this module never inspects. */
173
+ const PTG_ATTR_TRAILING_BYTES = 2;
174
+ /**
175
+ * Parses a Formula record's compiled expression into the text a spreadsheet application would show, or returns undefined for a token this reader does not resolve -- a shared formula's PtgExp, an array constant's PtgArray, a defined name, a natural-language reference, or a 3D reference into a genuinely external workbook (see the module comment for the full list). The caller leaves ContentSheetCell.formula absent in that case, exactly as for any other unsupported construct.
176
+ *
177
+ * `rgce` is the formula's own token bytes, already sliced to their declared length (CellParsedFormula.cce) by the caller -- this function reads exactly that many bytes and nothing past them.
178
+ */
179
+ function parseFormulaText(rgce, context) {
180
+ const cursor = new BlockCursor([rgce]);
181
+ const stack = [];
182
+ while (cursor.remainingInBlock() > 0) switch (cursor.u8()) {
183
+ case PTG_ADD:
184
+ if (!applyBinary(stack, "+", PRECEDENCE_ADD_SUB)) return void 0;
185
+ break;
186
+ case PTG_SUB:
187
+ if (!applyBinary(stack, "-", PRECEDENCE_ADD_SUB)) return void 0;
188
+ break;
189
+ case PTG_MUL:
190
+ if (!applyBinary(stack, "*", PRECEDENCE_MUL_DIV)) return void 0;
191
+ break;
192
+ case PTG_DIV:
193
+ if (!applyBinary(stack, "/", PRECEDENCE_MUL_DIV)) return void 0;
194
+ break;
195
+ case PTG_POWER:
196
+ if (!applyBinary(stack, "^", PRECEDENCE_POWER)) return void 0;
197
+ break;
198
+ case PTG_CONCAT:
199
+ if (!applyBinary(stack, "&", PRECEDENCE_CONCAT)) return void 0;
200
+ break;
201
+ case PTG_LT:
202
+ if (!applyBinary(stack, "<", PRECEDENCE_COMPARISON)) return void 0;
203
+ break;
204
+ case PTG_LE:
205
+ if (!applyBinary(stack, "<=", PRECEDENCE_COMPARISON)) return void 0;
206
+ break;
207
+ case PTG_EQ:
208
+ if (!applyBinary(stack, "=", PRECEDENCE_COMPARISON)) return void 0;
209
+ break;
210
+ case PTG_GE:
211
+ if (!applyBinary(stack, ">=", PRECEDENCE_COMPARISON)) return void 0;
212
+ break;
213
+ case PTG_GT:
214
+ if (!applyBinary(stack, ">", PRECEDENCE_COMPARISON)) return void 0;
215
+ break;
216
+ case PTG_NE:
217
+ if (!applyBinary(stack, "<>", PRECEDENCE_COMPARISON)) return void 0;
218
+ break;
219
+ case PTG_UPLUS:
220
+ if (!applyPrefix(stack, "+")) return void 0;
221
+ break;
222
+ case PTG_UMINUS:
223
+ if (!applyPrefix(stack, "-")) return void 0;
224
+ break;
225
+ case PTG_PERCENT:
226
+ if (!applyPercent(stack)) return void 0;
227
+ break;
228
+ case PTG_PAREN:
229
+ if (!applyParen(stack)) return void 0;
230
+ break;
231
+ case PTG_MISSARG:
232
+ pushAtomic(stack, "");
233
+ break;
234
+ case PTG_STR:
235
+ pushAtomic(stack, quoteStringLiteral(readShortXLUnicodeString(cursor)));
236
+ break;
237
+ case PTG_ERR: {
238
+ const text = errorTextOf(cursor.u8());
239
+ if (text === void 0) return void 0;
240
+ pushAtomic(stack, text);
241
+ break;
242
+ }
243
+ case PTG_BOOL:
244
+ pushAtomic(stack, cursor.u8() !== 0 ? "TRUE" : "FALSE");
245
+ break;
246
+ case PTG_INT:
247
+ pushAtomic(stack, String(cursor.u16()));
248
+ break;
249
+ case PTG_NUM:
250
+ pushAtomic(stack, String(cursor.f64()));
251
+ break;
252
+ case PTG_REF_REF:
253
+ case PTG_REF_VALUE:
254
+ case PTG_REF_ARRAY:
255
+ pushAtomic(stack, formatPoint(readLoc(cursor)));
256
+ break;
257
+ case PTG_AREA_REF:
258
+ case PTG_AREA_VALUE:
259
+ case PTG_AREA_ARRAY: {
260
+ const [start, end] = readArea(cursor);
261
+ pushAtomic(stack, `${formatPoint(start)}:${formatPoint(end)}`);
262
+ break;
263
+ }
264
+ case PTG_REF3D_REF:
265
+ case PTG_REF3D_VALUE:
266
+ case PTG_REF3D_ARRAY: {
267
+ const ixti = cursor.u16();
268
+ const point = readLoc(cursor);
269
+ const label = resolveSheetLabel(ixti, context);
270
+ if (label === void 0) return void 0;
271
+ pushAtomic(stack, `${label}${formatPoint(point)}`);
272
+ break;
273
+ }
274
+ case PTG_AREA3D_REF:
275
+ case PTG_AREA3D_VALUE:
276
+ case PTG_AREA3D_ARRAY: {
277
+ const ixti = cursor.u16();
278
+ const [start, end] = readArea(cursor);
279
+ const label = resolveSheetLabel(ixti, context);
280
+ if (label === void 0) return void 0;
281
+ pushAtomic(stack, `${label}${formatPoint(start)}:${formatPoint(end)}`);
282
+ break;
283
+ }
284
+ case PTG_FUNC_REF:
285
+ case PTG_FUNC_VALUE:
286
+ case PTG_FUNC_ARRAY: {
287
+ const iftab = cursor.u16();
288
+ const name = FTAB_NAMES.get(iftab);
289
+ const arity = FTAB_FIXED_ARITY.get(iftab);
290
+ if (name === void 0 || arity === void 0) return void 0;
291
+ if (!applyFunctionCall(stack, name, arity)) return void 0;
292
+ break;
293
+ }
294
+ case PTG_FUNCVAR_REF:
295
+ case PTG_FUNCVAR_VALUE:
296
+ case PTG_FUNCVAR_ARRAY: {
297
+ const cparams = cursor.u8();
298
+ const iftab = cursor.u16();
299
+ const name = FTAB_NAMES.get(iftab);
300
+ if (name === void 0) return void 0;
301
+ if (!applyFunctionCall(stack, name, cparams)) return void 0;
302
+ break;
303
+ }
304
+ case PTG_ATTR_OPCODE: {
305
+ const subtype = cursor.u8();
306
+ if (subtype === PTG_ATTR_CHOOSE) return;
307
+ cursor.skip(PTG_ATTR_TRAILING_BYTES);
308
+ if (subtype === PTG_ATTR_SUM) {
309
+ if (!applySum(stack)) return void 0;
310
+ } else if (subtype !== PTG_ATTR_SEMI && subtype !== PTG_ATTR_IF && subtype !== PTG_ATTR_GOTO && subtype !== PTG_ATTR_BAXCEL_A && subtype !== PTG_ATTR_BAXCEL_B && subtype !== PTG_ATTR_SPACE && subtype !== PTG_ATTR_SPACE_SEMI) return;
311
+ break;
312
+ }
313
+ default: return;
314
+ }
315
+ return stack.length === 1 ? stack[0]?.text : void 0;
316
+ }
317
+ //#endregion
318
+ export { parseFormulaText };
@@ -18,8 +18,18 @@ const RECORD_XF = 224;
18
18
  const RECORD_FONT = 49;
19
19
  /** Which of the two date epochs this workbook's serials count from ([MS-XLS] 2.4.77). */
20
20
  const RECORD_DATE1904 = 34;
21
+ /** Names one of the fifteen built-in cell-style XF records the writer emits before any cell XF ([MS-XLS] 2.4.269). Not read: this reader's XF table is flat and does not distinguish a cell style from a cell format. */
22
+ const RECORD_STYLE = 659;
21
23
  /** Present only in an encrypted workbook, where every record after it is ciphertext ([MS-XLS] 2.4.117). */
22
24
  const RECORD_FILEPASS = 47;
25
+ /** A collection of XTI structures resolving a formula's ixti to a sheet range, for a 3D reference ([MS-XLS] 2.4.106). */
26
+ const RECORD_EXTERNSHEET = 23;
27
+ /** The beginning of a supporting-link's own record collection: another workbook, a DDE/OLE data source, an add-in, or -- the one case this reader resolves -- this same workbook, self-referencing ([MS-XLS] 2.4.271). */
28
+ const RECORD_SUPBOOK = 430;
29
+ /** The workbook's custom colour table ([MS-XLS] 2.4.188): a fixed 56-entry override of the default palette every icv 8-63 an XF's fill/border colour fields name resolves through when this record is absent. */
30
+ const RECORD_PALETTE = 146;
31
+ /** A defined name ([MS-XLS] 2.4.150). Read and written only for the two BUILT-IN names a sheet's print settings live in -- Print_Area and Print_Titles; see workbook/print-names.ts. */
32
+ const RECORD_LBL = 24;
23
33
  /** The sheet's used range ([MS-XLS] 2.4.90). */
24
34
  const RECORD_DIMENSIONS = 512;
25
35
  /** A single row's height, hidden state, and formatting ([MS-XLS] 2.4.221). */
@@ -32,6 +42,36 @@ const RECORD_DEFCOLWIDTH = 85;
32
42
  const RECORD_DEFAULTROWHEIGHT = 549;
33
43
  /** Merged cell ranges ([MS-XLS] 2.4.168). */
34
44
  const RECORD_MERGECELLS = 229;
45
+ /** Whether the row and column headers are printed ([MS-XLS] 2.4.203). */
46
+ const RECORD_PRINTROWCOL = 42;
47
+ /** Whether the gridlines are printed ([MS-XLS] 2.4.202). */
48
+ const RECORD_PRINTGRID = 43;
49
+ /** Sheet-level flags, of which only fFitToPage -- whether the sheet prints scaled to a page count rather than to a percentage -- is read or written ([MS-XLS] 2.4.351). */
50
+ const RECORD_WSBOOL = 129;
51
+ /** Explicit row page breaks ([MS-XLS] 2.4.142). */
52
+ const RECORD_HORIZONTALPAGEBREAKS = 27;
53
+ /** Explicit column page breaks ([MS-XLS] 2.4.343). */
54
+ const RECORD_VERTICALPAGEBREAKS = 26;
55
+ /** The left page margin, an Xnum of inches ([MS-XLS] 2.4.151). */
56
+ const RECORD_LEFTMARGIN = 38;
57
+ /** The right page margin ([MS-XLS] 2.4.219). */
58
+ const RECORD_RIGHTMARGIN = 39;
59
+ /** The top page margin ([MS-XLS] 2.4.328). */
60
+ const RECORD_TOPMARGIN = 40;
61
+ /** The bottom page margin ([MS-XLS] 2.4.27). */
62
+ const RECORD_BOTTOMMARGIN = 41;
63
+ /** Paper size, print scale, fit-to-page counts, page order, and orientation ([MS-XLS] 2.4.257). */
64
+ const RECORD_SETUP = 161;
65
+ /** The iteration count for iterative calculation ([MS-XLS] 2.4.31). */
66
+ const RECORD_CALCCOUNT = 12;
67
+ /** The reference style, A1 or R1C1 ([MS-XLS] 2.4.36). */
68
+ const RECORD_CALCREFMODE = 15;
69
+ /** Whether iterative calculation is enabled ([MS-XLS] 2.4.33). */
70
+ const RECORD_CALCITER = 17;
71
+ /** The minimum value change iterative calculation continues for ([MS-XLS] 2.4.32). */
72
+ const RECORD_CALCDELTA = 16;
73
+ /** Whether the workbook is recalculated before saving in manual calculation mode ([MS-XLS] 2.4.37). */
74
+ const RECORD_CALCSAVERECALC = 95;
35
75
  /** An empty cell carrying only formatting ([MS-XLS] 2.4.20). */
36
76
  const RECORD_BLANK = 513;
37
77
  /** A run of empty cells in one row ([MS-XLS] 2.4.174). */
@@ -81,7 +121,13 @@ exports.RECORD_ARRAY = RECORD_ARRAY;
81
121
  exports.RECORD_BLANK = RECORD_BLANK;
82
122
  exports.RECORD_BOF = RECORD_BOF;
83
123
  exports.RECORD_BOOLERR = RECORD_BOOLERR;
124
+ exports.RECORD_BOTTOMMARGIN = RECORD_BOTTOMMARGIN;
84
125
  exports.RECORD_BOUNDSHEET8 = RECORD_BOUNDSHEET8;
126
+ exports.RECORD_CALCCOUNT = RECORD_CALCCOUNT;
127
+ exports.RECORD_CALCDELTA = RECORD_CALCDELTA;
128
+ exports.RECORD_CALCITER = RECORD_CALCITER;
129
+ exports.RECORD_CALCREFMODE = RECORD_CALCREFMODE;
130
+ exports.RECORD_CALCSAVERECALC = RECORD_CALCSAVERECALC;
85
131
  exports.RECORD_COLINFO = RECORD_COLINFO;
86
132
  exports.RECORD_CONTINUE = RECORD_CONTINUE;
87
133
  exports.RECORD_DATE1904 = RECORD_DATE1904;
@@ -89,20 +135,34 @@ exports.RECORD_DEFAULTROWHEIGHT = RECORD_DEFAULTROWHEIGHT;
89
135
  exports.RECORD_DEFCOLWIDTH = RECORD_DEFCOLWIDTH;
90
136
  exports.RECORD_DIMENSIONS = RECORD_DIMENSIONS;
91
137
  exports.RECORD_EOF = RECORD_EOF;
138
+ exports.RECORD_EXTERNSHEET = RECORD_EXTERNSHEET;
92
139
  exports.RECORD_FILEPASS = RECORD_FILEPASS;
93
140
  exports.RECORD_FONT = RECORD_FONT;
94
141
  exports.RECORD_FORMAT = RECORD_FORMAT;
95
142
  exports.RECORD_FORMULA = RECORD_FORMULA;
143
+ exports.RECORD_HORIZONTALPAGEBREAKS = RECORD_HORIZONTALPAGEBREAKS;
96
144
  exports.RECORD_LABEL = RECORD_LABEL;
97
145
  exports.RECORD_LABELSST = RECORD_LABELSST;
146
+ exports.RECORD_LBL = RECORD_LBL;
147
+ exports.RECORD_LEFTMARGIN = RECORD_LEFTMARGIN;
98
148
  exports.RECORD_MERGECELLS = RECORD_MERGECELLS;
99
149
  exports.RECORD_MULBLANK = RECORD_MULBLANK;
100
150
  exports.RECORD_MULRK = RECORD_MULRK;
101
151
  exports.RECORD_NUMBER = RECORD_NUMBER;
152
+ exports.RECORD_PALETTE = RECORD_PALETTE;
153
+ exports.RECORD_PRINTGRID = RECORD_PRINTGRID;
154
+ exports.RECORD_PRINTROWCOL = RECORD_PRINTROWCOL;
155
+ exports.RECORD_RIGHTMARGIN = RECORD_RIGHTMARGIN;
102
156
  exports.RECORD_RK = RECORD_RK;
103
157
  exports.RECORD_ROW = RECORD_ROW;
158
+ exports.RECORD_SETUP = RECORD_SETUP;
104
159
  exports.RECORD_SHRFMLA = RECORD_SHRFMLA;
105
160
  exports.RECORD_SST = RECORD_SST;
106
161
  exports.RECORD_STRING = RECORD_STRING;
162
+ exports.RECORD_STYLE = RECORD_STYLE;
163
+ exports.RECORD_SUPBOOK = RECORD_SUPBOOK;
107
164
  exports.RECORD_TABLE = RECORD_TABLE;
165
+ exports.RECORD_TOPMARGIN = RECORD_TOPMARGIN;
166
+ exports.RECORD_VERTICALPAGEBREAKS = RECORD_VERTICALPAGEBREAKS;
167
+ exports.RECORD_WSBOOL = RECORD_WSBOOL;
108
168
  exports.RECORD_XF = RECORD_XF;
@@ -17,8 +17,18 @@ declare const RECORD_XF = 224;
17
17
  declare const RECORD_FONT = 49;
18
18
  /** Which of the two date epochs this workbook's serials count from ([MS-XLS] 2.4.77). */
19
19
  declare const RECORD_DATE1904 = 34;
20
+ /** Names one of the fifteen built-in cell-style XF records the writer emits before any cell XF ([MS-XLS] 2.4.269). Not read: this reader's XF table is flat and does not distinguish a cell style from a cell format. */
21
+ declare const RECORD_STYLE = 659;
20
22
  /** Present only in an encrypted workbook, where every record after it is ciphertext ([MS-XLS] 2.4.117). */
21
23
  declare const RECORD_FILEPASS = 47;
24
+ /** A collection of XTI structures resolving a formula's ixti to a sheet range, for a 3D reference ([MS-XLS] 2.4.106). */
25
+ declare const RECORD_EXTERNSHEET = 23;
26
+ /** The beginning of a supporting-link's own record collection: another workbook, a DDE/OLE data source, an add-in, or -- the one case this reader resolves -- this same workbook, self-referencing ([MS-XLS] 2.4.271). */
27
+ declare const RECORD_SUPBOOK = 430;
28
+ /** The workbook's custom colour table ([MS-XLS] 2.4.188): a fixed 56-entry override of the default palette every icv 8-63 an XF's fill/border colour fields name resolves through when this record is absent. */
29
+ declare const RECORD_PALETTE = 146;
30
+ /** A defined name ([MS-XLS] 2.4.150). Read and written only for the two BUILT-IN names a sheet's print settings live in -- Print_Area and Print_Titles; see workbook/print-names.ts. */
31
+ declare const RECORD_LBL = 24;
22
32
  /** The sheet's used range ([MS-XLS] 2.4.90). */
23
33
  declare const RECORD_DIMENSIONS = 512;
24
34
  /** A single row's height, hidden state, and formatting ([MS-XLS] 2.4.221). */
@@ -31,6 +41,36 @@ declare const RECORD_DEFCOLWIDTH = 85;
31
41
  declare const RECORD_DEFAULTROWHEIGHT = 549;
32
42
  /** Merged cell ranges ([MS-XLS] 2.4.168). */
33
43
  declare const RECORD_MERGECELLS = 229;
44
+ /** Whether the row and column headers are printed ([MS-XLS] 2.4.203). */
45
+ declare const RECORD_PRINTROWCOL = 42;
46
+ /** Whether the gridlines are printed ([MS-XLS] 2.4.202). */
47
+ declare const RECORD_PRINTGRID = 43;
48
+ /** Sheet-level flags, of which only fFitToPage -- whether the sheet prints scaled to a page count rather than to a percentage -- is read or written ([MS-XLS] 2.4.351). */
49
+ declare const RECORD_WSBOOL = 129;
50
+ /** Explicit row page breaks ([MS-XLS] 2.4.142). */
51
+ declare const RECORD_HORIZONTALPAGEBREAKS = 27;
52
+ /** Explicit column page breaks ([MS-XLS] 2.4.343). */
53
+ declare const RECORD_VERTICALPAGEBREAKS = 26;
54
+ /** The left page margin, an Xnum of inches ([MS-XLS] 2.4.151). */
55
+ declare const RECORD_LEFTMARGIN = 38;
56
+ /** The right page margin ([MS-XLS] 2.4.219). */
57
+ declare const RECORD_RIGHTMARGIN = 39;
58
+ /** The top page margin ([MS-XLS] 2.4.328). */
59
+ declare const RECORD_TOPMARGIN = 40;
60
+ /** The bottom page margin ([MS-XLS] 2.4.27). */
61
+ declare const RECORD_BOTTOMMARGIN = 41;
62
+ /** Paper size, print scale, fit-to-page counts, page order, and orientation ([MS-XLS] 2.4.257). */
63
+ declare const RECORD_SETUP = 161;
64
+ /** The iteration count for iterative calculation ([MS-XLS] 2.4.31). */
65
+ declare const RECORD_CALCCOUNT = 12;
66
+ /** The reference style, A1 or R1C1 ([MS-XLS] 2.4.36). */
67
+ declare const RECORD_CALCREFMODE = 15;
68
+ /** Whether iterative calculation is enabled ([MS-XLS] 2.4.33). */
69
+ declare const RECORD_CALCITER = 17;
70
+ /** The minimum value change iterative calculation continues for ([MS-XLS] 2.4.32). */
71
+ declare const RECORD_CALCDELTA = 16;
72
+ /** Whether the workbook is recalculated before saving in manual calculation mode ([MS-XLS] 2.4.37). */
73
+ declare const RECORD_CALCSAVERECALC = 95;
34
74
  /** An empty cell carrying only formatting ([MS-XLS] 2.4.20). */
35
75
  declare const RECORD_BLANK = 513;
36
76
  /** A run of empty cells in one row ([MS-XLS] 2.4.174). */
@@ -70,4 +110,4 @@ declare const BIFF8_VERSION = 1536;
70
110
  /** [MS-XLS] 2.1.4: "The record size ... MUST be less than or equal to 8224." The ceiling a writer splits a record at, and the bound a reader can sanity-check a declared size against. */
71
111
  declare const MAX_RECORD_DATA_SIZE = 8224;
72
112
  //#endregion
73
- export { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, MAX_RECORD_DATA_SIZE, RECORD_ARRAY, RECORD_BLANK, RECORD_BOF, RECORD_BOOLERR, RECORD_BOUNDSHEET8, RECORD_COLINFO, RECORD_CONTINUE, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_EOF, RECORD_FILEPASS, RECORD_FONT, RECORD_FORMAT, RECORD_FORMULA, RECORD_LABEL, RECORD_LABELSST, RECORD_MERGECELLS, RECORD_MULBLANK, RECORD_MULRK, RECORD_NUMBER, RECORD_RK, RECORD_ROW, RECORD_SHRFMLA, RECORD_SST, RECORD_STRING, RECORD_TABLE, RECORD_XF };
113
+ export { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, MAX_RECORD_DATA_SIZE, RECORD_ARRAY, RECORD_BLANK, RECORD_BOF, RECORD_BOOLERR, RECORD_BOTTOMMARGIN, RECORD_BOUNDSHEET8, RECORD_CALCCOUNT, RECORD_CALCDELTA, RECORD_CALCITER, RECORD_CALCREFMODE, RECORD_CALCSAVERECALC, RECORD_COLINFO, RECORD_CONTINUE, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_EOF, RECORD_EXTERNSHEET, RECORD_FILEPASS, RECORD_FONT, RECORD_FORMAT, RECORD_FORMULA, RECORD_HORIZONTALPAGEBREAKS, RECORD_LABEL, RECORD_LABELSST, RECORD_LBL, RECORD_LEFTMARGIN, RECORD_MERGECELLS, RECORD_MULBLANK, RECORD_MULRK, RECORD_NUMBER, RECORD_PALETTE, RECORD_PRINTGRID, RECORD_PRINTROWCOL, RECORD_RIGHTMARGIN, RECORD_RK, RECORD_ROW, RECORD_SETUP, RECORD_SHRFMLA, RECORD_SST, RECORD_STRING, RECORD_STYLE, RECORD_SUPBOOK, RECORD_TABLE, RECORD_TOPMARGIN, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF };
@@ -17,8 +17,18 @@ declare const RECORD_XF = 224;
17
17
  declare const RECORD_FONT = 49;
18
18
  /** Which of the two date epochs this workbook's serials count from ([MS-XLS] 2.4.77). */
19
19
  declare const RECORD_DATE1904 = 34;
20
+ /** Names one of the fifteen built-in cell-style XF records the writer emits before any cell XF ([MS-XLS] 2.4.269). Not read: this reader's XF table is flat and does not distinguish a cell style from a cell format. */
21
+ declare const RECORD_STYLE = 659;
20
22
  /** Present only in an encrypted workbook, where every record after it is ciphertext ([MS-XLS] 2.4.117). */
21
23
  declare const RECORD_FILEPASS = 47;
24
+ /** A collection of XTI structures resolving a formula's ixti to a sheet range, for a 3D reference ([MS-XLS] 2.4.106). */
25
+ declare const RECORD_EXTERNSHEET = 23;
26
+ /** The beginning of a supporting-link's own record collection: another workbook, a DDE/OLE data source, an add-in, or -- the one case this reader resolves -- this same workbook, self-referencing ([MS-XLS] 2.4.271). */
27
+ declare const RECORD_SUPBOOK = 430;
28
+ /** The workbook's custom colour table ([MS-XLS] 2.4.188): a fixed 56-entry override of the default palette every icv 8-63 an XF's fill/border colour fields name resolves through when this record is absent. */
29
+ declare const RECORD_PALETTE = 146;
30
+ /** A defined name ([MS-XLS] 2.4.150). Read and written only for the two BUILT-IN names a sheet's print settings live in -- Print_Area and Print_Titles; see workbook/print-names.ts. */
31
+ declare const RECORD_LBL = 24;
22
32
  /** The sheet's used range ([MS-XLS] 2.4.90). */
23
33
  declare const RECORD_DIMENSIONS = 512;
24
34
  /** A single row's height, hidden state, and formatting ([MS-XLS] 2.4.221). */
@@ -31,6 +41,36 @@ declare const RECORD_DEFCOLWIDTH = 85;
31
41
  declare const RECORD_DEFAULTROWHEIGHT = 549;
32
42
  /** Merged cell ranges ([MS-XLS] 2.4.168). */
33
43
  declare const RECORD_MERGECELLS = 229;
44
+ /** Whether the row and column headers are printed ([MS-XLS] 2.4.203). */
45
+ declare const RECORD_PRINTROWCOL = 42;
46
+ /** Whether the gridlines are printed ([MS-XLS] 2.4.202). */
47
+ declare const RECORD_PRINTGRID = 43;
48
+ /** Sheet-level flags, of which only fFitToPage -- whether the sheet prints scaled to a page count rather than to a percentage -- is read or written ([MS-XLS] 2.4.351). */
49
+ declare const RECORD_WSBOOL = 129;
50
+ /** Explicit row page breaks ([MS-XLS] 2.4.142). */
51
+ declare const RECORD_HORIZONTALPAGEBREAKS = 27;
52
+ /** Explicit column page breaks ([MS-XLS] 2.4.343). */
53
+ declare const RECORD_VERTICALPAGEBREAKS = 26;
54
+ /** The left page margin, an Xnum of inches ([MS-XLS] 2.4.151). */
55
+ declare const RECORD_LEFTMARGIN = 38;
56
+ /** The right page margin ([MS-XLS] 2.4.219). */
57
+ declare const RECORD_RIGHTMARGIN = 39;
58
+ /** The top page margin ([MS-XLS] 2.4.328). */
59
+ declare const RECORD_TOPMARGIN = 40;
60
+ /** The bottom page margin ([MS-XLS] 2.4.27). */
61
+ declare const RECORD_BOTTOMMARGIN = 41;
62
+ /** Paper size, print scale, fit-to-page counts, page order, and orientation ([MS-XLS] 2.4.257). */
63
+ declare const RECORD_SETUP = 161;
64
+ /** The iteration count for iterative calculation ([MS-XLS] 2.4.31). */
65
+ declare const RECORD_CALCCOUNT = 12;
66
+ /** The reference style, A1 or R1C1 ([MS-XLS] 2.4.36). */
67
+ declare const RECORD_CALCREFMODE = 15;
68
+ /** Whether iterative calculation is enabled ([MS-XLS] 2.4.33). */
69
+ declare const RECORD_CALCITER = 17;
70
+ /** The minimum value change iterative calculation continues for ([MS-XLS] 2.4.32). */
71
+ declare const RECORD_CALCDELTA = 16;
72
+ /** Whether the workbook is recalculated before saving in manual calculation mode ([MS-XLS] 2.4.37). */
73
+ declare const RECORD_CALCSAVERECALC = 95;
34
74
  /** An empty cell carrying only formatting ([MS-XLS] 2.4.20). */
35
75
  declare const RECORD_BLANK = 513;
36
76
  /** A run of empty cells in one row ([MS-XLS] 2.4.174). */
@@ -70,4 +110,4 @@ declare const BIFF8_VERSION = 1536;
70
110
  /** [MS-XLS] 2.1.4: "The record size ... MUST be less than or equal to 8224." The ceiling a writer splits a record at, and the bound a reader can sanity-check a declared size against. */
71
111
  declare const MAX_RECORD_DATA_SIZE = 8224;
72
112
  //#endregion
73
- export { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, MAX_RECORD_DATA_SIZE, RECORD_ARRAY, RECORD_BLANK, RECORD_BOF, RECORD_BOOLERR, RECORD_BOUNDSHEET8, RECORD_COLINFO, RECORD_CONTINUE, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_EOF, RECORD_FILEPASS, RECORD_FONT, RECORD_FORMAT, RECORD_FORMULA, RECORD_LABEL, RECORD_LABELSST, RECORD_MERGECELLS, RECORD_MULBLANK, RECORD_MULRK, RECORD_NUMBER, RECORD_RK, RECORD_ROW, RECORD_SHRFMLA, RECORD_SST, RECORD_STRING, RECORD_TABLE, RECORD_XF };
113
+ export { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, MAX_RECORD_DATA_SIZE, RECORD_ARRAY, RECORD_BLANK, RECORD_BOF, RECORD_BOOLERR, RECORD_BOTTOMMARGIN, RECORD_BOUNDSHEET8, RECORD_CALCCOUNT, RECORD_CALCDELTA, RECORD_CALCITER, RECORD_CALCREFMODE, RECORD_CALCSAVERECALC, RECORD_COLINFO, RECORD_CONTINUE, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_EOF, RECORD_EXTERNSHEET, RECORD_FILEPASS, RECORD_FONT, RECORD_FORMAT, RECORD_FORMULA, RECORD_HORIZONTALPAGEBREAKS, RECORD_LABEL, RECORD_LABELSST, RECORD_LBL, RECORD_LEFTMARGIN, RECORD_MERGECELLS, RECORD_MULBLANK, RECORD_MULRK, RECORD_NUMBER, RECORD_PALETTE, RECORD_PRINTGRID, RECORD_PRINTROWCOL, RECORD_RIGHTMARGIN, RECORD_RK, RECORD_ROW, RECORD_SETUP, RECORD_SHRFMLA, RECORD_SST, RECORD_STRING, RECORD_STYLE, RECORD_SUPBOOK, RECORD_TABLE, RECORD_TOPMARGIN, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF };
@@ -17,8 +17,18 @@ const RECORD_XF = 224;
17
17
  const RECORD_FONT = 49;
18
18
  /** Which of the two date epochs this workbook's serials count from ([MS-XLS] 2.4.77). */
19
19
  const RECORD_DATE1904 = 34;
20
+ /** Names one of the fifteen built-in cell-style XF records the writer emits before any cell XF ([MS-XLS] 2.4.269). Not read: this reader's XF table is flat and does not distinguish a cell style from a cell format. */
21
+ const RECORD_STYLE = 659;
20
22
  /** Present only in an encrypted workbook, where every record after it is ciphertext ([MS-XLS] 2.4.117). */
21
23
  const RECORD_FILEPASS = 47;
24
+ /** A collection of XTI structures resolving a formula's ixti to a sheet range, for a 3D reference ([MS-XLS] 2.4.106). */
25
+ const RECORD_EXTERNSHEET = 23;
26
+ /** The beginning of a supporting-link's own record collection: another workbook, a DDE/OLE data source, an add-in, or -- the one case this reader resolves -- this same workbook, self-referencing ([MS-XLS] 2.4.271). */
27
+ const RECORD_SUPBOOK = 430;
28
+ /** The workbook's custom colour table ([MS-XLS] 2.4.188): a fixed 56-entry override of the default palette every icv 8-63 an XF's fill/border colour fields name resolves through when this record is absent. */
29
+ const RECORD_PALETTE = 146;
30
+ /** A defined name ([MS-XLS] 2.4.150). Read and written only for the two BUILT-IN names a sheet's print settings live in -- Print_Area and Print_Titles; see workbook/print-names.ts. */
31
+ const RECORD_LBL = 24;
22
32
  /** The sheet's used range ([MS-XLS] 2.4.90). */
23
33
  const RECORD_DIMENSIONS = 512;
24
34
  /** A single row's height, hidden state, and formatting ([MS-XLS] 2.4.221). */
@@ -31,6 +41,36 @@ const RECORD_DEFCOLWIDTH = 85;
31
41
  const RECORD_DEFAULTROWHEIGHT = 549;
32
42
  /** Merged cell ranges ([MS-XLS] 2.4.168). */
33
43
  const RECORD_MERGECELLS = 229;
44
+ /** Whether the row and column headers are printed ([MS-XLS] 2.4.203). */
45
+ const RECORD_PRINTROWCOL = 42;
46
+ /** Whether the gridlines are printed ([MS-XLS] 2.4.202). */
47
+ const RECORD_PRINTGRID = 43;
48
+ /** Sheet-level flags, of which only fFitToPage -- whether the sheet prints scaled to a page count rather than to a percentage -- is read or written ([MS-XLS] 2.4.351). */
49
+ const RECORD_WSBOOL = 129;
50
+ /** Explicit row page breaks ([MS-XLS] 2.4.142). */
51
+ const RECORD_HORIZONTALPAGEBREAKS = 27;
52
+ /** Explicit column page breaks ([MS-XLS] 2.4.343). */
53
+ const RECORD_VERTICALPAGEBREAKS = 26;
54
+ /** The left page margin, an Xnum of inches ([MS-XLS] 2.4.151). */
55
+ const RECORD_LEFTMARGIN = 38;
56
+ /** The right page margin ([MS-XLS] 2.4.219). */
57
+ const RECORD_RIGHTMARGIN = 39;
58
+ /** The top page margin ([MS-XLS] 2.4.328). */
59
+ const RECORD_TOPMARGIN = 40;
60
+ /** The bottom page margin ([MS-XLS] 2.4.27). */
61
+ const RECORD_BOTTOMMARGIN = 41;
62
+ /** Paper size, print scale, fit-to-page counts, page order, and orientation ([MS-XLS] 2.4.257). */
63
+ const RECORD_SETUP = 161;
64
+ /** The iteration count for iterative calculation ([MS-XLS] 2.4.31). */
65
+ const RECORD_CALCCOUNT = 12;
66
+ /** The reference style, A1 or R1C1 ([MS-XLS] 2.4.36). */
67
+ const RECORD_CALCREFMODE = 15;
68
+ /** Whether iterative calculation is enabled ([MS-XLS] 2.4.33). */
69
+ const RECORD_CALCITER = 17;
70
+ /** The minimum value change iterative calculation continues for ([MS-XLS] 2.4.32). */
71
+ const RECORD_CALCDELTA = 16;
72
+ /** Whether the workbook is recalculated before saving in manual calculation mode ([MS-XLS] 2.4.37). */
73
+ const RECORD_CALCSAVERECALC = 95;
34
74
  /** An empty cell carrying only formatting ([MS-XLS] 2.4.20). */
35
75
  const RECORD_BLANK = 513;
36
76
  /** A run of empty cells in one row ([MS-XLS] 2.4.174). */
@@ -70,4 +110,4 @@ const BIFF8_VERSION = 1536;
70
110
  /** [MS-XLS] 2.1.4: "The record size ... MUST be less than or equal to 8224." The ceiling a writer splits a record at, and the bound a reader can sanity-check a declared size against. */
71
111
  const MAX_RECORD_DATA_SIZE = 8224;
72
112
  //#endregion
73
- export { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, MAX_RECORD_DATA_SIZE, RECORD_ARRAY, RECORD_BLANK, RECORD_BOF, RECORD_BOOLERR, RECORD_BOUNDSHEET8, RECORD_COLINFO, RECORD_CONTINUE, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_EOF, RECORD_FILEPASS, RECORD_FONT, RECORD_FORMAT, RECORD_FORMULA, RECORD_LABEL, RECORD_LABELSST, RECORD_MERGECELLS, RECORD_MULBLANK, RECORD_MULRK, RECORD_NUMBER, RECORD_RK, RECORD_ROW, RECORD_SHRFMLA, RECORD_SST, RECORD_STRING, RECORD_TABLE, RECORD_XF };
113
+ export { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, MAX_RECORD_DATA_SIZE, RECORD_ARRAY, RECORD_BLANK, RECORD_BOF, RECORD_BOOLERR, RECORD_BOTTOMMARGIN, RECORD_BOUNDSHEET8, RECORD_CALCCOUNT, RECORD_CALCDELTA, RECORD_CALCITER, RECORD_CALCREFMODE, RECORD_CALCSAVERECALC, RECORD_COLINFO, RECORD_CONTINUE, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_EOF, RECORD_EXTERNSHEET, RECORD_FILEPASS, RECORD_FONT, RECORD_FORMAT, RECORD_FORMULA, RECORD_HORIZONTALPAGEBREAKS, RECORD_LABEL, RECORD_LABELSST, RECORD_LBL, RECORD_LEFTMARGIN, RECORD_MERGECELLS, RECORD_MULBLANK, RECORD_MULRK, RECORD_NUMBER, RECORD_PALETTE, RECORD_PRINTGRID, RECORD_PRINTROWCOL, RECORD_RIGHTMARGIN, RECORD_RK, RECORD_ROW, RECORD_SETUP, RECORD_SHRFMLA, RECORD_SST, RECORD_STRING, RECORD_STYLE, RECORD_SUPBOOK, RECORD_TABLE, RECORD_TOPMARGIN, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF };
@@ -0,0 +1,29 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_biff_record_types = require("./record-types.cjs");
3
+ const require_biff_write_errors = require("./write-errors.cjs");
4
+ //#region src/biff/record-writer.ts
5
+ const HEADER_SIZE = 4;
6
+ /** Wraps one record's data in its type/size header. Throws BiffWriteError if the data exceeds the single-record maximum, rather than splitting it across Continue records. */
7
+ function writeRecord(type, data) {
8
+ if (data.length > 8224) throw new require_biff_write_errors.BiffWriteError(`record 0x${type.toString(16)} would carry ${data.length} bytes of data, above the ${require_biff_record_types.MAX_RECORD_DATA_SIZE}-byte maximum a single record can hold ([MS-XLS] 2.1.4); this writer does not split oversized records into Continue chains`);
9
+ const out = new Uint8Array(HEADER_SIZE + data.length);
10
+ const view = new DataView(out.buffer);
11
+ view.setUint16(0, type, true);
12
+ view.setUint16(2, data.length, true);
13
+ out.set(data, HEADER_SIZE);
14
+ return out;
15
+ }
16
+ /** Concatenates already-framed records (or any byte sequences) into one stream, in the order given. */
17
+ function concatRecords(...parts) {
18
+ const total = parts.reduce((sum, part) => sum + part.length, 0);
19
+ const out = new Uint8Array(total);
20
+ let offset = 0;
21
+ for (const part of parts) {
22
+ out.set(part, offset);
23
+ offset += part.length;
24
+ }
25
+ return out;
26
+ }
27
+ //#endregion
28
+ exports.concatRecords = concatRecords;
29
+ exports.writeRecord = writeRecord;
@@ -0,0 +1,7 @@
1
+ //#region src/biff/record-writer.d.ts
2
+ /** Wraps one record's data in its type/size header. Throws BiffWriteError if the data exceeds the single-record maximum, rather than splitting it across Continue records. */
3
+ declare function writeRecord(type: number, data: Uint8Array<ArrayBuffer>): Uint8Array<ArrayBuffer>;
4
+ /** Concatenates already-framed records (or any byte sequences) into one stream, in the order given. */
5
+ declare function concatRecords(...parts: readonly Uint8Array<ArrayBuffer>[]): Uint8Array<ArrayBuffer>;
6
+ //#endregion
7
+ export { concatRecords, writeRecord };
@@ -0,0 +1,7 @@
1
+ //#region src/biff/record-writer.d.ts
2
+ /** Wraps one record's data in its type/size header. Throws BiffWriteError if the data exceeds the single-record maximum, rather than splitting it across Continue records. */
3
+ declare function writeRecord(type: number, data: Uint8Array<ArrayBuffer>): Uint8Array<ArrayBuffer>;
4
+ /** Concatenates already-framed records (or any byte sequences) into one stream, in the order given. */
5
+ declare function concatRecords(...parts: readonly Uint8Array<ArrayBuffer>[]): Uint8Array<ArrayBuffer>;
6
+ //#endregion
7
+ export { concatRecords, writeRecord };