xls-codec 1.0.2 → 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.
- package/README.md +128 -23
- package/dist/biff/bof-writer.cjs +18 -0
- package/dist/biff/bof-writer.d.cts +5 -0
- package/dist/biff/bof-writer.d.ts +5 -0
- package/dist/biff/bof-writer.js +17 -0
- package/dist/biff/builder.cjs +48 -0
- package/dist/biff/builder.d.cts +17 -0
- package/dist/biff/builder.d.ts +17 -0
- package/dist/biff/builder.js +47 -0
- package/dist/biff/cursor.cjs +4 -0
- package/dist/biff/cursor.d.cts +1 -27
- package/dist/biff/cursor.d.ts +1 -27
- package/dist/biff/cursor.js +4 -0
- package/dist/biff/errors.cjs +7 -0
- package/dist/biff/errors.d.cts +3 -1
- package/dist/biff/errors.d.ts +3 -1
- package/dist/biff/errors.js +7 -1
- package/dist/biff/print-setup.cjs +108 -0
- package/dist/biff/print-setup.d.cts +2 -0
- package/dist/biff/print-setup.d.ts +2 -0
- package/dist/biff/print-setup.js +103 -0
- package/dist/biff/ptg-functions.cjs +383 -0
- package/dist/biff/ptg-functions.d.cts +7 -0
- package/dist/biff/ptg-functions.d.ts +7 -0
- package/dist/biff/ptg-functions.js +381 -0
- package/dist/biff/ptg.cjs +319 -0
- package/dist/biff/ptg.d.cts +2 -0
- package/dist/biff/ptg.d.ts +2 -0
- package/dist/biff/ptg.js +318 -0
- package/dist/biff/record-types.cjs +60 -0
- package/dist/biff/record-types.d.cts +41 -1
- package/dist/biff/record-types.d.ts +41 -1
- package/dist/biff/record-types.js +41 -1
- package/dist/biff/record-writer.cjs +29 -0
- package/dist/biff/record-writer.d.cts +7 -0
- package/dist/biff/record-writer.d.ts +7 -0
- package/dist/biff/record-writer.js +27 -0
- package/dist/biff/string-writer.cjs +58 -0
- package/dist/biff/string-writer.d.cts +13 -0
- package/dist/biff/string-writer.d.ts +13 -0
- package/dist/biff/string-writer.js +55 -0
- package/dist/biff/strings.d.cts +1 -1
- package/dist/biff/strings.d.ts +1 -1
- package/dist/biff/substreams.d.cts +1 -20
- package/dist/biff/substreams.d.ts +1 -20
- package/dist/biff/write-errors.cjs +10 -0
- package/dist/biff/write-errors.d.cts +6 -0
- package/dist/biff/write-errors.d.ts +6 -0
- package/dist/biff/write-errors.js +9 -0
- package/dist/biff/xf-colors.cjs +374 -0
- package/dist/biff/xf-colors.d.cts +2 -0
- package/dist/biff/xf-colors.d.ts +2 -0
- package/dist/biff/xf-colors.js +339 -0
- package/dist/biff/xf-writer.cjs +96 -0
- package/dist/biff/xf-writer.d.cts +29 -0
- package/dist/biff/xf-writer.d.ts +29 -0
- package/dist/biff/xf-writer.js +90 -0
- package/dist/container.cjs +13 -4
- package/dist/container.d.cts +10 -3
- package/dist/container.d.ts +10 -3
- package/dist/container.js +12 -4
- package/dist/content.cjs +123 -18
- package/dist/content.js +123 -18
- package/dist/cursor-VMtw9uVP.d.cts +30 -0
- package/dist/cursor-VMtw9uVP.d.ts +30 -0
- package/dist/index.cjs +71 -5
- package/dist/index.d.cts +20 -10
- package/dist/index.d.ts +20 -10
- package/dist/index.js +17 -7
- package/dist/metadata.cjs +14 -0
- package/dist/metadata.d.cts +6 -0
- package/dist/metadata.d.ts +6 -0
- package/dist/metadata.js +13 -0
- package/dist/print-names-D-njuzVw.d.cts +41 -0
- package/dist/print-names-DUlpVE00.d.ts +41 -0
- package/dist/print-setup-B_ihDvm5.d.cts +57 -0
- package/dist/print-setup-B_ihDvm5.d.ts +57 -0
- package/dist/ptg-B2K8t3js.d.cts +21 -0
- package/dist/ptg-B2K8t3js.d.ts +21 -0
- package/dist/serial.cjs +41 -0
- package/dist/serial.d.cts +7 -1
- package/dist/serial.d.ts +7 -1
- package/dist/serial.js +39 -1
- package/dist/substreams-D7dQiJbp.d.ts +21 -0
- package/dist/substreams-Ddtvn_Vr.d.cts +21 -0
- package/dist/units.cjs +37 -0
- package/dist/units.d.cts +15 -1
- package/dist/units.d.ts +15 -1
- package/dist/units.js +33 -1
- package/dist/workbook/globals-writer.cjs +122 -0
- package/dist/workbook/globals-writer.d.cts +39 -0
- package/dist/workbook/globals-writer.d.ts +39 -0
- package/dist/workbook/globals-writer.js +120 -0
- package/dist/workbook/globals.cjs +72 -8
- package/dist/workbook/globals.d.cts +26 -2
- package/dist/workbook/globals.d.ts +26 -2
- package/dist/workbook/globals.js +71 -7
- package/dist/workbook/print-names.cjs +241 -0
- package/dist/workbook/print-names.d.cts +2 -0
- package/dist/workbook/print-names.d.ts +2 -0
- package/dist/workbook/print-names.js +238 -0
- package/dist/workbook/sheet-writer.cjs +277 -0
- package/dist/workbook/sheet-writer.d.cts +12 -0
- package/dist/workbook/sheet-writer.d.ts +12 -0
- package/dist/workbook/sheet-writer.js +276 -0
- package/dist/workbook/sheet.cjs +125 -17
- package/dist/workbook/sheet.d.cts +38 -4
- package/dist/workbook/sheet.d.ts +38 -4
- package/dist/workbook/sheet.js +125 -17
- package/dist/write.cjs +311 -0
- package/dist/write.d.cts +13 -0
- package/dist/write.d.ts +13 -0
- package/dist/write.js +309 -0
- package/dist/written-cells.cjs +26 -0
- package/dist/written-cells.d.cts +16 -0
- package/dist/written-cells.d.ts +16 -0
- package/dist/written-cells.js +24 -0
- package/dist/xf-colors-CehHZtBy.d.cts +91 -0
- package/dist/xf-colors-CpykR3B9.d.ts +91 -0
- package/package.json +4 -3
- package/dist/number-format.cjs +0 -298
- package/dist/number-format.d.cts +0 -32
- package/dist/number-format.d.ts +0 -32
- package/dist/number-format.js +0 -296
package/dist/biff/errors.js
CHANGED
|
@@ -13,5 +13,11 @@ const ERROR_TEXT = /* @__PURE__ */ new Map([
|
|
|
13
13
|
function errorTextOf(code) {
|
|
14
14
|
return ERROR_TEXT.get(code);
|
|
15
15
|
}
|
|
16
|
+
/** The write direction's own lookup, built once from ERROR_TEXT rather than as a second hand-maintained table, so the two directions cannot drift apart. */
|
|
17
|
+
const ERROR_CODE = new Map(Array.from(ERROR_TEXT, ([code, text]) => [text, code]));
|
|
18
|
+
/** The BIFF8 error code for a cell's displayed error text, or undefined when the text is not one of the eight [MS-XLS] defines -- which the writer refuses to guess a code for rather than silently substituting a different error. */
|
|
19
|
+
function errorCodeOf(text) {
|
|
20
|
+
return ERROR_CODE.get(text);
|
|
21
|
+
}
|
|
16
22
|
//#endregion
|
|
17
|
-
export { errorTextOf };
|
|
23
|
+
export { errorCodeOf, errorTextOf };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_units = require("../units.cjs");
|
|
3
|
+
//#region src/biff/print-setup.ts
|
|
4
|
+
/** Setup.grbit's own bit assignments ([MS-XLS] 2.4.257's fields A through L, in the order that section lists them: fLeftToRight, fPortrait, fNoPls, fNoColor, fDraft, fNotes, fNoOrient, fUsePage, unused1, fEndNotes, iErrors (2 bits), reserved (4 bits)). Only the four this package acts on are named. */
|
|
5
|
+
const SETUP_FLAG_LEFT_TO_RIGHT = 1;
|
|
6
|
+
const SETUP_FLAG_PORTRAIT = 2;
|
|
7
|
+
const SETUP_FLAG_NO_PLS = 4;
|
|
8
|
+
const SETUP_FLAG_NO_ORIENT = 64;
|
|
9
|
+
/** WsBool's own fFitToPage bit -- field G of [MS-XLS] 2.4.351, the ninth bit of its single 16-bit field (fShowAutoBreaks, reserved1 (3 bits), fDialog, fApplyStyles, fRowSumsBelow, fColSumsRight, fFitToPage, ...). */
|
|
10
|
+
const WSBOOL_FLAG_FIT_TO_PAGE = 256;
|
|
11
|
+
/** Packs a SetupFields' own four flags back into the record's grbit word. Every bit this package does not model is written as zero, which is what [MS-XLS] 2.4.257's own reserved field requires and what its remaining optional behaviours (black-and-white, draft quality, comment printing, error rendering, a custom starting page number) default to. */
|
|
12
|
+
function packSetupFlags(fields) {
|
|
13
|
+
return (fields.leftToRight ? SETUP_FLAG_LEFT_TO_RIGHT : 0) | (fields.portrait ? SETUP_FLAG_PORTRAIT : 0) | (fields.noPls ? SETUP_FLAG_NO_PLS : 0) | (fields.noOrientation ? SETUP_FLAG_NO_ORIENT : 0);
|
|
14
|
+
}
|
|
15
|
+
/** The read-side inverse of packSetupFlags: the four flags this package acts on, taken out of the record's grbit word. */
|
|
16
|
+
function unpackSetupFlags(grbit) {
|
|
17
|
+
return {
|
|
18
|
+
leftToRight: (grbit & SETUP_FLAG_LEFT_TO_RIGHT) !== 0,
|
|
19
|
+
portrait: (grbit & SETUP_FLAG_PORTRAIT) !== 0,
|
|
20
|
+
noPls: (grbit & SETUP_FLAG_NO_PLS) !== 0,
|
|
21
|
+
noOrientation: (grbit & SETUP_FLAG_NO_ORIENT) !== 0
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The page size a Setup record's own iPaperSize and orientation flags describe, or undefined when the code is not one this package maps.
|
|
26
|
+
*
|
|
27
|
+
* A paper code names the sheet's paper in its PORTRAIT dimensions regardless of how the sheet actually prints, so the orientation flags decide whether those dimensions are used as-is or transposed. [MS-XLS] 2.4.257 defines that in two steps: fNoOrient set means "Pages are printed using portrait mode" outright, and only when it is clear does fPortrait itself select portrait (1) or landscape (0).
|
|
28
|
+
*/
|
|
29
|
+
function pageSizeFromSetup(fields) {
|
|
30
|
+
const portraitSize = PAPER_SIZE_BY_CODE.get(fields.paperCode);
|
|
31
|
+
if (portraitSize === void 0) return;
|
|
32
|
+
return fields.noOrientation || fields.portrait ? portraitSize : {
|
|
33
|
+
widthPt: portraitSize.heightPt,
|
|
34
|
+
heightPt: portraitSize.widthPt
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** How close two page dimensions must be, in points, to count as the same paper. Half a point is about 0.18mm -- far below any real paper-size difference, and wide enough to absorb the hundredth-of-a-point rounding the table below applies and the unit conversions a page size picks up crossing between codecs. The same tolerance ooxml.js's own pageSizeToPaperSizeCode uses for the identical decision on xlsx's paperSize attribute. */
|
|
38
|
+
const PAPER_SIZE_TOLERANCE_PT = .5;
|
|
39
|
+
/**
|
|
40
|
+
* The write-side inverse of pageSizeFromSetup: the paper code and orientation whose resolved page size matches this one, or undefined when no code in the table does.
|
|
41
|
+
*
|
|
42
|
+
* Undefined is a real answer with no fallback behind it. Unlike xlsx's own pageSetup element, which can state an explicit paperWidth/paperHeight pair when no code fits, [MS-XLS] 2.4.257's Setup record addresses paper only by code -- its own escape hatch for a size outside the table is a printer-defined custom size carried in a separate Pls record ([MS-XLS] 2.4.199), a printer driver's opaque DEVMODE blob rather than a pair of dimensions any reader could recover the size from. So a page size no code names genuinely cannot be written; the caller refuses rather than silently substituting a paper the document never asked for.
|
|
43
|
+
*
|
|
44
|
+
* A portrait match is preferred over a landscape one wherever both exist, which is what keeps the choice deterministic for the handful of codes in the table that are each other's transpose (US Tabloid 11x17in and US Ledger 17x11in are the same sheet of paper entered twice, once each way round).
|
|
45
|
+
*/
|
|
46
|
+
function paperSelectionFor(pageSize) {
|
|
47
|
+
for (const [code, paper] of PAPER_SIZE_BY_CODE) if (matches(pageSize.widthPt, paper.widthPt) && matches(pageSize.heightPt, paper.heightPt)) return {
|
|
48
|
+
code,
|
|
49
|
+
portrait: true
|
|
50
|
+
};
|
|
51
|
+
for (const [code, paper] of PAPER_SIZE_BY_CODE) if (matches(pageSize.widthPt, paper.heightPt) && matches(pageSize.heightPt, paper.widthPt)) return {
|
|
52
|
+
code,
|
|
53
|
+
portrait: false
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function matches(a, b) {
|
|
57
|
+
return Math.abs(a - b) <= PAPER_SIZE_TOLERANCE_PT;
|
|
58
|
+
}
|
|
59
|
+
/** Rounded to hundredths of a point, which is how document-schema.js spells its own PAGE_SIZE_A4 (595.28 x 841.89 pt, the same 210 x 297 mm converted the same way). Rounding here rather than carrying the full conversion is what makes a code-9 page size read out of a real file EQUAL that shared constant instead of merely being within a rounding error of it. */
|
|
60
|
+
function roundToHundredths(value) {
|
|
61
|
+
return Math.round(value * 100) / 100;
|
|
62
|
+
}
|
|
63
|
+
function inchPaper(widthIn, heightIn) {
|
|
64
|
+
return {
|
|
65
|
+
widthPt: roundToHundredths(require_units.inchesToPoints(widthIn)),
|
|
66
|
+
heightPt: roundToHundredths(require_units.inchesToPoints(heightIn))
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function millimetrePaper(widthMm, heightMm) {
|
|
70
|
+
return {
|
|
71
|
+
widthPt: roundToHundredths(require_units.millimetresToPoints(widthMm)),
|
|
72
|
+
heightPt: roundToHundredths(require_units.millimetresToPoints(heightMm))
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Setup.iPaperSize's own code table ([MS-XLS] 2.4.257), restricted to the codes whose entry states a real, unambiguous sheet size in inches or millimetres, and with each size derived from those stated dimensions rather than from a table of pre-converted points.
|
|
77
|
+
*
|
|
78
|
+
* The full enumeration runs to 118 entries, most of them envelopes, rotated variants, and regional stationery sizes; the ones here are the office paper sizes a spreadsheet is realistically printed on, entered exactly as [MS-XLS]'s own table names them. A code outside this table -- including 0 and everything at 256 or above, which the spec reserves for "custom printer paper sizes" no reader can resolve without the printer's own Pls record -- resolves to no page size at all, and content.ts falls back to its documented default rather than guessing a size the file never stated.
|
|
79
|
+
*/
|
|
80
|
+
const PAPER_SIZE_BY_CODE = /* @__PURE__ */ new Map([
|
|
81
|
+
[1, inchPaper(8.5, 11)],
|
|
82
|
+
[2, inchPaper(8.5, 11)],
|
|
83
|
+
[3, inchPaper(11, 17)],
|
|
84
|
+
[4, inchPaper(17, 11)],
|
|
85
|
+
[5, inchPaper(8.5, 14)],
|
|
86
|
+
[6, inchPaper(5.5, 8.5)],
|
|
87
|
+
[7, inchPaper(7.25, 10.5)],
|
|
88
|
+
[8, millimetrePaper(297, 420)],
|
|
89
|
+
[9, millimetrePaper(210, 297)],
|
|
90
|
+
[10, millimetrePaper(210, 297)],
|
|
91
|
+
[11, millimetrePaper(148, 210)],
|
|
92
|
+
[12, millimetrePaper(250, 354)],
|
|
93
|
+
[13, millimetrePaper(182, 257)],
|
|
94
|
+
[14, inchPaper(8.5, 13)],
|
|
95
|
+
[15, millimetrePaper(215, 275)],
|
|
96
|
+
[16, inchPaper(10, 14)],
|
|
97
|
+
[17, inchPaper(11, 17)],
|
|
98
|
+
[18, inchPaper(8.5, 11)],
|
|
99
|
+
[42, millimetrePaper(250, 353)],
|
|
100
|
+
[66, millimetrePaper(420, 594)],
|
|
101
|
+
[70, millimetrePaper(105, 148)]
|
|
102
|
+
]);
|
|
103
|
+
//#endregion
|
|
104
|
+
exports.WSBOOL_FLAG_FIT_TO_PAGE = WSBOOL_FLAG_FIT_TO_PAGE;
|
|
105
|
+
exports.packSetupFlags = packSetupFlags;
|
|
106
|
+
exports.pageSizeFromSetup = pageSizeFromSetup;
|
|
107
|
+
exports.paperSelectionFor = paperSelectionFor;
|
|
108
|
+
exports.unpackSetupFlags = unpackSetupFlags;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as pageSizeFromSetup, i as packSetupFlags, n as SetupFields, o as paperSelectionFor, r as WSBOOL_FLAG_FIT_TO_PAGE, s as unpackSetupFlags, t as PaperSelection } from "../print-setup-B_ihDvm5.cjs";
|
|
2
|
+
export { PaperSelection, SetupFields, WSBOOL_FLAG_FIT_TO_PAGE, packSetupFlags, pageSizeFromSetup, paperSelectionFor, unpackSetupFlags };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as pageSizeFromSetup, i as packSetupFlags, n as SetupFields, o as paperSelectionFor, r as WSBOOL_FLAG_FIT_TO_PAGE, s as unpackSetupFlags, t as PaperSelection } from "../print-setup-B_ihDvm5.js";
|
|
2
|
+
export { PaperSelection, SetupFields, WSBOOL_FLAG_FIT_TO_PAGE, packSetupFlags, pageSizeFromSetup, paperSelectionFor, unpackSetupFlags };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { inchesToPoints, millimetresToPoints } from "../units.js";
|
|
2
|
+
//#region src/biff/print-setup.ts
|
|
3
|
+
/** Setup.grbit's own bit assignments ([MS-XLS] 2.4.257's fields A through L, in the order that section lists them: fLeftToRight, fPortrait, fNoPls, fNoColor, fDraft, fNotes, fNoOrient, fUsePage, unused1, fEndNotes, iErrors (2 bits), reserved (4 bits)). Only the four this package acts on are named. */
|
|
4
|
+
const SETUP_FLAG_LEFT_TO_RIGHT = 1;
|
|
5
|
+
const SETUP_FLAG_PORTRAIT = 2;
|
|
6
|
+
const SETUP_FLAG_NO_PLS = 4;
|
|
7
|
+
const SETUP_FLAG_NO_ORIENT = 64;
|
|
8
|
+
/** WsBool's own fFitToPage bit -- field G of [MS-XLS] 2.4.351, the ninth bit of its single 16-bit field (fShowAutoBreaks, reserved1 (3 bits), fDialog, fApplyStyles, fRowSumsBelow, fColSumsRight, fFitToPage, ...). */
|
|
9
|
+
const WSBOOL_FLAG_FIT_TO_PAGE = 256;
|
|
10
|
+
/** Packs a SetupFields' own four flags back into the record's grbit word. Every bit this package does not model is written as zero, which is what [MS-XLS] 2.4.257's own reserved field requires and what its remaining optional behaviours (black-and-white, draft quality, comment printing, error rendering, a custom starting page number) default to. */
|
|
11
|
+
function packSetupFlags(fields) {
|
|
12
|
+
return (fields.leftToRight ? SETUP_FLAG_LEFT_TO_RIGHT : 0) | (fields.portrait ? SETUP_FLAG_PORTRAIT : 0) | (fields.noPls ? SETUP_FLAG_NO_PLS : 0) | (fields.noOrientation ? SETUP_FLAG_NO_ORIENT : 0);
|
|
13
|
+
}
|
|
14
|
+
/** The read-side inverse of packSetupFlags: the four flags this package acts on, taken out of the record's grbit word. */
|
|
15
|
+
function unpackSetupFlags(grbit) {
|
|
16
|
+
return {
|
|
17
|
+
leftToRight: (grbit & SETUP_FLAG_LEFT_TO_RIGHT) !== 0,
|
|
18
|
+
portrait: (grbit & SETUP_FLAG_PORTRAIT) !== 0,
|
|
19
|
+
noPls: (grbit & SETUP_FLAG_NO_PLS) !== 0,
|
|
20
|
+
noOrientation: (grbit & SETUP_FLAG_NO_ORIENT) !== 0
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The page size a Setup record's own iPaperSize and orientation flags describe, or undefined when the code is not one this package maps.
|
|
25
|
+
*
|
|
26
|
+
* A paper code names the sheet's paper in its PORTRAIT dimensions regardless of how the sheet actually prints, so the orientation flags decide whether those dimensions are used as-is or transposed. [MS-XLS] 2.4.257 defines that in two steps: fNoOrient set means "Pages are printed using portrait mode" outright, and only when it is clear does fPortrait itself select portrait (1) or landscape (0).
|
|
27
|
+
*/
|
|
28
|
+
function pageSizeFromSetup(fields) {
|
|
29
|
+
const portraitSize = PAPER_SIZE_BY_CODE.get(fields.paperCode);
|
|
30
|
+
if (portraitSize === void 0) return;
|
|
31
|
+
return fields.noOrientation || fields.portrait ? portraitSize : {
|
|
32
|
+
widthPt: portraitSize.heightPt,
|
|
33
|
+
heightPt: portraitSize.widthPt
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/** How close two page dimensions must be, in points, to count as the same paper. Half a point is about 0.18mm -- far below any real paper-size difference, and wide enough to absorb the hundredth-of-a-point rounding the table below applies and the unit conversions a page size picks up crossing between codecs. The same tolerance ooxml.js's own pageSizeToPaperSizeCode uses for the identical decision on xlsx's paperSize attribute. */
|
|
37
|
+
const PAPER_SIZE_TOLERANCE_PT = .5;
|
|
38
|
+
/**
|
|
39
|
+
* The write-side inverse of pageSizeFromSetup: the paper code and orientation whose resolved page size matches this one, or undefined when no code in the table does.
|
|
40
|
+
*
|
|
41
|
+
* Undefined is a real answer with no fallback behind it. Unlike xlsx's own pageSetup element, which can state an explicit paperWidth/paperHeight pair when no code fits, [MS-XLS] 2.4.257's Setup record addresses paper only by code -- its own escape hatch for a size outside the table is a printer-defined custom size carried in a separate Pls record ([MS-XLS] 2.4.199), a printer driver's opaque DEVMODE blob rather than a pair of dimensions any reader could recover the size from. So a page size no code names genuinely cannot be written; the caller refuses rather than silently substituting a paper the document never asked for.
|
|
42
|
+
*
|
|
43
|
+
* A portrait match is preferred over a landscape one wherever both exist, which is what keeps the choice deterministic for the handful of codes in the table that are each other's transpose (US Tabloid 11x17in and US Ledger 17x11in are the same sheet of paper entered twice, once each way round).
|
|
44
|
+
*/
|
|
45
|
+
function paperSelectionFor(pageSize) {
|
|
46
|
+
for (const [code, paper] of PAPER_SIZE_BY_CODE) if (matches(pageSize.widthPt, paper.widthPt) && matches(pageSize.heightPt, paper.heightPt)) return {
|
|
47
|
+
code,
|
|
48
|
+
portrait: true
|
|
49
|
+
};
|
|
50
|
+
for (const [code, paper] of PAPER_SIZE_BY_CODE) if (matches(pageSize.widthPt, paper.heightPt) && matches(pageSize.heightPt, paper.widthPt)) return {
|
|
51
|
+
code,
|
|
52
|
+
portrait: false
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function matches(a, b) {
|
|
56
|
+
return Math.abs(a - b) <= PAPER_SIZE_TOLERANCE_PT;
|
|
57
|
+
}
|
|
58
|
+
/** Rounded to hundredths of a point, which is how document-schema.js spells its own PAGE_SIZE_A4 (595.28 x 841.89 pt, the same 210 x 297 mm converted the same way). Rounding here rather than carrying the full conversion is what makes a code-9 page size read out of a real file EQUAL that shared constant instead of merely being within a rounding error of it. */
|
|
59
|
+
function roundToHundredths(value) {
|
|
60
|
+
return Math.round(value * 100) / 100;
|
|
61
|
+
}
|
|
62
|
+
function inchPaper(widthIn, heightIn) {
|
|
63
|
+
return {
|
|
64
|
+
widthPt: roundToHundredths(inchesToPoints(widthIn)),
|
|
65
|
+
heightPt: roundToHundredths(inchesToPoints(heightIn))
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function millimetrePaper(widthMm, heightMm) {
|
|
69
|
+
return {
|
|
70
|
+
widthPt: roundToHundredths(millimetresToPoints(widthMm)),
|
|
71
|
+
heightPt: roundToHundredths(millimetresToPoints(heightMm))
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Setup.iPaperSize's own code table ([MS-XLS] 2.4.257), restricted to the codes whose entry states a real, unambiguous sheet size in inches or millimetres, and with each size derived from those stated dimensions rather than from a table of pre-converted points.
|
|
76
|
+
*
|
|
77
|
+
* The full enumeration runs to 118 entries, most of them envelopes, rotated variants, and regional stationery sizes; the ones here are the office paper sizes a spreadsheet is realistically printed on, entered exactly as [MS-XLS]'s own table names them. A code outside this table -- including 0 and everything at 256 or above, which the spec reserves for "custom printer paper sizes" no reader can resolve without the printer's own Pls record -- resolves to no page size at all, and content.ts falls back to its documented default rather than guessing a size the file never stated.
|
|
78
|
+
*/
|
|
79
|
+
const PAPER_SIZE_BY_CODE = /* @__PURE__ */ new Map([
|
|
80
|
+
[1, inchPaper(8.5, 11)],
|
|
81
|
+
[2, inchPaper(8.5, 11)],
|
|
82
|
+
[3, inchPaper(11, 17)],
|
|
83
|
+
[4, inchPaper(17, 11)],
|
|
84
|
+
[5, inchPaper(8.5, 14)],
|
|
85
|
+
[6, inchPaper(5.5, 8.5)],
|
|
86
|
+
[7, inchPaper(7.25, 10.5)],
|
|
87
|
+
[8, millimetrePaper(297, 420)],
|
|
88
|
+
[9, millimetrePaper(210, 297)],
|
|
89
|
+
[10, millimetrePaper(210, 297)],
|
|
90
|
+
[11, millimetrePaper(148, 210)],
|
|
91
|
+
[12, millimetrePaper(250, 354)],
|
|
92
|
+
[13, millimetrePaper(182, 257)],
|
|
93
|
+
[14, inchPaper(8.5, 13)],
|
|
94
|
+
[15, millimetrePaper(215, 275)],
|
|
95
|
+
[16, inchPaper(10, 14)],
|
|
96
|
+
[17, inchPaper(11, 17)],
|
|
97
|
+
[18, inchPaper(8.5, 11)],
|
|
98
|
+
[42, millimetrePaper(250, 353)],
|
|
99
|
+
[66, millimetrePaper(420, 594)],
|
|
100
|
+
[70, millimetrePaper(105, 148)]
|
|
101
|
+
]);
|
|
102
|
+
//#endregion
|
|
103
|
+
export { WSBOOL_FLAG_FIT_TO_PAGE, packSetupFlags, pageSizeFromSetup, paperSelectionFor, unpackSetupFlags };
|
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/biff/ptg-functions.ts
|
|
3
|
+
const FTAB_ENTRIES = [
|
|
4
|
+
[0, ["COUNT"]],
|
|
5
|
+
[1, ["IF"]],
|
|
6
|
+
[2, ["ISNA", 1]],
|
|
7
|
+
[3, ["ISERROR", 1]],
|
|
8
|
+
[4, ["SUM"]],
|
|
9
|
+
[5, ["AVERAGE"]],
|
|
10
|
+
[6, ["MIN"]],
|
|
11
|
+
[7, ["MAX"]],
|
|
12
|
+
[8, ["ROW"]],
|
|
13
|
+
[9, ["COLUMN"]],
|
|
14
|
+
[10, ["NA", 0]],
|
|
15
|
+
[11, ["NPV"]],
|
|
16
|
+
[12, ["STDEV"]],
|
|
17
|
+
[13, ["DOLLAR"]],
|
|
18
|
+
[14, ["FIXED"]],
|
|
19
|
+
[15, ["SIN", 1]],
|
|
20
|
+
[16, ["COS", 1]],
|
|
21
|
+
[17, ["TAN", 1]],
|
|
22
|
+
[18, ["ATAN", 1]],
|
|
23
|
+
[19, ["PI", 0]],
|
|
24
|
+
[20, ["SQRT", 1]],
|
|
25
|
+
[21, ["EXP", 1]],
|
|
26
|
+
[22, ["LN", 1]],
|
|
27
|
+
[23, ["LOG10", 1]],
|
|
28
|
+
[24, ["ABS", 1]],
|
|
29
|
+
[25, ["INT", 1]],
|
|
30
|
+
[26, ["SIGN", 1]],
|
|
31
|
+
[27, ["ROUND", 2]],
|
|
32
|
+
[28, ["LOOKUP"]],
|
|
33
|
+
[29, ["INDEX"]],
|
|
34
|
+
[30, ["REPT", 2]],
|
|
35
|
+
[31, ["MID", 3]],
|
|
36
|
+
[32, ["LEN", 1]],
|
|
37
|
+
[33, ["VALUE", 1]],
|
|
38
|
+
[34, ["TRUE", 0]],
|
|
39
|
+
[35, ["FALSE", 0]],
|
|
40
|
+
[36, ["AND"]],
|
|
41
|
+
[37, ["OR"]],
|
|
42
|
+
[38, ["NOT", 1]],
|
|
43
|
+
[39, ["MOD", 2]],
|
|
44
|
+
[40, ["DCOUNT", 3]],
|
|
45
|
+
[41, ["DSUM", 3]],
|
|
46
|
+
[42, ["DAVERAGE", 3]],
|
|
47
|
+
[43, ["DMIN", 3]],
|
|
48
|
+
[44, ["DMAX", 3]],
|
|
49
|
+
[45, ["DSTDEV", 3]],
|
|
50
|
+
[46, ["VAR"]],
|
|
51
|
+
[47, ["DVAR", 3]],
|
|
52
|
+
[48, ["TEXT", 2]],
|
|
53
|
+
[49, ["LINEST"]],
|
|
54
|
+
[50, ["TREND"]],
|
|
55
|
+
[51, ["LOGEST"]],
|
|
56
|
+
[52, ["GROWTH"]],
|
|
57
|
+
[53, ["GOTO", 1]],
|
|
58
|
+
[54, ["HALT"]],
|
|
59
|
+
[55, ["RETURN"]],
|
|
60
|
+
[56, ["PV"]],
|
|
61
|
+
[57, ["FV"]],
|
|
62
|
+
[58, ["NPER"]],
|
|
63
|
+
[59, ["PMT"]],
|
|
64
|
+
[60, ["RATE"]],
|
|
65
|
+
[61, ["MIRR", 3]],
|
|
66
|
+
[62, ["IRR"]],
|
|
67
|
+
[63, ["RAND", 0]],
|
|
68
|
+
[64, ["MATCH"]],
|
|
69
|
+
[65, ["DATE", 3]],
|
|
70
|
+
[66, ["TIME", 3]],
|
|
71
|
+
[67, ["DAY", 1]],
|
|
72
|
+
[68, ["MONTH", 1]],
|
|
73
|
+
[69, ["YEAR", 1]],
|
|
74
|
+
[70, ["WEEKDAY"]],
|
|
75
|
+
[71, ["HOUR", 1]],
|
|
76
|
+
[72, ["MINUTE", 1]],
|
|
77
|
+
[73, ["SECOND", 1]],
|
|
78
|
+
[74, ["NOW", 0]],
|
|
79
|
+
[75, ["AREAS", 1]],
|
|
80
|
+
[76, ["ROWS", 1]],
|
|
81
|
+
[77, ["COLUMNS", 1]],
|
|
82
|
+
[78, ["OFFSET"]],
|
|
83
|
+
[79, ["ABSREF", 2]],
|
|
84
|
+
[80, ["RELREF", 2]],
|
|
85
|
+
[81, ["ARGUMENT"]],
|
|
86
|
+
[82, ["SEARCH"]],
|
|
87
|
+
[83, ["TRANSPOSE", 1]],
|
|
88
|
+
[84, ["ERROR"]],
|
|
89
|
+
[85, ["STEP", 0]],
|
|
90
|
+
[86, ["TYPE", 1]],
|
|
91
|
+
[87, ["ECHO"]],
|
|
92
|
+
[88, ["SET.NAME"]],
|
|
93
|
+
[89, ["CALLER", 0]],
|
|
94
|
+
[90, ["DEREF", 1]],
|
|
95
|
+
[91, ["WINDOWS"]],
|
|
96
|
+
[92, ["SERIES"]],
|
|
97
|
+
[93, ["DOCUMENTS"]],
|
|
98
|
+
[94, ["ACTIVE.CELL", 0]],
|
|
99
|
+
[95, ["SELECTION", 0]],
|
|
100
|
+
[96, ["RESULT"]],
|
|
101
|
+
[97, ["ATAN2", 2]],
|
|
102
|
+
[98, ["ASIN", 1]],
|
|
103
|
+
[99, ["ACOS", 1]],
|
|
104
|
+
[100, ["CHOOSE"]],
|
|
105
|
+
[101, ["HLOOKUP"]],
|
|
106
|
+
[102, ["VLOOKUP"]],
|
|
107
|
+
[103, ["LINKS"]],
|
|
108
|
+
[104, ["INPUT"]],
|
|
109
|
+
[105, ["ISREF", 1]],
|
|
110
|
+
[106, ["GET.FORMULA", 1]],
|
|
111
|
+
[107, ["GET.NAME"]],
|
|
112
|
+
[108, ["SET.VALUE", 2]],
|
|
113
|
+
[109, ["LOG"]],
|
|
114
|
+
[110, ["EXEC"]],
|
|
115
|
+
[111, ["CHAR", 1]],
|
|
116
|
+
[112, ["LOWER", 1]],
|
|
117
|
+
[113, ["UPPER", 1]],
|
|
118
|
+
[114, ["PROPER", 1]],
|
|
119
|
+
[115, ["LEFT"]],
|
|
120
|
+
[116, ["RIGHT"]],
|
|
121
|
+
[117, ["EXACT", 2]],
|
|
122
|
+
[118, ["TRIM", 1]],
|
|
123
|
+
[119, ["REPLACE", 4]],
|
|
124
|
+
[120, ["SUBSTITUTE"]],
|
|
125
|
+
[121, ["CODE", 1]],
|
|
126
|
+
[122, ["NAMES"]],
|
|
127
|
+
[123, ["DIRECTORY"]],
|
|
128
|
+
[124, ["FIND"]],
|
|
129
|
+
[125, ["CELL"]],
|
|
130
|
+
[126, ["ISERR", 1]],
|
|
131
|
+
[127, ["ISTEXT", 1]],
|
|
132
|
+
[128, ["ISNUMBER", 1]],
|
|
133
|
+
[129, ["ISBLANK", 1]],
|
|
134
|
+
[130, ["T", 1]],
|
|
135
|
+
[131, ["N", 1]],
|
|
136
|
+
[132, ["FOPEN"]],
|
|
137
|
+
[133, ["FCLOSE", 1]],
|
|
138
|
+
[134, ["FSIZE", 1]],
|
|
139
|
+
[135, ["FREADLN", 1]],
|
|
140
|
+
[136, ["FREAD", 2]],
|
|
141
|
+
[137, ["FWRITELN", 2]],
|
|
142
|
+
[138, ["FWRITE", 2]],
|
|
143
|
+
[139, ["FPOS"]],
|
|
144
|
+
[140, ["DATEVALUE", 1]],
|
|
145
|
+
[141, ["TIMEVALUE", 1]],
|
|
146
|
+
[142, ["SLN", 3]],
|
|
147
|
+
[143, ["SYD", 4]],
|
|
148
|
+
[144, ["DDB"]],
|
|
149
|
+
[145, ["GET.DEF"]],
|
|
150
|
+
[146, ["REFTEXT"]],
|
|
151
|
+
[147, ["TEXTREF"]],
|
|
152
|
+
[148, ["INDIRECT"]],
|
|
153
|
+
[149, ["REGISTER"]],
|
|
154
|
+
[150, ["CALL"]],
|
|
155
|
+
[151, ["ADD.BAR"]],
|
|
156
|
+
[152, ["ADD.MENU"]],
|
|
157
|
+
[153, ["ADD.COMMAND"]],
|
|
158
|
+
[154, ["ENABLE.COMMAND"]],
|
|
159
|
+
[155, ["CHECK.COMMAND"]],
|
|
160
|
+
[156, ["RENAME.COMMAND"]],
|
|
161
|
+
[157, ["SHOW.BAR"]],
|
|
162
|
+
[158, ["DELETE.MENU"]],
|
|
163
|
+
[159, ["DELETE.COMMAND"]],
|
|
164
|
+
[160, ["GET.CHART.ITEM"]],
|
|
165
|
+
[161, ["DIALOG.BOX", 1]],
|
|
166
|
+
[162, ["CLEAN", 1]],
|
|
167
|
+
[163, ["MDETERM", 1]],
|
|
168
|
+
[164, ["MINVERSE", 1]],
|
|
169
|
+
[165, ["MMULT", 2]],
|
|
170
|
+
[166, ["FILES"]],
|
|
171
|
+
[167, ["IPMT"]],
|
|
172
|
+
[168, ["PPMT"]],
|
|
173
|
+
[169, ["COUNTA"]],
|
|
174
|
+
[170, ["CANCEL.KEY"]],
|
|
175
|
+
[171, ["FOR"]],
|
|
176
|
+
[172, ["WHILE", 1]],
|
|
177
|
+
[173, ["BREAK", 0]],
|
|
178
|
+
[174, ["NEXT", 0]],
|
|
179
|
+
[175, ["INITIATE", 2]],
|
|
180
|
+
[176, ["REQUEST", 2]],
|
|
181
|
+
[177, ["POKE", 3]],
|
|
182
|
+
[178, ["EXECUTE", 2]],
|
|
183
|
+
[179, ["TERMINATE", 1]],
|
|
184
|
+
[180, ["RESTART"]],
|
|
185
|
+
[181, ["HELP"]],
|
|
186
|
+
[182, ["GET.BAR"]],
|
|
187
|
+
[183, ["PRODUCT"]],
|
|
188
|
+
[184, ["FACT", 1]],
|
|
189
|
+
[185, ["GET.CELL"]],
|
|
190
|
+
[186, ["GET.WORKSPACE", 1]],
|
|
191
|
+
[187, ["GET.WINDOW"]],
|
|
192
|
+
[188, ["GET.DOCUMENT"]],
|
|
193
|
+
[189, ["DPRODUCT", 3]],
|
|
194
|
+
[190, ["ISNONTEXT", 1]],
|
|
195
|
+
[191, ["GET.NOTE"]],
|
|
196
|
+
[192, ["NOTE"]],
|
|
197
|
+
[193, ["STDEVP"]],
|
|
198
|
+
[194, ["VARP"]],
|
|
199
|
+
[195, ["DSTDEVP", 3]],
|
|
200
|
+
[196, ["DVARP", 3]],
|
|
201
|
+
[197, ["TRUNC"]],
|
|
202
|
+
[198, ["ISLOGICAL", 1]],
|
|
203
|
+
[199, ["DCOUNTA", 3]],
|
|
204
|
+
[200, ["DELETE.BAR", 1]],
|
|
205
|
+
[201, ["UNREGISTER", 1]],
|
|
206
|
+
[204, ["USDOLLAR"]],
|
|
207
|
+
[205, ["FINDB"]],
|
|
208
|
+
[206, ["SEARCHB"]],
|
|
209
|
+
[207, ["REPLACEB", 4]],
|
|
210
|
+
[208, ["LEFTB"]],
|
|
211
|
+
[209, ["RIGHTB"]],
|
|
212
|
+
[210, ["MIDB", 3]],
|
|
213
|
+
[211, ["LENB", 1]],
|
|
214
|
+
[212, ["ROUNDUP", 2]],
|
|
215
|
+
[213, ["ROUNDDOWN", 2]],
|
|
216
|
+
[214, ["ASC", 1]],
|
|
217
|
+
[215, ["DBCS", 1]],
|
|
218
|
+
[216, ["RANK"]],
|
|
219
|
+
[219, ["ADDRESS"]],
|
|
220
|
+
[220, ["DAYS360"]],
|
|
221
|
+
[221, ["TODAY", 0]],
|
|
222
|
+
[222, ["VDB"]],
|
|
223
|
+
[223, ["ELSE", 0]],
|
|
224
|
+
[224, ["ELSE.IF", 1]],
|
|
225
|
+
[225, ["END.IF", 0]],
|
|
226
|
+
[226, ["FOR.CELL"]],
|
|
227
|
+
[227, ["MEDIAN"]],
|
|
228
|
+
[228, ["SUMPRODUCT"]],
|
|
229
|
+
[229, ["SINH", 1]],
|
|
230
|
+
[230, ["COSH", 1]],
|
|
231
|
+
[231, ["TANH", 1]],
|
|
232
|
+
[232, ["ASINH", 1]],
|
|
233
|
+
[233, ["ACOSH", 1]],
|
|
234
|
+
[234, ["ATANH", 1]],
|
|
235
|
+
[235, ["DGET", 3]],
|
|
236
|
+
[236, ["CREATE.OBJECT"]],
|
|
237
|
+
[237, ["VOLATILE"]],
|
|
238
|
+
[238, ["LAST.ERROR", 0]],
|
|
239
|
+
[239, ["CUSTOM.UNDO"]],
|
|
240
|
+
[240, ["CUSTOM.REPEAT"]],
|
|
241
|
+
[241, ["FORMULA.CONVERT"]],
|
|
242
|
+
[242, ["GET.LINK.INFO"]],
|
|
243
|
+
[243, ["TEXT.BOX"]],
|
|
244
|
+
[244, ["INFO", 1]],
|
|
245
|
+
[245, ["GROUP", 0]],
|
|
246
|
+
[246, ["GET.OBJECT"]],
|
|
247
|
+
[247, ["DB"]],
|
|
248
|
+
[248, ["PAUSE"]],
|
|
249
|
+
[251, ["RESUME"]],
|
|
250
|
+
[252, ["FREQUENCY", 2]],
|
|
251
|
+
[253, ["ADD.TOOLBAR"]],
|
|
252
|
+
[254, ["DELETE.TOOLBAR", 1]],
|
|
253
|
+
[256, ["RESET.TOOLBAR", 1]],
|
|
254
|
+
[257, ["EVALUATE", 1]],
|
|
255
|
+
[258, ["GET.TOOLBAR"]],
|
|
256
|
+
[259, ["GET.TOOL"]],
|
|
257
|
+
[260, ["SPELLING.CHECK"]],
|
|
258
|
+
[261, ["ERROR.TYPE", 1]],
|
|
259
|
+
[262, ["APP.TITLE"]],
|
|
260
|
+
[263, ["WINDOW.TITLE"]],
|
|
261
|
+
[264, ["SAVE.TOOLBAR"]],
|
|
262
|
+
[265, ["ENABLE.TOOL", 3]],
|
|
263
|
+
[266, ["PRESS.TOOL", 3]],
|
|
264
|
+
[267, ["REGISTER.ID"]],
|
|
265
|
+
[268, ["GET.WORKBOOK"]],
|
|
266
|
+
[269, ["AVEDEV"]],
|
|
267
|
+
[270, ["BETADIST"]],
|
|
268
|
+
[271, ["GAMMALN", 1]],
|
|
269
|
+
[272, ["BETAINV"]],
|
|
270
|
+
[273, ["BINOMDIST", 4]],
|
|
271
|
+
[274, ["CHIDIST", 2]],
|
|
272
|
+
[275, ["CHIINV", 2]],
|
|
273
|
+
[276, ["COMBIN", 2]],
|
|
274
|
+
[277, ["CONFIDENCE", 3]],
|
|
275
|
+
[278, ["CRITBINOM", 3]],
|
|
276
|
+
[279, ["EVEN", 1]],
|
|
277
|
+
[280, ["EXPONDIST", 3]],
|
|
278
|
+
[281, ["FDIST", 3]],
|
|
279
|
+
[282, ["FINV", 3]],
|
|
280
|
+
[283, ["FISHER", 1]],
|
|
281
|
+
[284, ["FISHERINV", 1]],
|
|
282
|
+
[285, ["FLOOR", 2]],
|
|
283
|
+
[286, ["GAMMADIST", 4]],
|
|
284
|
+
[287, ["GAMMAINV", 3]],
|
|
285
|
+
[288, ["CEILING", 2]],
|
|
286
|
+
[289, ["HYPGEOMDIST", 4]],
|
|
287
|
+
[290, ["LOGNORMDIST", 3]],
|
|
288
|
+
[291, ["LOGINV", 3]],
|
|
289
|
+
[292, ["NEGBINOMDIST", 3]],
|
|
290
|
+
[293, ["NORMDIST", 4]],
|
|
291
|
+
[294, ["NORMSDIST", 1]],
|
|
292
|
+
[295, ["NORMINV", 3]],
|
|
293
|
+
[296, ["NORMSINV", 1]],
|
|
294
|
+
[297, ["STANDARDIZE", 3]],
|
|
295
|
+
[298, ["ODD", 1]],
|
|
296
|
+
[299, ["PERMUT", 2]],
|
|
297
|
+
[300, ["POISSON", 3]],
|
|
298
|
+
[301, ["TDIST", 3]],
|
|
299
|
+
[302, ["WEIBULL", 4]],
|
|
300
|
+
[303, ["SUMXMY2", 2]],
|
|
301
|
+
[304, ["SUMX2MY2", 2]],
|
|
302
|
+
[305, ["SUMX2PY2", 2]],
|
|
303
|
+
[306, ["CHITEST", 2]],
|
|
304
|
+
[307, ["CORREL", 2]],
|
|
305
|
+
[308, ["COVAR", 2]],
|
|
306
|
+
[309, ["FORECAST", 3]],
|
|
307
|
+
[310, ["FTEST", 2]],
|
|
308
|
+
[311, ["INTERCEPT", 2]],
|
|
309
|
+
[312, ["PEARSON", 2]],
|
|
310
|
+
[313, ["RSQ", 2]],
|
|
311
|
+
[314, ["STEYX", 2]],
|
|
312
|
+
[315, ["SLOPE", 2]],
|
|
313
|
+
[316, ["TTEST", 4]],
|
|
314
|
+
[317, ["PROB"]],
|
|
315
|
+
[318, ["DEVSQ"]],
|
|
316
|
+
[319, ["GEOMEAN"]],
|
|
317
|
+
[320, ["HARMEAN"]],
|
|
318
|
+
[321, ["SUMSQ"]],
|
|
319
|
+
[322, ["KURT"]],
|
|
320
|
+
[323, ["SKEW"]],
|
|
321
|
+
[324, ["ZTEST"]],
|
|
322
|
+
[325, ["LARGE", 2]],
|
|
323
|
+
[326, ["SMALL", 2]],
|
|
324
|
+
[327, ["QUARTILE", 2]],
|
|
325
|
+
[328, ["PERCENTILE", 2]],
|
|
326
|
+
[329, ["PERCENTRANK"]],
|
|
327
|
+
[330, ["MODE"]],
|
|
328
|
+
[331, ["TRIMMEAN", 2]],
|
|
329
|
+
[332, ["TINV", 2]],
|
|
330
|
+
[334, ["MOVIE.COMMAND"]],
|
|
331
|
+
[335, ["GET.MOVIE"]],
|
|
332
|
+
[336, ["CONCATENATE"]],
|
|
333
|
+
[337, ["POWER", 2]],
|
|
334
|
+
[338, ["PIVOT.ADD.DATA"]],
|
|
335
|
+
[339, ["GET.PIVOT.TABLE"]],
|
|
336
|
+
[340, ["GET.PIVOT.FIELD"]],
|
|
337
|
+
[341, ["GET.PIVOT.ITEM"]],
|
|
338
|
+
[342, ["RADIANS", 1]],
|
|
339
|
+
[343, ["DEGREES", 1]],
|
|
340
|
+
[344, ["SUBTOTAL"]],
|
|
341
|
+
[345, ["SUMIF"]],
|
|
342
|
+
[346, ["COUNTIF", 2]],
|
|
343
|
+
[347, ["COUNTBLANK", 1]],
|
|
344
|
+
[348, ["SCENARIO.GET"]],
|
|
345
|
+
[349, ["OPTIONS.LISTS.GET", 1]],
|
|
346
|
+
[350, ["ISPMT", 4]],
|
|
347
|
+
[351, ["DATEDIF", 3]],
|
|
348
|
+
[352, ["DATESTRING", 1]],
|
|
349
|
+
[353, ["NUMBERSTRING", 2]],
|
|
350
|
+
[354, ["ROMAN"]],
|
|
351
|
+
[355, ["OPEN.DIALOG"]],
|
|
352
|
+
[356, ["SAVE.DIALOG"]],
|
|
353
|
+
[357, ["VIEW.GET"]],
|
|
354
|
+
[358, ["GETPIVOTDATA"]],
|
|
355
|
+
[359, ["HYPERLINK"]],
|
|
356
|
+
[360, ["PHONETIC", 1]],
|
|
357
|
+
[361, ["AVERAGEA"]],
|
|
358
|
+
[362, ["MAXA"]],
|
|
359
|
+
[363, ["MINA"]],
|
|
360
|
+
[364, ["STDEVPA"]],
|
|
361
|
+
[365, ["VARPA"]],
|
|
362
|
+
[366, ["STDEVA"]],
|
|
363
|
+
[367, ["VARA"]],
|
|
364
|
+
[368, ["BAHTTEXT", 1]],
|
|
365
|
+
[369, ["THAIDAYOFWEEK", 1]],
|
|
366
|
+
[370, ["THAIDIGIT", 1]],
|
|
367
|
+
[371, ["THAIMONTHOFYEAR", 1]],
|
|
368
|
+
[372, ["THAINUMSOUND", 1]],
|
|
369
|
+
[373, ["THAINUMSTRING", 1]],
|
|
370
|
+
[374, ["THAISTRINGLENGTH", 1]],
|
|
371
|
+
[375, ["ISTHAIDIGIT", 1]],
|
|
372
|
+
[376, ["ROUNDBAHTDOWN", 1]],
|
|
373
|
+
[377, ["ROUNDBAHTUP", 1]],
|
|
374
|
+
[378, ["THAIYEAR", 1]],
|
|
375
|
+
[379, ["RTD"]]
|
|
376
|
+
];
|
|
377
|
+
/** A function's displayed name, by its Ftab index -- consulted for both PtgFunc and PtgFuncVar. */
|
|
378
|
+
const FTAB_NAMES = new Map(FTAB_ENTRIES.map(([iftab, [name]]) => [iftab, name]));
|
|
379
|
+
/** A function's fixed argument count, by its Ftab index -- consulted only for PtgFunc, whose own token carries no count. Absent for every entry [MS-XLS]'s grammar gives an optional or repeated argument, which is never resolved through PtgFunc in practice (see the module comment). */
|
|
380
|
+
const FTAB_FIXED_ARITY = new Map(FTAB_ENTRIES.filter((entry) => entry[1][1] !== void 0).map(([iftab, [, arity]]) => [iftab, arity]));
|
|
381
|
+
//#endregion
|
|
382
|
+
exports.FTAB_FIXED_ARITY = FTAB_FIXED_ARITY;
|
|
383
|
+
exports.FTAB_NAMES = FTAB_NAMES;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region src/biff/ptg-functions.d.ts
|
|
2
|
+
/** A function's displayed name, by its Ftab index -- consulted for both PtgFunc and PtgFuncVar. */
|
|
3
|
+
declare const FTAB_NAMES: ReadonlyMap<number, string>;
|
|
4
|
+
/** A function's fixed argument count, by its Ftab index -- consulted only for PtgFunc, whose own token carries no count. Absent for every entry [MS-XLS]'s grammar gives an optional or repeated argument, which is never resolved through PtgFunc in practice (see the module comment). */
|
|
5
|
+
declare const FTAB_FIXED_ARITY: ReadonlyMap<number, number>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { FTAB_FIXED_ARITY, FTAB_NAMES };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region src/biff/ptg-functions.d.ts
|
|
2
|
+
/** A function's displayed name, by its Ftab index -- consulted for both PtgFunc and PtgFuncVar. */
|
|
3
|
+
declare const FTAB_NAMES: ReadonlyMap<number, string>;
|
|
4
|
+
/** A function's fixed argument count, by its Ftab index -- consulted only for PtgFunc, whose own token carries no count. Absent for every entry [MS-XLS]'s grammar gives an optional or repeated argument, which is never resolved through PtgFunc in practice (see the module comment). */
|
|
5
|
+
declare const FTAB_FIXED_ARITY: ReadonlyMap<number, number>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { FTAB_FIXED_ARITY, FTAB_NAMES };
|