reamkit 1.32.1 → 1.33.1
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/LICENSE +1 -1
- package/README.md +16 -11
- package/dist/esm/core/bidi/algorithm.js +2 -2
- package/dist/esm/core/bidi/char-types.js +1 -1
- package/dist/esm/core/bidi/index.js +3 -3
- package/dist/esm/core/bytes.js +1 -1
- package/dist/esm/core/converter/facade.js +10 -5
- package/dist/esm/core/converter/ream.d.ts +9 -0
- package/dist/esm/core/converter/ream.js +40 -10
- package/dist/esm/core/crypto/asn1.js +2 -2
- package/dist/esm/core/crypto/cms.js +5 -3
- package/dist/esm/core/crypto/index.js +2 -1
- package/dist/esm/core/crypto/offcrypto.d.ts +2 -5
- package/dist/esm/core/crypto/offcrypto.js +9 -15
- package/dist/esm/core/crypto/password-error.d.ts +8 -0
- package/dist/esm/core/crypto/password-error.js +14 -0
- package/dist/esm/core/crypto/primitives.js +16 -16
- package/dist/esm/core/document-model/index.d.ts +1 -1
- package/dist/esm/core/document-model/types.d.ts +174 -2
- package/dist/esm/core/drawingml/chart-geometry.d.ts +24 -6
- package/dist/esm/core/drawingml/chart-geometry.js +905 -208
- package/dist/esm/core/drawingml/chart-parser.d.ts +5 -1
- package/dist/esm/core/drawingml/chart-parser.js +275 -19
- package/dist/esm/core/drawingml/chart-text.d.ts +41 -0
- package/dist/esm/core/drawingml/chart-text.js +93 -0
- package/dist/esm/core/drawingml/colors.js +5 -5
- package/dist/esm/core/drawingml/diagram/layout-engine.js +1 -4
- package/dist/esm/core/drawingml/diagram/run.js +2 -1
- package/dist/esm/core/drawingml/preset-geometry.js +4 -6
- package/dist/esm/core/drawingml/shape-render.js +1 -1
- package/dist/esm/core/drawingml/text-warp.js +4 -16
- package/dist/esm/core/drawingml/theme-parser.js +14 -8
- package/dist/esm/core/font/arabic-joining.js +2 -2
- package/dist/esm/core/font/binary-reader.js +2 -0
- package/dist/esm/core/font/font-registry.js +1 -0
- package/dist/esm/core/font/ligatures.js +1 -1
- package/dist/esm/core/font/opentype-layout.js +11 -5
- package/dist/esm/core/font/ttf-build.js +6 -10
- package/dist/esm/core/font/ttf-parser.js +2 -1
- package/dist/esm/core/font/ttf-subset.js +8 -8
- package/dist/esm/core/fonts/families.js +1 -1
- package/dist/esm/core/fonts/remote-fonts.js +4 -4
- package/dist/esm/core/hyphenation/index.js +1 -1
- package/dist/esm/core/images.js +8 -8
- package/dist/esm/core/ir/adapters.d.ts +9 -0
- package/dist/esm/core/ir/loss.js +1 -0
- package/dist/esm/core/line-breaker/cjk.js +1 -1
- package/dist/esm/core/line-breaker/index.js +4 -3
- package/dist/esm/core/links.js +1 -1
- package/dist/esm/core/lzw.js +1 -1
- package/dist/esm/core/metafile/blit.js +1 -1
- package/dist/esm/core/metafile/emf.js +5 -7
- package/dist/esm/core/metafile/picture.js +1 -1
- package/dist/esm/core/metafile/symbol-fonts.js +7 -7
- package/dist/esm/core/metafile/wmf.js +5 -7
- package/dist/esm/core/number-format.js +4 -6
- package/dist/esm/core/numbering/index.js +3 -2
- package/dist/esm/core/ole/cfb.js +4 -4
- package/dist/esm/core/ole/escher-blip.js +1 -1
- package/dist/esm/core/opc/index.js +5 -4
- package/dist/esm/core/opc/package.js +3 -1
- package/dist/esm/core/opc/xml-entities.js +1 -1
- package/dist/esm/core/outline.js +1 -1
- package/dist/esm/core/png-encode.js +3 -3
- package/dist/esm/core/po-helpers.js +1 -1
- package/dist/esm/core/spreadsheet-model/types.d.ts +6 -0
- package/dist/esm/core/style-cascade/index.js +4 -3
- package/dist/esm/core/tiff.js +3 -1
- package/dist/esm/excel/activex-parser.js +1 -1
- package/dist/esm/excel/conditional-format.js +7 -7
- package/dist/esm/excel/formula/functions.js +8 -4
- package/dist/esm/excel/formula/index.js +3 -3
- package/dist/esm/excel/formula/lexer.js +2 -2
- package/dist/esm/excel/formula/parser.js +4 -3
- package/dist/esm/excel/formula/value.js +1 -1
- package/dist/esm/excel/index.js +7 -6
- package/dist/esm/excel/print-model.d.ts +1 -0
- package/dist/esm/excel/print-model.js +7 -32
- package/dist/esm/excel/printer-settings.js +6 -7
- package/dist/esm/excel/rich-value.js +1 -1
- package/dist/esm/excel/sheet-shape-parser.js +4 -2
- package/dist/esm/excel/sheet-to-flow.d.ts +8 -0
- package/dist/esm/excel/sheet-to-flow.js +14 -11
- package/dist/esm/excel/styles-parser.js +5 -3
- package/dist/esm/excel/tint.js +5 -5
- package/dist/esm/excel/vml-drawing.js +2 -2
- package/dist/esm/excel/worksheet-parser.js +5 -5
- package/dist/esm/excel/xls/biff-chart.js +1 -3
- package/dist/esm/excel/xls/biff-reader.js +10 -11
- package/dist/esm/excel/xls/xls-reader.js +1 -1
- package/dist/esm/excel/xlsx-reader.js +17 -4
- package/dist/esm/excel/xlsx-to-pdf.js +1 -1
- package/dist/esm/excel/xlsx-writer.js +2 -2
- package/dist/esm/html/html-writer.js +18 -10
- package/dist/esm/index.js +2 -1
- package/dist/esm/layout/line-paint.js +1 -1
- package/dist/esm/layout/math-layout.js +5 -8
- package/dist/esm/layout/styled-layout.js +133 -75
- package/dist/esm/layout/turned-section.js +2 -2
- package/dist/esm/markdown/markdown-writer.js +50 -9
- package/dist/esm/pdf/encryption.js +9 -9
- package/dist/esm/pdf/icc-profile.js +2 -2
- package/dist/esm/pdf/index.js +3 -2
- package/dist/esm/pdf/objects.js +7 -0
- package/dist/esm/pdf/serialize.js +1 -1
- package/dist/esm/pdf/struct-tree.js +3 -1
- package/dist/esm/pdf/styled-page-emitter.js +23 -15
- package/dist/esm/pdf/styled-page-renderer.js +9 -5
- package/dist/esm/pdf-reader/annot-draw.js +3 -3
- package/dist/esm/pdf-reader/ccitt.js +2 -1
- package/dist/esm/pdf-reader/cff-outline.js +1 -4
- package/dist/esm/pdf-reader/content.js +13 -15
- package/dist/esm/pdf-reader/decrypt.d.ts +18 -6
- package/dist/esm/pdf-reader/decrypt.js +90 -45
- package/dist/esm/pdf-reader/document.d.ts +7 -1
- package/dist/esm/pdf-reader/document.js +18 -4
- package/dist/esm/pdf-reader/encodings.js +1 -1
- package/dist/esm/pdf-reader/flow-build.js +4 -6
- package/dist/esm/pdf-reader/font.js +3 -3
- package/dist/esm/pdf-reader/function.js +8 -7
- package/dist/esm/pdf-reader/icc.js +1 -1
- package/dist/esm/pdf-reader/images.js +1 -1
- package/dist/esm/pdf-reader/jbig2.js +36 -38
- package/dist/esm/pdf-reader/jpeg.js +14 -13
- package/dist/esm/pdf-reader/layout.js +12 -9
- package/dist/esm/pdf-reader/lexer.js +2 -1
- package/dist/esm/pdf-reader/math-rows.js +2 -2
- package/dist/esm/pdf-reader/optional-content.js +1 -1
- package/dist/esm/pdf-reader/page-numbers.js +1 -1
- package/dist/esm/pdf-reader/pattern-tint.js +1 -2
- package/dist/esm/pdf-reader/reader.d.ts +5 -1
- package/dist/esm/pdf-reader/reader.js +83 -16
- package/dist/esm/pdf-reader/struct-tree.js +1 -1
- package/dist/esm/pdf-reader/tagged.js +3 -2
- package/dist/esm/pdf-reader/text.js +2 -2
- package/dist/esm/pdf-reader/type1-outline.js +1 -3
- package/dist/esm/pptx/embedded-fonts.js +3 -5
- package/dist/esm/pptx/placeholder-cascade.js +1 -1
- package/dist/esm/pptx/ppt/ppt-reader.js +5 -4
- package/dist/esm/pptx/ppt/ppt-text.js +9 -10
- package/dist/esm/pptx/pptx-reader.js +6 -5
- package/dist/esm/pptx/preset-table-styles.js +1 -1
- package/dist/esm/pptx/slide-parser.js +6 -4
- package/dist/esm/pptx/sp-helpers.js +1 -1
- package/dist/esm/pptx/table-style.js +2 -1
- package/dist/esm/svg/svg-writer.js +1 -1
- package/dist/esm/word/doc/doc-reader.js +2 -2
- package/dist/esm/word/doc/doc-text.js +20 -22
- package/dist/esm/word/document-parser.js +26 -21
- package/dist/esm/word/docx-reader.js +2 -2
- package/dist/esm/word/docx-to-pdf.js +3 -3
- package/dist/esm/word/docx-writer.js +10 -6
- package/dist/esm/word/drawing-parser.js +18 -18
- package/dist/esm/word/font-table.js +1 -1
- package/dist/esm/word/index.js +6 -5
- package/dist/esm/word/numbering-parser.js +4 -3
- package/dist/esm/word/omml-parser.js +1 -1
- package/dist/esm/word/paragraph-properties.js +11 -10
- package/dist/esm/word/run-properties.js +4 -4
- package/dist/esm/word/settings-parser.js +2 -1
- package/dist/esm/word/shading.js +1 -1
- package/dist/esm/word/styles-parser.js +5 -4
- package/dist/esm/word/table-parser.js +4 -4
- package/dist/esm/word/theme-fonts.js +1 -1
- package/package.json +9 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { INDEXED_COLORS } from "./indexed-colors.js";
|
|
2
2
|
//#region src/core/number-format.ts
|
|
3
|
-
var BUILTIN = new Map([
|
|
3
|
+
var BUILTIN = /* @__PURE__ */ new Map([
|
|
4
4
|
[0, "General"],
|
|
5
5
|
[1, "0"],
|
|
6
6
|
[2, "0.00"],
|
|
@@ -22,7 +22,7 @@ var BUILTIN = new Map([
|
|
|
22
22
|
[48, "##0.0E+0"],
|
|
23
23
|
[49, "@"]
|
|
24
24
|
]);
|
|
25
|
-
var BUILTIN_DATE_FORMATS = new Map([
|
|
25
|
+
var BUILTIN_DATE_FORMATS = /* @__PURE__ */ new Map([
|
|
26
26
|
[14, "m/d/yyyy"],
|
|
27
27
|
[15, "d-mmm-yy"],
|
|
28
28
|
[16, "d-mmm"],
|
|
@@ -85,7 +85,7 @@ function numberFormatColorHex(rawValue, numFmtId, customFormats) {
|
|
|
85
85
|
if (idx < 0) return void 0;
|
|
86
86
|
return colorOfSection(sections[idx] ?? sections[0]);
|
|
87
87
|
}
|
|
88
|
-
var FORMAT_COLORS = new Map([
|
|
88
|
+
var FORMAT_COLORS = /* @__PURE__ */ new Map([
|
|
89
89
|
["black", "000000"],
|
|
90
90
|
["blue", "0000FF"],
|
|
91
91
|
["cyan", "00FFFF"],
|
|
@@ -463,9 +463,7 @@ function formatExcelDate(rawValue, format, date1904) {
|
|
|
463
463
|
case "s":
|
|
464
464
|
out += t.text.length >= 2 ? pad2(second) : String(second);
|
|
465
465
|
break;
|
|
466
|
-
case "ampm":
|
|
467
|
-
out += ampmLabel(t.text);
|
|
468
|
-
break;
|
|
466
|
+
case "ampm": out += ampmLabel(t.text);
|
|
469
467
|
}
|
|
470
468
|
return out;
|
|
471
469
|
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import "./state.js";
|
|
2
|
-
import "./apply.js";
|
|
1
|
+
import { formatCounter } from "./state.js";
|
|
2
|
+
import { applyNumbering, applyNumberingToHeadersFooters } from "./apply.js";
|
|
3
|
+
export { applyNumbering, applyNumberingToHeadersFooters, formatCounter };
|
package/dist/esm/core/ole/cfb.js
CHANGED
|
@@ -13,7 +13,7 @@ var ENDOFCHAIN = 4294967294;
|
|
|
13
13
|
var FREESECT = 4294967295;
|
|
14
14
|
var HEADER_SIZE = 512;
|
|
15
15
|
var DIR_ENTRY_SIZE = 128;
|
|
16
|
-
var MAX_TOTAL_BYTES =
|
|
16
|
+
var MAX_TOTAL_BYTES = 536870912;
|
|
17
17
|
/** Error thrown for a malformed or unsupported compound file. */
|
|
18
18
|
var CfbError = class extends Error {};
|
|
19
19
|
/**
|
|
@@ -134,7 +134,7 @@ function openCfb(bytes) {
|
|
|
134
134
|
const ensureMini = () => {
|
|
135
135
|
if (miniStream && miniFat) return;
|
|
136
136
|
miniStream = readChainBytes(root.startSector, MAX_TOTAL_BYTES).subarray(0, root.size);
|
|
137
|
-
const mfBytes = firstMiniFatSector === ENDOFCHAIN ? new Uint8Array(0) : readChainBytes(firstMiniFatSector, MAX_TOTAL_BYTES);
|
|
137
|
+
const mfBytes = firstMiniFatSector === ENDOFCHAIN ? /* @__PURE__ */ new Uint8Array(0) : readChainBytes(firstMiniFatSector, MAX_TOTAL_BYTES);
|
|
138
138
|
const mfView = new DataView(mfBytes.buffer, mfBytes.byteOffset, mfBytes.byteLength);
|
|
139
139
|
miniFat = new Uint32Array(Math.floor(mfBytes.length / 4));
|
|
140
140
|
for (let i = 0; i < miniFat.length; i++) miniFat[i] = mfView.getUint32(i * 4, true);
|
|
@@ -159,7 +159,7 @@ function openCfb(bytes) {
|
|
|
159
159
|
return out;
|
|
160
160
|
};
|
|
161
161
|
const readEntry = (entry) => {
|
|
162
|
-
if (entry.size === 0) return new Uint8Array(0);
|
|
162
|
+
if (entry.size === 0) return /* @__PURE__ */ new Uint8Array(0);
|
|
163
163
|
if (entry.size > MAX_TOTAL_BYTES) throw new CfbError("stream exceeds size limit");
|
|
164
164
|
if (entry.size >= miniCutoff) return readChainBytes(entry.startSector, MAX_TOTAL_BYTES).subarray(0, entry.size);
|
|
165
165
|
return readMiniStream(entry);
|
|
@@ -201,4 +201,4 @@ function decodeName(dir, base, nameLen) {
|
|
|
201
201
|
return out;
|
|
202
202
|
}
|
|
203
203
|
//#endregion
|
|
204
|
-
export { isCfb, openCfb };
|
|
204
|
+
export { CfbError, isCfb, openCfb };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import "./relationship-types.js";
|
|
2
|
-
import "./package.js";
|
|
3
|
-
import "./core-properties.js";
|
|
4
|
-
import "./opc-writer.js";
|
|
1
|
+
import { isOoxmlRel } from "./relationship-types.js";
|
|
2
|
+
import { OpcPackage } from "./package.js";
|
|
3
|
+
import { parseCoreProperties } from "./core-properties.js";
|
|
4
|
+
import { buildOpcPackage } from "./opc-writer.js";
|
|
5
|
+
export { OpcPackage, buildOpcPackage, isOoxmlRel, parseCoreProperties };
|
|
@@ -3,13 +3,15 @@ import { isOoxmlRel } from "./relationship-types.js";
|
|
|
3
3
|
import { unzipSync } from "fflate";
|
|
4
4
|
//#region src/core/opc/package.ts
|
|
5
5
|
var ROOT_RELS_PATH = "_rels/.rels";
|
|
6
|
-
var MIB =
|
|
6
|
+
var MIB = 1048576;
|
|
7
7
|
/**
|
|
8
8
|
* An opened OPC package (ECMA-376 Part 2): a ZIP archive's parts plus its
|
|
9
9
|
* package-level relationships, with helpers to look up parts, resolve part
|
|
10
10
|
* relationships, and find the main document part.
|
|
11
11
|
*/
|
|
12
12
|
var OpcPackage = class OpcPackage {
|
|
13
|
+
parts;
|
|
14
|
+
rootRelationships;
|
|
13
15
|
/**
|
|
14
16
|
* @param parts The package parts keyed by ZIP-convention path (no leading slash).
|
|
15
17
|
* @param rootRelationships The package-level relationships from `_rels/.rels`.
|
|
@@ -7,7 +7,7 @@ var DOCTYPE = /<!DOCTYPE\s[^[>]*(?:\[[\s\S]*?\]\s*)?>/y;
|
|
|
7
7
|
var ENTITY_DECL = /<!ENTITY\s+([^\s%<>&;]+)\s+(?:"([^"]*)"|'([^']*)')\s*>/g;
|
|
8
8
|
var REFERENCE = /&([^\s;&<>]+);/g;
|
|
9
9
|
/** The five entities XML predefines; a declaration never overrides them. */
|
|
10
|
-
var PREDEFINED = new Set([
|
|
10
|
+
var PREDEFINED = /* @__PURE__ */ new Set([
|
|
11
11
|
"lt",
|
|
12
12
|
"gt",
|
|
13
13
|
"amp",
|
package/dist/esm/core/outline.js
CHANGED
|
@@ -39,7 +39,7 @@ function encodePng(width, height, color, samples) {
|
|
|
39
39
|
raw.set(samples.subarray(y * stride, y * stride + stride), dst + 1);
|
|
40
40
|
}
|
|
41
41
|
const idat = zlibSync(raw);
|
|
42
|
-
const ihdr = new Uint8Array(13);
|
|
42
|
+
const ihdr = /* @__PURE__ */ new Uint8Array(13);
|
|
43
43
|
writeU32(ihdr, 0, width);
|
|
44
44
|
writeU32(ihdr, 4, height);
|
|
45
45
|
ihdr[8] = 8;
|
|
@@ -51,7 +51,7 @@ function encodePng(width, height, color, samples) {
|
|
|
51
51
|
SIGNATURE,
|
|
52
52
|
chunk("IHDR", ihdr),
|
|
53
53
|
chunk("IDAT", idat),
|
|
54
|
-
chunk("IEND", new Uint8Array(0))
|
|
54
|
+
chunk("IEND", /* @__PURE__ */ new Uint8Array(0))
|
|
55
55
|
]);
|
|
56
56
|
}
|
|
57
57
|
function chunk(type, data) {
|
|
@@ -91,7 +91,7 @@ function concat(parts) {
|
|
|
91
91
|
var crcTable;
|
|
92
92
|
function crc32(bytes) {
|
|
93
93
|
if (!crcTable) {
|
|
94
|
-
crcTable = new Uint32Array(256);
|
|
94
|
+
crcTable = /* @__PURE__ */ new Uint32Array(256);
|
|
95
95
|
for (let n = 0; n < 256; n++) {
|
|
96
96
|
let c = n;
|
|
97
97
|
for (let k = 0; k < 8; k++) c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
|
|
@@ -380,6 +380,12 @@ export interface XlsxFont {
|
|
|
380
380
|
*/
|
|
381
381
|
readonly colorRef?: string;
|
|
382
382
|
readonly name?: string;
|
|
383
|
+
/**
|
|
384
|
+
* §18.8.35 `<scheme>` — the theme font this font stands for, whatever its
|
|
385
|
+
* `name` says. Excel draws such a font in the theme's: a workbook without a
|
|
386
|
+
* theme part writes Calibri this way and is set in Office 2023's Aptos Narrow.
|
|
387
|
+
*/
|
|
388
|
+
readonly scheme?: 'major' | 'minor';
|
|
383
389
|
}
|
|
384
390
|
/** §18.8.20 `<fill>` — one fill record: pattern type plus foreground/background colours. */
|
|
385
391
|
export interface XlsxFill {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import "./types.js";
|
|
2
|
-
import "./resolver.js";
|
|
3
|
-
import "./table.js";
|
|
1
|
+
import { DEFAULT_RESOLVED_PARAGRAPH, DEFAULT_RESOLVED_RUN } from "./types.js";
|
|
2
|
+
import { EMPTY_STYLE_SHEET, resolveBodyStyles, resolveHeadersFootersStyles, resolveParagraphProperties, resolveRunProperties } from "./resolver.js";
|
|
3
|
+
import { resolveTableStyles } from "./table.js";
|
|
4
|
+
export { DEFAULT_RESOLVED_PARAGRAPH, DEFAULT_RESOLVED_RUN, EMPTY_STYLE_SHEET, resolveBodyStyles, resolveHeadersFootersStyles, resolveParagraphProperties, resolveRunProperties, resolveTableStyles };
|
package/dist/esm/core/tiff.js
CHANGED
|
@@ -91,7 +91,7 @@ function decodeTiff(bytes) {
|
|
|
91
91
|
extra: list(ifd, TAG.extraSamples, [])
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
-
var TYPE_SIZE = new Map([
|
|
94
|
+
var TYPE_SIZE = /* @__PURE__ */ new Map([
|
|
95
95
|
[1, 1],
|
|
96
96
|
[2, 1],
|
|
97
97
|
[3, 2],
|
|
@@ -106,6 +106,8 @@ var TYPE_SIZE = new Map([
|
|
|
106
106
|
[12, 8]
|
|
107
107
|
]);
|
|
108
108
|
var Reader = class {
|
|
109
|
+
b;
|
|
110
|
+
le;
|
|
109
111
|
constructor(b, le) {
|
|
110
112
|
this.b = b;
|
|
111
113
|
this.le = le;
|
|
@@ -63,7 +63,7 @@ function strAttr(obj, key) {
|
|
|
63
63
|
const v = obj[`@_${key}`];
|
|
64
64
|
return typeof v === "string" ? v : void 0;
|
|
65
65
|
}
|
|
66
|
-
var ACTIVEX_CLASS_TYPES = new Map([["8BD21D40-EC42-11CE-9E0D-00AA006002F3", "checkbox"], ["8BD21D50-EC42-11CE-9E0D-00AA006002F3", "option"]]);
|
|
66
|
+
var ACTIVEX_CLASS_TYPES = /* @__PURE__ */ new Map([["8BD21D40-EC42-11CE-9E0D-00AA006002F3", "checkbox"], ["8BD21D50-EC42-11CE-9E0D-00AA006002F3", "option"]]);
|
|
67
67
|
/**
|
|
68
68
|
* The affordance key for an `<ax:ocx ax:classid>`, for controls reached through
|
|
69
69
|
* §18.3.1.19 `<control>` rather than `<oleObject progId>` — the `<control>`
|
|
@@ -152,17 +152,16 @@ function buildConditionalFormatter(conditionalFormats, styles, cells, resolveTex
|
|
|
152
152
|
break;
|
|
153
153
|
case "expression":
|
|
154
154
|
if (!textClaimed && compiled && ctx && origin) {
|
|
155
|
-
|
|
155
|
+
const shift = {
|
|
156
156
|
dRow: row - origin.row,
|
|
157
157
|
dCol: col - origin.col,
|
|
158
158
|
curRow: row,
|
|
159
159
|
curCol: col
|
|
160
|
-
}
|
|
160
|
+
};
|
|
161
|
+
if (evaluateToBool(compiled, ctx, shift)) claim(rule);
|
|
161
162
|
}
|
|
162
163
|
break;
|
|
163
|
-
case "timePeriod":
|
|
164
|
-
if (!textClaimed && value !== void 0 && nowSerial !== void 0 && timePeriodMatches(rule.timePeriod, value, nowSerial, date1904)) claim(rule);
|
|
165
|
-
break;
|
|
164
|
+
case "timePeriod": if (!textClaimed && value !== void 0 && nowSerial !== void 0 && timePeriodMatches(rule.timePeriod, value, nowSerial, date1904)) claim(rule);
|
|
166
165
|
}
|
|
167
166
|
}
|
|
168
167
|
if (!bar && !icon) return textFmt;
|
|
@@ -248,7 +247,8 @@ function buildEvalContext(cells, resolveText, nowSerial, date1904, cross) {
|
|
|
248
247
|
const key = rawName.toLowerCase();
|
|
249
248
|
const dn = nameMap.get(key);
|
|
250
249
|
if (!dn || resolving.has(key)) return void 0;
|
|
251
|
-
const
|
|
250
|
+
const value = dn.value.startsWith("=") ? dn.value.slice(1) : dn.value;
|
|
251
|
+
const compiled = compileFormula(value);
|
|
252
252
|
if (!compiled) return void 0;
|
|
253
253
|
const ast = compiled.ast;
|
|
254
254
|
if (ast.k === "num") return num(ast.v);
|
|
@@ -278,7 +278,7 @@ function cellToScalar(cell, resolveText) {
|
|
|
278
278
|
default: return cell.rawValue.length > 0 ? str(cell.rawValue) : BLANK;
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
|
-
var FERRS = new Set([
|
|
281
|
+
var FERRS = /* @__PURE__ */ new Set([
|
|
282
282
|
"#NULL!",
|
|
283
283
|
"#DIV/0!",
|
|
284
284
|
"#VALUE!",
|
|
@@ -463,7 +463,8 @@ function edate(args, ev, ctx, endOfMonth) {
|
|
|
463
463
|
const ty = Math.floor(idx / 12);
|
|
464
464
|
const tm = idx % 12 + 1;
|
|
465
465
|
const dim = daysInMonth(ty, tm);
|
|
466
|
-
const
|
|
466
|
+
const day = endOfMonth ? dim : Math.min(p.day, dim);
|
|
467
|
+
const serial = serialFromYmd(ty, tm, day, ctx.date1904);
|
|
467
468
|
return serial < 0 ? err("#NUM!") : num(serial);
|
|
468
469
|
}
|
|
469
470
|
function daysInMonth(year, month1) {
|
|
@@ -762,7 +763,8 @@ function largeSmall(args, ev, ctx, large) {
|
|
|
762
763
|
if (typeof k !== "number") return err(k.e);
|
|
763
764
|
const ki = Math.trunc(k);
|
|
764
765
|
if (ki < 1 || ki > ns.length) return err("#NUM!");
|
|
765
|
-
|
|
766
|
+
const s = [...ns].sort((a, b) => large ? b - a : a - b);
|
|
767
|
+
return num(s[ki - 1]);
|
|
766
768
|
}
|
|
767
769
|
function countBlank(args, ev, ctx) {
|
|
768
770
|
if (args.length !== 1) return err("#VALUE!");
|
|
@@ -1042,7 +1044,8 @@ function timeFn(args, ev, ctx) {
|
|
|
1042
1044
|
if (typeof m !== "number") return err(m.e);
|
|
1043
1045
|
const s = numArg(args, ev, ctx, 2);
|
|
1044
1046
|
if (typeof s !== "number") return err(s.e);
|
|
1045
|
-
|
|
1047
|
+
const total = Math.trunc(h) * 3600 + Math.trunc(m) * 60 + Math.trunc(s);
|
|
1048
|
+
return num((total % 86400 + 86400) % 86400 / 86400);
|
|
1046
1049
|
}
|
|
1047
1050
|
function weekStartDow(type) {
|
|
1048
1051
|
switch (type) {
|
|
@@ -1074,7 +1077,8 @@ function weekNum(args, ev, ctx, iso) {
|
|
|
1074
1077
|
if (type === 21) return num(isoWeek(serial, ctx.date1904));
|
|
1075
1078
|
const firstDow = weekStartDow(type);
|
|
1076
1079
|
if (firstDow === void 0) return err("#NUM!");
|
|
1077
|
-
const
|
|
1080
|
+
const parts = serialToParts(serial, ctx.date1904);
|
|
1081
|
+
const jan1 = serialFromYmd(parts.year, 1, 1, ctx.date1904);
|
|
1078
1082
|
const offset = (serialToParts(jan1, ctx.date1904).dow - firstDow + 7) % 7;
|
|
1079
1083
|
const dayOfYear = serial - jan1 + 1;
|
|
1080
1084
|
return num(Math.floor((dayOfYear + offset - 1) / 7) + 1);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parse } from "./parser.js";
|
|
2
|
-
import "./dates.js";
|
|
3
|
-
import { toBool } from "./value.js";
|
|
2
|
+
import { serialFromDate, timePeriodMatches } from "./dates.js";
|
|
3
|
+
import { BLANK, bool, err, num, str, toBool, toNumber } from "./value.js";
|
|
4
4
|
import { NO_SHIFT, evaluate } from "./eval.js";
|
|
5
5
|
//#region src/excel/formula/index.ts
|
|
6
6
|
/**
|
|
@@ -30,4 +30,4 @@ function evaluateToBool(compiled, ctx, shift = NO_SHIFT) {
|
|
|
30
30
|
return toBool(evaluate(compiled.ast, ctx, shift), ctx) === true;
|
|
31
31
|
}
|
|
32
32
|
//#endregion
|
|
33
|
-
export { compileFormula, evaluateToBool };
|
|
33
|
+
export { BLANK, NO_SHIFT, bool, compileFormula, err, evaluate, evaluateToBool, num, serialFromDate, str, timePeriodMatches, toNumber };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/excel/formula/lexer.ts
|
|
2
2
|
var MAX_SOURCE = 8192;
|
|
3
|
-
var KNOWN_ERRORS = new Set([
|
|
3
|
+
var KNOWN_ERRORS = /* @__PURE__ */ new Set([
|
|
4
4
|
"#NULL!",
|
|
5
5
|
"#DIV/0!",
|
|
6
6
|
"#VALUE!",
|
|
@@ -211,4 +211,4 @@ function tokenize(src) {
|
|
|
211
211
|
return out;
|
|
212
212
|
}
|
|
213
213
|
//#endregion
|
|
214
|
-
export { tokenize };
|
|
214
|
+
export { LexError, tokenize };
|
|
@@ -16,7 +16,7 @@ var PREC = {
|
|
|
16
16
|
"/": 4,
|
|
17
17
|
"^": 5
|
|
18
18
|
};
|
|
19
|
-
var RIGHT_ASSOC = new Set(["^"]);
|
|
19
|
+
var RIGHT_ASSOC = /* @__PURE__ */ new Set(["^"]);
|
|
20
20
|
var MAX_DEPTH = 64;
|
|
21
21
|
var MAX_ARGS = 255;
|
|
22
22
|
var CELL_RE = /^(\$?)([A-Za-z]{1,3})(\$?)([0-9]{1,7})$/;
|
|
@@ -39,6 +39,7 @@ function parse(src) {
|
|
|
39
39
|
}
|
|
40
40
|
/** A precedence-climbing (Pratt) parser over a {@link tokenize} token stream. */
|
|
41
41
|
var Parser = class {
|
|
42
|
+
toks;
|
|
42
43
|
pos = 0;
|
|
43
44
|
depth = 0;
|
|
44
45
|
/** @param toks The token stream to parse (must end with an `eof` token). */
|
|
@@ -327,7 +328,7 @@ function columnToIndex(letters) {
|
|
|
327
328
|
for (let i = 0; i < up.length; i++) idx = idx * 26 + (up.charCodeAt(i) - 64);
|
|
328
329
|
return idx - 1;
|
|
329
330
|
}
|
|
330
|
-
var AREAS = new Map([
|
|
331
|
+
var AREAS = /* @__PURE__ */ new Map([
|
|
331
332
|
["#all", "#All"],
|
|
332
333
|
["#data", "#Data"],
|
|
333
334
|
["#headers", "#Headers"],
|
|
@@ -419,4 +420,4 @@ function unescapeName(name) {
|
|
|
419
420
|
return name.trim().replace(/'(.)/g, "$1");
|
|
420
421
|
}
|
|
421
422
|
//#endregion
|
|
422
|
-
export { parse };
|
|
423
|
+
export { ParseError, parse, parseStructuredRef };
|
|
@@ -129,4 +129,4 @@ function numToText(n) {
|
|
|
129
129
|
return String(n);
|
|
130
130
|
}
|
|
131
131
|
//#endregion
|
|
132
|
-
export { BLANK, arrEach, bool, deref, err, isErr, num, refEach, refGet, str, toBool, toNumber, toText };
|
|
132
|
+
export { BLANK, FALSE, TRUE, arrEach, bool, deref, err, isErr, num, refEach, refGet, str, toBool, toNumber, toText };
|
package/dist/esm/excel/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import "../core/number-format.js";
|
|
1
|
+
import { applyNumberFormat, generalToWidth, numberFormatColorHex } from "../core/number-format.js";
|
|
2
2
|
import "./cell-reference.js";
|
|
3
|
-
import "./defined-name-ref.js";
|
|
4
|
-
import "./shared-strings-parser.js";
|
|
5
|
-
import "./workbook-parser.js";
|
|
6
|
-
import "./styles-parser.js";
|
|
7
|
-
import "./worksheet-parser.js";
|
|
3
|
+
import { parseAreaRef, parseTitleRowRange } from "./defined-name-ref.js";
|
|
4
|
+
import { parseSharedStrings } from "./shared-strings-parser.js";
|
|
5
|
+
import { parseWorkbook } from "./workbook-parser.js";
|
|
6
|
+
import { EMPTY_XLSX_STYLES, parseXlsxStyles } from "./styles-parser.js";
|
|
7
|
+
import { parseWorksheet } from "./worksheet-parser.js";
|
|
8
|
+
export { EMPTY_XLSX_STYLES, applyNumberFormat, generalToWidth, numberFormatColorHex, parseAreaRef, parseSharedStrings, parseTitleRowRange, parseWorkbook, parseWorksheet, parseXlsxStyles };
|
|
@@ -123,6 +123,7 @@ export declare function printableHeightPt(worksheet: ParsedWorksheet): number;
|
|
|
123
123
|
interface PrintModelOptions {
|
|
124
124
|
readonly screen?: boolean;
|
|
125
125
|
readonly image?: boolean;
|
|
126
|
+
readonly spill?: boolean;
|
|
126
127
|
readonly printArea?: CellRange;
|
|
127
128
|
readonly gridLines: boolean;
|
|
128
129
|
readonly titleRows?: {
|
|
@@ -233,7 +233,7 @@ var EXCEL_DEFAULT_ROW_HEIGHT_PT = 15;
|
|
|
233
233
|
* and every one of its rows is 12.75pt: tdf100709.xlsx fits twenty of them on
|
|
234
234
|
* the page where our 15pt fitted fourteen and pushed the rest onto a second.
|
|
235
235
|
*/
|
|
236
|
-
var EXCEL_ROW_HEIGHT_BY_FONT_PT = new Map([
|
|
236
|
+
var EXCEL_ROW_HEIGHT_BY_FONT_PT = /* @__PURE__ */ new Map([
|
|
237
237
|
[8, 11],
|
|
238
238
|
[9, 12],
|
|
239
239
|
[10, 12.75],
|
|
@@ -257,7 +257,7 @@ function defaultRowHeightPtFor(fontPt) {
|
|
|
257
257
|
}
|
|
258
258
|
var TWIPS_PER_POINT = 20;
|
|
259
259
|
var TWIPS_PER_INCH = 1440;
|
|
260
|
-
var PAPER_SIZES_TWIPS = new Map([
|
|
260
|
+
var PAPER_SIZES_TWIPS = /* @__PURE__ */ new Map([
|
|
261
261
|
[1, [12240, 15840]],
|
|
262
262
|
[3, [15840, 24480]],
|
|
263
263
|
[5, [12240, 20160]],
|
|
@@ -886,7 +886,7 @@ function gridBody(worksheet, sharedStrings, styles, date1904, print) {
|
|
|
886
886
|
if (over) {
|
|
887
887
|
if (over.fillHex) shading = { colorHex: over.fillHex };
|
|
888
888
|
if (over.dataBar) dataBar = over.dataBar;
|
|
889
|
-
if (over.numberFormat !== void 0 && ws.type === "n" && ws.rawValue.length > 0) text = applyNumberFormat(ws.rawValue, CF_NUMBER_FORMAT_ID, new Map([[CF_NUMBER_FORMAT_ID, over.numberFormat]]), date1904);
|
|
889
|
+
if (over.numberFormat !== void 0 && ws.type === "n" && ws.rawValue.length > 0) text = applyNumberFormat(ws.rawValue, CF_NUMBER_FORMAT_ID, /* @__PURE__ */ new Map([[CF_NUMBER_FORMAT_ID, over.numberFormat]]), date1904);
|
|
890
890
|
if (over.hideValue) text = "";
|
|
891
891
|
if (over.icon) icon = over.icon;
|
|
892
892
|
if (over.border) borders = {
|
|
@@ -903,24 +903,18 @@ function gridBody(worksheet, sharedStrings, styles, date1904, print) {
|
|
|
903
903
|
const rotation = xf?.alignment?.textRotation;
|
|
904
904
|
const rotated = rotation !== void 0 && rotation !== 0 && text.length > 0;
|
|
905
905
|
const shrinkToFit = xf?.alignment?.shrinkToFit === true && !wrapText && !rotated;
|
|
906
|
-
if (text.length > 0 && !merge && !wrapText && !rotated && !shrinkToFit && ws && (ws.type === "s" || ws.type === "str" || ws.type === "inlineStr") && (flow === "left" || flow === "center") && estimateChars(text) * charTwips(xf, styles, textTwipsUnit) > columnWidths[c]) {
|
|
907
|
-
let availTwips = columnWidths[c];
|
|
906
|
+
if (print.spill !== false && text.length > 0 && !merge && !wrapText && !rotated && !shrinkToFit && ws && (ws.type === "s" || ws.type === "str" || ws.type === "inlineStr") && (flow === "left" || flow === "center") && estimateChars(text) * charTwips(xf, styles, textTwipsUnit) > columnWidths[c]) {
|
|
908
907
|
let cc = c + 1;
|
|
909
908
|
const neighbourIsFree = (col) => !cellHasContent(cellMatrix[r]?.[col]) && !insideMerge.has(key(absR, col + colStart)) && !mergeOrigins.has(key(absR, col + colStart)) && (!cellPaintsSomething(cellMatrix[r]?.[col], styles) || spanPreservesPaint(cellMatrix[r]?.[col], styles, shading, borders)) && !sparklineByCell.has(key(absR, col + colStart)) && !(dropdownRanges.length > 0 && rangesCover(dropdownRanges, absR, col + colStart));
|
|
910
909
|
const bandEnd = bandEndOfCol.get(c) ?? colCount - 1;
|
|
911
|
-
while (cc <= bandEnd && (hiddenCols.has(cc) || neighbourIsFree(cc)))
|
|
912
|
-
if (!hiddenCols.has(cc)) availTwips += columnWidths[cc];
|
|
913
|
-
cc++;
|
|
914
|
-
}
|
|
910
|
+
while (cc <= bandEnd && (hiddenCols.has(cc) || neighbourIsFree(cc))) cc++;
|
|
915
911
|
if (cc <= bandEnd && !cellHasContent(cellMatrix[r]?.[cc]) && !sparklineByCell.has(key(absR, cc + colStart)) && !(dropdownRanges.length > 0 && rangesCover(dropdownRanges, absR, cc + colStart))) {
|
|
916
912
|
const rule = absorbableRightRule(cellMatrix[r]?.[cc], styles, shading, borders);
|
|
917
913
|
if (rule) {
|
|
918
|
-
availTwips += columnWidths[cc];
|
|
919
914
|
overflowRightRule = rule;
|
|
920
915
|
cc++;
|
|
921
916
|
}
|
|
922
917
|
}
|
|
923
|
-
text = clipToWidth(text, availTwips * 1.1, charTwips(xf, styles, textTwipsUnit));
|
|
924
918
|
if (cc > c + 1) {
|
|
925
919
|
overflowSpan = 0;
|
|
926
920
|
for (let k = c; k < cc; k++) if (!hiddenCols.has(k)) overflowSpan++;
|
|
@@ -932,11 +926,6 @@ function gridBody(worksheet, sharedStrings, styles, date1904, print) {
|
|
|
932
926
|
paintColumns++;
|
|
933
927
|
}
|
|
934
928
|
}
|
|
935
|
-
} else if (text.length > 0 && merge && !wrapText && !rotated && !shrinkToFit) {
|
|
936
|
-
const lastCol = Math.min(merge.endColumn - colStart, bandEndOfCol.get(c) ?? colCount - 1);
|
|
937
|
-
let availTwips = 0;
|
|
938
|
-
for (let k = c; k <= lastCol; k++) if (!hiddenCols.has(k)) availTwips += columnWidths[k] ?? 0;
|
|
939
|
-
text = clipToWidth(text, availTwips * 1.1, charTwips(xf, styles, textTwipsUnit));
|
|
940
929
|
}
|
|
941
930
|
if (shrinkToFit && ws && text.length > 0) {
|
|
942
931
|
const drawnTwips = estimateChars(text) / charWidthUnits("0") * charTwips(xf, styles, textTwipsUnit);
|
|
@@ -1004,7 +993,7 @@ function gridBody(worksheet, sharedStrings, styles, date1904, print) {
|
|
|
1004
993
|
runs
|
|
1005
994
|
}
|
|
1006
995
|
}));
|
|
1007
|
-
if (text.length > 0 && !merge && !wrapText && !rotated && !shrinkToFit && c > 0 && flow === "right" && estimateChars(text) * charTwips(xf, styles, textTwipsUnit) > columnWidths[c]) leftOverflow.push({
|
|
996
|
+
if (print.spill !== false && text.length > 0 && !merge && !wrapText && !rotated && !shrinkToFit && c > 0 && flow === "right" && estimateChars(text) * charTwips(xf, styles, textTwipsUnit) > columnWidths[c]) leftOverflow.push({
|
|
1008
997
|
index: cells.length,
|
|
1009
998
|
column: c,
|
|
1010
999
|
needTwips: estimateChars(text) * charTwips(xf, styles, textTwipsUnit) - columnWidths[c],
|
|
@@ -1998,20 +1987,6 @@ function estimateChars(text) {
|
|
|
1998
1987
|
for (const ch of text) n += charWidthUnits(ch);
|
|
1999
1988
|
return n;
|
|
2000
1989
|
}
|
|
2001
|
-
/** The longest prefix of `text` that fits `availTwips`, by the same estimate. */
|
|
2002
|
-
function clipToWidth(text, availTwips, perChar) {
|
|
2003
|
-
if (perChar <= 0) return text;
|
|
2004
|
-
const budget = availTwips / perChar;
|
|
2005
|
-
let used = 0;
|
|
2006
|
-
let i = 0;
|
|
2007
|
-
for (const ch of text) {
|
|
2008
|
-
const w = charWidthUnits(ch);
|
|
2009
|
-
if (used + w > budget) break;
|
|
2010
|
-
used += w;
|
|
2011
|
-
i += ch.length;
|
|
2012
|
-
}
|
|
2013
|
-
return i >= text.length ? text : text.slice(0, Math.max(1, i));
|
|
2014
|
-
}
|
|
2015
1990
|
/**
|
|
2016
1991
|
* Widen each right-aligned cell that overflows leftwards over the free columns
|
|
2017
1992
|
* before it, deleting the cells those columns produced.
|
|
@@ -2258,4 +2233,4 @@ function slicerParagraph(text, runProps) {
|
|
|
2258
2233
|
};
|
|
2259
2234
|
}
|
|
2260
2235
|
//#endregion
|
|
2261
|
-
export { cellPaintsVisibly, columnTwips, columnUnitTwips, defaultColumnTwips, noteKey, printableHeightPt, printableWidthPt, resolveCellText, resolvePrintArea, resolvePrintTitleRows, sectionFromWorksheet, slicerTable, worksheetToBody };
|
|
2236
|
+
export { cellPaintsSomething, cellPaintsVisibly, columnTwips, columnUnitTwips, defaultColumnTwips, defaultRowHeightPtFor, noteKey, printableHeightPt, printableWidthPt, resolveCellText, resolvePrintArea, resolvePrintTitleRows, sectionFromWorksheet, slicerTable, worksheetToBody };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
//#region src/excel/printer-settings.ts
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var OFFSET_PAPER_SIZE = DEVICE_NAME_BYTES + 14;
|
|
2
|
+
var OFFSET_SIZE = 68;
|
|
3
|
+
var OFFSET_ORIENTATION = 76;
|
|
4
|
+
var OFFSET_PAPER_SIZE = 78;
|
|
6
5
|
var DM_ORIENTATION = 1;
|
|
7
6
|
var DM_PAPERSIZE = 2;
|
|
8
7
|
/**
|
|
@@ -15,11 +14,11 @@ var DM_PAPERSIZE = 2;
|
|
|
15
14
|
* @param data The raw part bytes.
|
|
16
15
|
*/
|
|
17
16
|
function parsePrinterSettings(data) {
|
|
18
|
-
if (data.byteLength <
|
|
17
|
+
if (data.byteLength < 80) return {};
|
|
19
18
|
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
20
19
|
const dmSize = view.getUint16(OFFSET_SIZE, true);
|
|
21
|
-
if (dmSize <
|
|
22
|
-
const fields = view.getUint32(
|
|
20
|
+
if (dmSize < 80 || dmSize > data.byteLength) return {};
|
|
21
|
+
const fields = view.getUint32(72, true);
|
|
23
22
|
const out = {};
|
|
24
23
|
if (fields & DM_PAPERSIZE) {
|
|
25
24
|
const paper = view.getInt16(OFFSET_PAPER_SIZE, true);
|
|
@@ -21,7 +21,7 @@ var RICH_VALUE_TYPE = "XLRICHVALUE";
|
|
|
21
21
|
* error is worse than the stand-in the file already provides, so an unmapped
|
|
22
22
|
* code resolves to nothing.
|
|
23
23
|
*/
|
|
24
|
-
var ERROR_TYPES = new Map([[8, "#SPILL!"]]);
|
|
24
|
+
var ERROR_TYPES = /* @__PURE__ */ new Map([[8, "#SPILL!"]]);
|
|
25
25
|
function nodes(parent, name) {
|
|
26
26
|
if (typeof parent !== "object" || parent === null) return [];
|
|
27
27
|
const child = parent[name];
|
|
@@ -148,7 +148,8 @@ function parseDiagramFrames(drawingXml, worksheet, colUnitTwips) {
|
|
|
148
148
|
if (!ANCHOR_KINDS.some((k) => poIs(anchor, k))) continue;
|
|
149
149
|
const frame = poChildren(anchor).find((c) => poIs(c, "xdr:graphicFrame"));
|
|
150
150
|
if (!frame) continue;
|
|
151
|
-
|
|
151
|
+
const data = poFirstChild(poFirstChild(frame, "a:graphic"), "a:graphicData");
|
|
152
|
+
if (!poFirstChild(data, "dgm:relIds")) continue;
|
|
152
153
|
const box = anchorBox(anchor, colWidthPt, rowHeightPt);
|
|
153
154
|
if (box) out.push(box);
|
|
154
155
|
}
|
|
@@ -340,9 +341,10 @@ function styleLine(sp, ns, colors, themeLineWidths) {
|
|
|
340
341
|
const colorHex = child ? resolveColorNode(child, colors) : void 0;
|
|
341
342
|
if (colorHex === void 0) return void 0;
|
|
342
343
|
const idx = Number(poAttr(lnRef, "idx") ?? "");
|
|
344
|
+
const width = Number.isFinite(idx) ? themeLineWidths[idx - 1] : void 0;
|
|
343
345
|
return {
|
|
344
346
|
colorHex,
|
|
345
|
-
width: pt(
|
|
347
|
+
width: pt(width ?? .75)
|
|
346
348
|
};
|
|
347
349
|
}
|
|
348
350
|
/**
|
|
@@ -69,6 +69,14 @@ export interface ProjectSheetOptions {
|
|
|
69
69
|
* on it (`fitPagesToContent`). The SVG target asks for this.
|
|
70
70
|
*/
|
|
71
71
|
readonly wholeSheetPages?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Let a cell's text run on over its empty neighbours, as a printed or shown
|
|
74
|
+
* sheet does — modelled as a span from the cell over them. On by default.
|
|
75
|
+
* Off for a medium that keeps cells and not widths: markdown has no column
|
|
76
|
+
* for text to run on into, and a spill to the LEFT moved a right-aligned
|
|
77
|
+
* label into the column before its own.
|
|
78
|
+
*/
|
|
79
|
+
readonly spill?: boolean;
|
|
72
80
|
}
|
|
73
81
|
/**
|
|
74
82
|
* Project a {@link SheetDoc} into a {@link FlowDoc} (E-SHEET SA2): each grid sheet
|
|
@@ -82,6 +82,7 @@ function projectSheetDoc(sheet, options = {}) {
|
|
|
82
82
|
const titleRows = screen ? void 0 : resolvePrintTitleRows(sheet.definedNames, sheetIdx);
|
|
83
83
|
const gridBody = worksheetToBody(ws.grid, sheet.sharedStrings, sheet.styles, sheet.date1904, {
|
|
84
84
|
...screen ? { screen } : {},
|
|
85
|
+
...options.spill === false ? { spill: false } : {},
|
|
85
86
|
...screen && options.wholeSheetPages === true ? { image: true } : {},
|
|
86
87
|
...printArea ? { printArea } : {},
|
|
87
88
|
...titleRows ? { titleRows } : {},
|
|
@@ -193,21 +194,23 @@ function projectSheetDoc(sheet, options = {}) {
|
|
|
193
194
|
table: slicerTable(slicer)
|
|
194
195
|
});
|
|
195
196
|
const listComments = !screen && ws.grid.pageSetup?.cellComments === "atEnd";
|
|
196
|
-
if (ws.comments && ws.comments.length > 0)
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
feature: "comments",
|
|
200
|
-
detail: `${ws.comments.length} cell note(s) not printed — <pageSetup cellComments> is "${ws.grid.pageSetup?.cellComments ?? "none"}"`,
|
|
201
|
-
where: `sheet "${ws.name}"`
|
|
202
|
-
});
|
|
203
|
-
else {
|
|
204
|
-
const hidden = ws.comments.filter((c) => c.shown === void 0).length;
|
|
205
|
-
if (hidden > 0) options.losses?.push({
|
|
197
|
+
if (ws.comments && ws.comments.length > 0) {
|
|
198
|
+
if (listComments) body.push(...commentBlocks(ws.comments));
|
|
199
|
+
else if (!notesShown) options.losses?.push({
|
|
206
200
|
severity: "dropped",
|
|
207
201
|
feature: "comments",
|
|
208
|
-
detail:
|
|
202
|
+
detail: `${ws.comments.length} cell note(s) not printed — <pageSetup cellComments> is "${ws.grid.pageSetup?.cellComments ?? "none"}"`,
|
|
209
203
|
where: `sheet "${ws.name}"`
|
|
210
204
|
});
|
|
205
|
+
else {
|
|
206
|
+
const hidden = ws.comments.filter((c) => c.shown === void 0).length;
|
|
207
|
+
if (hidden > 0) options.losses?.push({
|
|
208
|
+
severity: "dropped",
|
|
209
|
+
feature: "comments",
|
|
210
|
+
detail: screen ? `${hidden} cell note(s) not shown — a hidden note shows only while its cell is pointed at` : `${hidden} cell note(s) not printed — "asDisplayed" prints the notes the sheet shows`,
|
|
211
|
+
where: `sheet "${ws.name}"`
|
|
212
|
+
});
|
|
213
|
+
}
|
|
211
214
|
}
|
|
212
215
|
if (ws.formControls && ws.formControls.length > 0) body.push(...formControlBlocks(ws.formControls));
|
|
213
216
|
if (ws.activeXControls && ws.activeXControls.length > 0) body.push(...activeXBlocks(ws.activeXControls));
|