doc-codec 2.4.3 → 2.6.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 +53 -20
- package/dist/chp-B6AOh85P.d.ts +18 -0
- package/dist/chp-BpCqpb7V.d.cts +18 -0
- package/dist/detect.cjs +3 -0
- package/dist/detect.d.cts +3 -1
- package/dist/detect.d.ts +3 -1
- package/dist/detect.js +3 -1
- package/dist/encryption.cjs +44 -10
- package/dist/encryption.d.cts +2 -2
- package/dist/encryption.d.ts +2 -2
- package/dist/encryption.js +45 -11
- package/dist/fib/fib.cjs +14 -0
- package/dist/fib/fib.d.cts +1 -1
- package/dist/fib/fib.d.ts +1 -1
- package/dist/fib/fib.js +14 -0
- package/dist/fib/offsets.cjs +14 -0
- package/dist/fib/offsets.d.cts +14 -0
- package/dist/fib/offsets.d.ts +14 -0
- package/dist/fib/offsets.js +14 -0
- package/dist/{fib-DWFta19r.d.cts → fib-6BFIx153.d.cts} +14 -0
- package/dist/{fib-DWFta19r.d.ts → fib-6BFIx153.d.ts} +14 -0
- package/dist/fkp-I-laf-8y.d.cts +33 -0
- package/dist/fkp-I-laf-8y.d.ts +33 -0
- package/dist/headers-footers.cjs +34 -0
- package/dist/headers-footers.d.cts +16 -0
- package/dist/headers-footers.d.ts +16 -0
- package/dist/headers-footers.js +33 -0
- package/dist/index.cjs +20 -9
- package/dist/index.d.cts +16 -12
- package/dist/index.d.ts +16 -12
- package/dist/index.js +15 -11
- package/dist/list/numbering-write.d.cts +1 -1
- package/dist/list/numbering-write.d.ts +1 -1
- package/dist/list/numbering.d.cts +23 -1
- package/dist/list/numbering.d.ts +23 -1
- package/dist/notes.cjs +26 -0
- package/dist/notes.d.cts +20 -0
- package/dist/notes.d.ts +20 -0
- package/dist/notes.js +25 -0
- package/dist/{pap-BT1p0uzu.d.cts → pap-BQ2E17K9.d.cts} +5 -3
- package/dist/{pap-DOFLMWcG.d.ts → pap-iWFIpCdo.d.ts} +5 -3
- package/dist/paragraphs-DQUp8_HB.d.cts +31 -0
- package/dist/paragraphs-s2lJ6w2I.d.ts +31 -0
- package/dist/pictures.cjs +93 -0
- package/dist/pictures.d.cts +6 -0
- package/dist/pictures.d.ts +6 -0
- package/dist/pictures.js +92 -0
- package/dist/piece-table-CA18mhjv.d.cts +28 -0
- package/dist/piece-table-CA18mhjv.d.ts +28 -0
- package/dist/prop/chp.d.cts +1 -17
- package/dist/prop/chp.d.ts +1 -17
- package/dist/prop/fkp.d.cts +1 -32
- package/dist/prop/fkp.d.ts +1 -32
- package/dist/prop/pap.cjs +4 -2
- package/dist/prop/pap.d.cts +1 -1
- package/dist/prop/pap.d.ts +1 -1
- package/dist/prop/pap.js +4 -2
- package/dist/prop/sep.cjs +20 -10
- package/dist/prop/sep.d.cts +8 -4
- package/dist/prop/sep.d.ts +8 -4
- package/dist/prop/sep.js +20 -10
- package/dist/read.cjs +48 -153
- package/dist/read.d.cts +13 -15
- package/dist/read.d.ts +13 -15
- package/dist/read.js +51 -156
- package/dist/stsh-Bj0YSEOp.d.ts +40 -0
- package/dist/stsh-CK59x6XG.d.cts +40 -0
- package/dist/style/stsh.d.cts +1 -39
- package/dist/style/stsh.d.ts +1 -39
- package/dist/subdocument.cjs +20 -0
- package/dist/subdocument.d.cts +8 -0
- package/dist/subdocument.d.ts +8 -0
- package/dist/subdocument.js +18 -0
- package/dist/table/read.cjs +31 -17
- package/dist/table/read.d.cts +1 -1
- package/dist/table/read.d.ts +1 -1
- package/dist/table/read.js +32 -18
- package/dist/text/characters.d.cts +1 -1
- package/dist/text/characters.d.ts +1 -1
- package/dist/text/paragraphs.cjs +189 -0
- package/dist/text/paragraphs.d.cts +2 -0
- package/dist/text/paragraphs.d.ts +2 -0
- package/dist/text/paragraphs.js +187 -0
- package/dist/text/piece-table.d.cts +1 -27
- package/dist/text/piece-table.d.ts +1 -27
- package/dist/write.cjs +3 -3
- package/dist/write.js +3 -3
- package/package.json +2 -2
- package/dist/numbering-DSpm9w6y.d.cts +0 -24
- package/dist/numbering-DayjnHXY.d.ts +0 -24
package/dist/read.js
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import { DocFormatError
|
|
1
|
+
import { DocFormatError } from "./errors.js";
|
|
2
2
|
import { slice } from "./bytes.js";
|
|
3
|
-
import { SUMMARY_INFORMATION_STREAM, WORD_DOCUMENT_STREAM } from "./detect.js";
|
|
3
|
+
import { DATA_STREAM, SUMMARY_INFORMATION_STREAM, WORD_DOCUMENT_STREAM } from "./detect.js";
|
|
4
4
|
import { decryptDocStreams } from "./encryption.js";
|
|
5
|
-
import {
|
|
5
|
+
import { PropertyBinTable } from "./prop/fkp.js";
|
|
6
|
+
import { parseStsh } from "./style/stsh.js";
|
|
7
|
+
import { readParagraphs } from "./text/paragraphs.js";
|
|
6
8
|
import { parseClx } from "./text/piece-table.js";
|
|
7
9
|
import { readTextRange } from "./text/characters.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { applyParagraphSprms } from "./prop/pap.js";
|
|
13
|
-
import { readSectionProperties } from "./prop/sep.js";
|
|
14
|
-
import { headingLevelFromIstd, parseStsh, resolveStyleFormatting } from "./style/stsh.js";
|
|
10
|
+
import { assembleBlocks } from "./table/read.js";
|
|
11
|
+
import { readHeaderFooterStories } from "./headers-footers.js";
|
|
12
|
+
import { parseFib, peekFibBaseFlags } from "./fib/fib.js";
|
|
13
|
+
import { readAllSectionProperties } from "./prop/sep.js";
|
|
15
14
|
import { parseFontTable } from "./style/fonts.js";
|
|
16
15
|
import { readNumberingDefinitions } from "./list/numbering.js";
|
|
17
|
-
import {
|
|
16
|
+
import { readNoteBodies } from "./notes.js";
|
|
18
17
|
import { readCompoundFile, readSummaryInformation, summaryInformationToLayoutMetadata } from "archive-codec";
|
|
19
18
|
//#region src/read.ts
|
|
20
|
-
/** Word's own default for a new document (US Letter, one-inch margins) -- what a field this reader resolves from PlcfSed/Sepx (prop/sep.ts's
|
|
19
|
+
/** Word's own default for a new document (US Letter, one-inch margins) -- what a field this reader resolves from PlcfSed/Sepx (prop/sep.ts's readAllSectionProperties) falls back to when the file states nothing for it, exactly as it would fall back to Word's own implementation-dependent default for that one unstated sprm. */
|
|
21
20
|
const DEFAULT_PAGE_SIZE = {
|
|
22
21
|
widthPt: 612,
|
|
23
22
|
heightPt: 792
|
|
@@ -39,177 +38,73 @@ function readDocStreams(bytes, password) {
|
|
|
39
38
|
let wordDocument = wordDocumentStream.bytes;
|
|
40
39
|
let table = tableStream.bytes;
|
|
41
40
|
if (flags.fEncrypted) {
|
|
42
|
-
|
|
43
|
-
const decrypted = decryptDocStreams(wordDocument, table, password);
|
|
41
|
+
const decrypted = decryptDocStreams(wordDocument, table, password, flags.fObfuscated);
|
|
44
42
|
wordDocument = decrypted.wordDocument;
|
|
45
43
|
table = decrypted.table;
|
|
46
44
|
}
|
|
47
45
|
const fib = parseFib(wordDocument);
|
|
48
46
|
const metadata = streams.find((stream) => stream.path === SUMMARY_INFORMATION_STREAM);
|
|
47
|
+
const data = streams.find((stream) => stream.path === DATA_STREAM);
|
|
49
48
|
return {
|
|
50
49
|
wordDocument,
|
|
51
50
|
table,
|
|
52
51
|
fib,
|
|
53
|
-
metadata: metadata?.bytes
|
|
52
|
+
metadata: metadata?.bytes,
|
|
53
|
+
data: data?.bytes
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
function readDocContent(bytes, password) {
|
|
57
|
-
const { wordDocument, table, fib, metadata } = readDocStreams(bytes, password);
|
|
57
|
+
const { wordDocument, table, fib, metadata, data } = readDocStreams(bytes, password);
|
|
58
58
|
const pieceTable = parseClx(slice(table, fib.fcClx, fib.lcbClx, "Clx in the Table stream"));
|
|
59
59
|
const styles = fib.lcbStshf > 0 ? parseStsh(slice(table, fib.fcStshf, fib.lcbStshf, "STSH in the Table stream")) : void 0;
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const range = readTextRange(wordDocument, pieceTable, 0, fib.ccpText);
|
|
64
|
-
const entries = readParagraphs(range.text, range.fcs, {
|
|
65
|
-
chpxTable,
|
|
66
|
-
papxTable,
|
|
60
|
+
const context = {
|
|
61
|
+
chpxTable: new PropertyBinTable(wordDocument, slice(table, fib.fcPlcfBteChpx, fib.lcbPlcfBteChpx, "PlcBteChpx in the Table stream"), "PlcBteChpx"),
|
|
62
|
+
papxTable: new PropertyBinTable(wordDocument, slice(table, fib.fcPlcfBtePapx, fib.lcbPlcfBtePapx, "PlcBtePapx in the Table stream"), "PlcBtePapx"),
|
|
67
63
|
styles,
|
|
68
|
-
|
|
64
|
+
dataStream: data,
|
|
65
|
+
fonts: fib.lcbSttbfFfn > 0 ? parseFontTable(slice(table, fib.fcSttbfFfn, fib.lcbSttbfFfn, "SttbfFfn in the Table stream")) : void 0,
|
|
69
66
|
characterProperties: /* @__PURE__ */ new Map()
|
|
70
|
-
}
|
|
71
|
-
const
|
|
67
|
+
};
|
|
68
|
+
const range = readTextRange(wordDocument, pieceTable, 0, fib.ccpText);
|
|
69
|
+
const entries = readParagraphs(range.text, range.fcs, context);
|
|
72
70
|
const numbering = readNumberingDefinitions(table, fib);
|
|
73
|
-
const sectionProperties =
|
|
71
|
+
const sectionProperties = readAllSectionProperties(wordDocument, table, fib);
|
|
72
|
+
const entriesBySection = splitIntoSections(entries, sectionProperties);
|
|
73
|
+
const { footnotes, endnotes, comments } = readNoteBodies(wordDocument, table, pieceTable, context, fib);
|
|
74
|
+
const headerFooterStories = readHeaderFooterStories(wordDocument, table, pieceTable, context, fib, sectionProperties.length);
|
|
74
75
|
return {
|
|
75
76
|
kind: "wordprocessing",
|
|
76
77
|
metadata: metadata === void 0 ? {} : summaryInformationToLayoutMetadata(readSummaryInformation(metadata)),
|
|
77
|
-
sections:
|
|
78
|
+
sections: sectionProperties.map((properties, index) => ({
|
|
78
79
|
pageSize: {
|
|
79
|
-
widthPt:
|
|
80
|
-
heightPt:
|
|
80
|
+
widthPt: properties.pageWidthPt ?? DEFAULT_PAGE_SIZE.widthPt,
|
|
81
|
+
heightPt: properties.pageHeightPt ?? DEFAULT_PAGE_SIZE.heightPt
|
|
81
82
|
},
|
|
82
83
|
margins: {
|
|
83
|
-
leftPt:
|
|
84
|
-
rightPt:
|
|
85
|
-
topPt:
|
|
86
|
-
bottomPt:
|
|
84
|
+
leftPt: properties.marginLeftPt ?? DEFAULT_MARGINS.leftPt,
|
|
85
|
+
rightPt: properties.marginRightPt ?? DEFAULT_MARGINS.rightPt,
|
|
86
|
+
topPt: properties.marginTopPt ?? DEFAULT_MARGINS.topPt,
|
|
87
|
+
bottomPt: properties.marginBottomPt ?? DEFAULT_MARGINS.bottomPt
|
|
87
88
|
},
|
|
88
|
-
blocks
|
|
89
|
-
}
|
|
90
|
-
numbering
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
let start = 0;
|
|
96
|
-
for (let index = 0; index < text.length; index += 1) {
|
|
97
|
-
const code = text.charCodeAt(index);
|
|
98
|
-
if (!endsParagraph(code)) continue;
|
|
99
|
-
const markFc = fcs[index];
|
|
100
|
-
if (markFc === void 0) throw new DocFormatError(`character ${index} has no byte offset, so its paragraph's properties cannot be located`);
|
|
101
|
-
entries.push(buildParagraph(text.slice(start, index), fcs.slice(start, index), markFc, code, context));
|
|
102
|
-
start = index + 1;
|
|
103
|
-
}
|
|
104
|
-
if (start < text.length) {
|
|
105
|
-
const firstFc = fcs[start];
|
|
106
|
-
if (firstFc === void 0) throw new DocFormatError(`character ${start} has no byte offset, so the trailing paragraph's properties cannot be located`);
|
|
107
|
-
entries.push(buildParagraph(text.slice(start), fcs.slice(start), firstFc, 13, context));
|
|
108
|
-
}
|
|
109
|
-
return entries;
|
|
110
|
-
}
|
|
111
|
-
function buildParagraph(text, fcs, propertyFc, terminator, context) {
|
|
112
|
-
const papx = context.papxTable.papx(propertyFc);
|
|
113
|
-
const properties = {};
|
|
114
|
-
const grpprl = papx !== void 0 ? readGrpprl(papx.grpprl) : [];
|
|
115
|
-
if (papx !== void 0) {
|
|
116
|
-
properties.istd = papx.istd;
|
|
117
|
-
if (context.styles !== void 0) applyParagraphSprms(resolveStyleFormatting(context.styles, papx.istd).paragraphPrls, properties);
|
|
118
|
-
applyParagraphSprms(grpprl, properties);
|
|
119
|
-
}
|
|
120
|
-
return {
|
|
121
|
-
paragraph: {
|
|
122
|
-
kind: "paragraph",
|
|
123
|
-
runs: buildRuns(text, fcs, context, papx?.istd),
|
|
124
|
-
...paragraphAttributes(properties, context)
|
|
125
|
-
},
|
|
126
|
-
properties,
|
|
127
|
-
grpprl,
|
|
128
|
-
terminator
|
|
89
|
+
blocks: assembleBlocks(entriesBySection[index] ?? [])
|
|
90
|
+
})),
|
|
91
|
+
numbering,
|
|
92
|
+
footnotes,
|
|
93
|
+
endnotes,
|
|
94
|
+
comments,
|
|
95
|
+
headerFooterStories
|
|
129
96
|
};
|
|
130
97
|
}
|
|
131
|
-
function
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
const
|
|
136
|
-
if (
|
|
137
|
-
|
|
138
|
-
if (
|
|
139
|
-
}
|
|
140
|
-
if (attributes.headingLevel === void 0 && properties.outlineLevel !== void 0) attributes.headingLevel = properties.outlineLevel + 1;
|
|
141
|
-
if (properties.alignment !== void 0) attributes.alignment = properties.alignment;
|
|
142
|
-
if (properties.spacingBeforePt !== void 0) attributes.spacingBeforePt = properties.spacingBeforePt;
|
|
143
|
-
if (properties.spacingAfterPt !== void 0) attributes.spacingAfterPt = properties.spacingAfterPt;
|
|
144
|
-
if (properties.lineSpacing !== void 0) attributes.lineSpacing = properties.lineSpacing;
|
|
145
|
-
if (properties.indentLeftPt !== void 0) attributes.indentLeftPt = properties.indentLeftPt;
|
|
146
|
-
if (properties.indentRightPt !== void 0) attributes.indentRightPt = properties.indentRightPt;
|
|
147
|
-
if (properties.indentFirstLinePt !== void 0) attributes.indentFirstLinePt = properties.indentFirstLinePt;
|
|
148
|
-
if (properties.pageBreakBefore === true) attributes.pageBreakBefore = true;
|
|
149
|
-
if (properties.listId !== void 0) attributes.list = {
|
|
150
|
-
numId: String(properties.listId),
|
|
151
|
-
level: properties.listLevel ?? 0
|
|
152
|
-
};
|
|
153
|
-
return attributes;
|
|
154
|
-
}
|
|
155
|
-
function buildRuns(text, fcs, context, paragraphIstd) {
|
|
156
|
-
const runs = [];
|
|
157
|
-
let currentKey;
|
|
158
|
-
let currentText = "";
|
|
159
|
-
let currentProperties = {};
|
|
160
|
-
const paragraphStyleCharacterPrls = context.styles !== void 0 && paragraphIstd !== void 0 ? resolveStyleFormatting(context.styles, paragraphIstd).characterPrls : [];
|
|
161
|
-
const enclosingInstruction = [];
|
|
162
|
-
let inInstruction = false;
|
|
163
|
-
const flush = () => {
|
|
164
|
-
if (currentText !== "") runs.push({
|
|
165
|
-
text: currentText,
|
|
166
|
-
...currentProperties
|
|
167
|
-
});
|
|
168
|
-
currentText = "";
|
|
169
|
-
};
|
|
170
|
-
for (let index = 0; index < text.length; index += 1) {
|
|
171
|
-
const code = text.charCodeAt(index);
|
|
172
|
-
if (code === 19) {
|
|
173
|
-
flush();
|
|
174
|
-
enclosingInstruction.push(inInstruction);
|
|
175
|
-
inInstruction = true;
|
|
176
|
-
continue;
|
|
177
|
-
}
|
|
178
|
-
if (code === 20) {
|
|
179
|
-
inInstruction = false;
|
|
180
|
-
continue;
|
|
181
|
-
}
|
|
182
|
-
if (code === 21) {
|
|
183
|
-
inInstruction = enclosingInstruction.pop() ?? inInstruction;
|
|
184
|
-
continue;
|
|
185
|
-
}
|
|
186
|
-
if (inInstruction || isAnchorOnly(code)) continue;
|
|
187
|
-
const fc = fcs[index];
|
|
188
|
-
if (fc === void 0) throw new DocFormatError(`character ${index} of a paragraph has no byte offset, so its formatting cannot be located`);
|
|
189
|
-
const grpprl = context.chpxTable.chpxGrpprl(fc);
|
|
190
|
-
const chpxKey = grpprl === void 0 ? "none" : `${grpprl.byteOffset}:${grpprl.byteLength}`;
|
|
191
|
-
const key = `${paragraphIstd ?? "none"}:${chpxKey}`;
|
|
192
|
-
if (key !== currentKey) {
|
|
193
|
-
flush();
|
|
194
|
-
currentKey = key;
|
|
195
|
-
let properties = context.characterProperties.get(key);
|
|
196
|
-
if (properties === void 0) {
|
|
197
|
-
properties = {};
|
|
198
|
-
applyCharacterSprms(paragraphStyleCharacterPrls, properties, context.fonts);
|
|
199
|
-
if (grpprl !== void 0) {
|
|
200
|
-
const runPrls = readGrpprl(grpprl);
|
|
201
|
-
const characterIstd = characterIstdFromGrpprl(runPrls);
|
|
202
|
-
if (characterIstd !== void 0 && context.styles !== void 0) applyCharacterSprms(resolveStyleFormatting(context.styles, characterIstd).characterPrls, properties, context.fonts);
|
|
203
|
-
applyCharacterSprms(runPrls, properties, context.fonts);
|
|
204
|
-
}
|
|
205
|
-
context.characterProperties.set(key, properties);
|
|
206
|
-
}
|
|
207
|
-
currentProperties = properties;
|
|
208
|
-
}
|
|
209
|
-
currentText += String.fromCharCode(code === 11 ? 10 : code);
|
|
98
|
+
function splitIntoSections(entries, sections) {
|
|
99
|
+
const groups = sections.map(() => []);
|
|
100
|
+
let sectionIndex = 0;
|
|
101
|
+
for (const entry of entries) {
|
|
102
|
+
const group = groups[sectionIndex];
|
|
103
|
+
if (group === void 0) throw new DocFormatError(`internal defect: section index ${sectionIndex} has no group despite ${sections.length} sections`);
|
|
104
|
+
group.push(entry);
|
|
105
|
+
if (entry.endCp === sections[sectionIndex + 1]?.startCp) sectionIndex += 1;
|
|
210
106
|
}
|
|
211
|
-
|
|
212
|
-
return runs;
|
|
107
|
+
return groups;
|
|
213
108
|
}
|
|
214
109
|
//#endregion
|
|
215
110
|
export { readDocContent, readDocStreams };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { t as Prl } from "./sprm-DEyvdOo0.js";
|
|
2
|
+
//#region src/style/stsh.d.ts
|
|
3
|
+
/** StdfBase.sti's "0x0FFE for user-defined styles"; anything else is an application-defined style whose sti identifies it. */
|
|
4
|
+
declare const STI_USER_DEFINED = 4094;
|
|
5
|
+
/** StdfBase.stk, [MS-DOC] 2.9.269 -- which of ECMA-376's ST_StyleType values this style is. */
|
|
6
|
+
declare const STK: {
|
|
7
|
+
readonly paragraph: 1;
|
|
8
|
+
readonly character: 2;
|
|
9
|
+
readonly table: 3;
|
|
10
|
+
readonly numbering: 4;
|
|
11
|
+
};
|
|
12
|
+
interface Style {
|
|
13
|
+
/** The style's index in STSH.rglpstd, which is what sprmPIstd and sprmCIstd name. */
|
|
14
|
+
readonly istd: number;
|
|
15
|
+
/** The invariant application-defined style identifier, or STI_USER_DEFINED for a style the document itself defines. */
|
|
16
|
+
readonly sti: number;
|
|
17
|
+
readonly stk: number;
|
|
18
|
+
/** The istd this style inherits from, or undefined when StdfBase.istdBase is 0x0FFF ("this style does not inherit from any other style"). */
|
|
19
|
+
readonly istdBase: number | undefined;
|
|
20
|
+
/** The style's primary name, from the STD's own Xstz. */
|
|
21
|
+
readonly name: string;
|
|
22
|
+
/** The style's own paragraph formatting -- StkParaGRLPUPX's lpUpxPapx.PAPX.grpprlPapx -- present only for a paragraph style (STK.paragraph). Undefined for every other stk: table and numbering styles carry their own formatting shapes this package does not read (see the README's own scope note). */
|
|
23
|
+
readonly grpprlPapx: readonly Prl[] | undefined;
|
|
24
|
+
/** The style's own character formatting -- a paragraph style's StkParaGRLPUPX.lpUpxChpx.CHPX.grpprlChpx (the run-level defaults a heading's own text falls back to) or a character style's StkCharGRLPUPX.lpUpxChpx.CHPX.grpprlChpx -- present for STK.paragraph and STK.character, undefined otherwise. */
|
|
25
|
+
readonly grpprlChpx: readonly Prl[] | undefined;
|
|
26
|
+
}
|
|
27
|
+
interface StyleSheet {
|
|
28
|
+
/** Indexed by istd; a hole is a slot [MS-DOC] permits to be empty ("A style definition can be empty, in which case cbStd MUST be 0"). */
|
|
29
|
+
readonly styles: readonly (Style | undefined)[];
|
|
30
|
+
}
|
|
31
|
+
declare function parseStsh(stsh: Uint8Array): StyleSheet;
|
|
32
|
+
interface ResolvedStyleFormatting {
|
|
33
|
+
readonly paragraphPrls: readonly Prl[];
|
|
34
|
+
readonly characterPrls: readonly Prl[];
|
|
35
|
+
}
|
|
36
|
+
declare function resolveStyleFormatting(styleSheet: StyleSheet, istd: number): ResolvedStyleFormatting;
|
|
37
|
+
declare function headingLevelFromIstd(istd: number): number | undefined;
|
|
38
|
+
declare function buildStshForStyles(names: ReadonlyMap<number, string>): Uint8Array;
|
|
39
|
+
//#endregion
|
|
40
|
+
export { StyleSheet as a, parseStsh as c, Style as i, resolveStyleFormatting as l, STI_USER_DEFINED as n, buildStshForStyles as o, STK as r, headingLevelFromIstd as s, ResolvedStyleFormatting as t };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { t as Prl } from "./sprm-DEyvdOo0.cjs";
|
|
2
|
+
//#region src/style/stsh.d.ts
|
|
3
|
+
/** StdfBase.sti's "0x0FFE for user-defined styles"; anything else is an application-defined style whose sti identifies it. */
|
|
4
|
+
declare const STI_USER_DEFINED = 4094;
|
|
5
|
+
/** StdfBase.stk, [MS-DOC] 2.9.269 -- which of ECMA-376's ST_StyleType values this style is. */
|
|
6
|
+
declare const STK: {
|
|
7
|
+
readonly paragraph: 1;
|
|
8
|
+
readonly character: 2;
|
|
9
|
+
readonly table: 3;
|
|
10
|
+
readonly numbering: 4;
|
|
11
|
+
};
|
|
12
|
+
interface Style {
|
|
13
|
+
/** The style's index in STSH.rglpstd, which is what sprmPIstd and sprmCIstd name. */
|
|
14
|
+
readonly istd: number;
|
|
15
|
+
/** The invariant application-defined style identifier, or STI_USER_DEFINED for a style the document itself defines. */
|
|
16
|
+
readonly sti: number;
|
|
17
|
+
readonly stk: number;
|
|
18
|
+
/** The istd this style inherits from, or undefined when StdfBase.istdBase is 0x0FFF ("this style does not inherit from any other style"). */
|
|
19
|
+
readonly istdBase: number | undefined;
|
|
20
|
+
/** The style's primary name, from the STD's own Xstz. */
|
|
21
|
+
readonly name: string;
|
|
22
|
+
/** The style's own paragraph formatting -- StkParaGRLPUPX's lpUpxPapx.PAPX.grpprlPapx -- present only for a paragraph style (STK.paragraph). Undefined for every other stk: table and numbering styles carry their own formatting shapes this package does not read (see the README's own scope note). */
|
|
23
|
+
readonly grpprlPapx: readonly Prl[] | undefined;
|
|
24
|
+
/** The style's own character formatting -- a paragraph style's StkParaGRLPUPX.lpUpxChpx.CHPX.grpprlChpx (the run-level defaults a heading's own text falls back to) or a character style's StkCharGRLPUPX.lpUpxChpx.CHPX.grpprlChpx -- present for STK.paragraph and STK.character, undefined otherwise. */
|
|
25
|
+
readonly grpprlChpx: readonly Prl[] | undefined;
|
|
26
|
+
}
|
|
27
|
+
interface StyleSheet {
|
|
28
|
+
/** Indexed by istd; a hole is a slot [MS-DOC] permits to be empty ("A style definition can be empty, in which case cbStd MUST be 0"). */
|
|
29
|
+
readonly styles: readonly (Style | undefined)[];
|
|
30
|
+
}
|
|
31
|
+
declare function parseStsh(stsh: Uint8Array): StyleSheet;
|
|
32
|
+
interface ResolvedStyleFormatting {
|
|
33
|
+
readonly paragraphPrls: readonly Prl[];
|
|
34
|
+
readonly characterPrls: readonly Prl[];
|
|
35
|
+
}
|
|
36
|
+
declare function resolveStyleFormatting(styleSheet: StyleSheet, istd: number): ResolvedStyleFormatting;
|
|
37
|
+
declare function headingLevelFromIstd(istd: number): number | undefined;
|
|
38
|
+
declare function buildStshForStyles(names: ReadonlyMap<number, string>): Uint8Array;
|
|
39
|
+
//#endregion
|
|
40
|
+
export { StyleSheet as a, parseStsh as c, Style as i, resolveStyleFormatting as l, STI_USER_DEFINED as n, buildStshForStyles as o, STK as r, headingLevelFromIstd as s, ResolvedStyleFormatting as t };
|
package/dist/style/stsh.d.cts
CHANGED
|
@@ -1,40 +1,2 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
//#region src/style/stsh.d.ts
|
|
3
|
-
/** StdfBase.sti's "0x0FFE for user-defined styles"; anything else is an application-defined style whose sti identifies it. */
|
|
4
|
-
declare const STI_USER_DEFINED = 4094;
|
|
5
|
-
/** StdfBase.stk, [MS-DOC] 2.9.269 -- which of ECMA-376's ST_StyleType values this style is. */
|
|
6
|
-
declare const STK: {
|
|
7
|
-
readonly paragraph: 1;
|
|
8
|
-
readonly character: 2;
|
|
9
|
-
readonly table: 3;
|
|
10
|
-
readonly numbering: 4;
|
|
11
|
-
};
|
|
12
|
-
interface Style {
|
|
13
|
-
/** The style's index in STSH.rglpstd, which is what sprmPIstd and sprmCIstd name. */
|
|
14
|
-
readonly istd: number;
|
|
15
|
-
/** The invariant application-defined style identifier, or STI_USER_DEFINED for a style the document itself defines. */
|
|
16
|
-
readonly sti: number;
|
|
17
|
-
readonly stk: number;
|
|
18
|
-
/** The istd this style inherits from, or undefined when StdfBase.istdBase is 0x0FFF ("this style does not inherit from any other style"). */
|
|
19
|
-
readonly istdBase: number | undefined;
|
|
20
|
-
/** The style's primary name, from the STD's own Xstz. */
|
|
21
|
-
readonly name: string;
|
|
22
|
-
/** The style's own paragraph formatting -- StkParaGRLPUPX's lpUpxPapx.PAPX.grpprlPapx -- present only for a paragraph style (STK.paragraph). Undefined for every other stk: table and numbering styles carry their own formatting shapes this package does not read (see the README's own scope note). */
|
|
23
|
-
readonly grpprlPapx: readonly Prl[] | undefined;
|
|
24
|
-
/** The style's own character formatting -- a paragraph style's StkParaGRLPUPX.lpUpxChpx.CHPX.grpprlChpx (the run-level defaults a heading's own text falls back to) or a character style's StkCharGRLPUPX.lpUpxChpx.CHPX.grpprlChpx -- present for STK.paragraph and STK.character, undefined otherwise. */
|
|
25
|
-
readonly grpprlChpx: readonly Prl[] | undefined;
|
|
26
|
-
}
|
|
27
|
-
interface StyleSheet {
|
|
28
|
-
/** Indexed by istd; a hole is a slot [MS-DOC] permits to be empty ("A style definition can be empty, in which case cbStd MUST be 0"). */
|
|
29
|
-
readonly styles: readonly (Style | undefined)[];
|
|
30
|
-
}
|
|
31
|
-
declare function parseStsh(stsh: Uint8Array): StyleSheet;
|
|
32
|
-
interface ResolvedStyleFormatting {
|
|
33
|
-
readonly paragraphPrls: readonly Prl[];
|
|
34
|
-
readonly characterPrls: readonly Prl[];
|
|
35
|
-
}
|
|
36
|
-
declare function resolveStyleFormatting(styleSheet: StyleSheet, istd: number): ResolvedStyleFormatting;
|
|
37
|
-
declare function headingLevelFromIstd(istd: number): number | undefined;
|
|
38
|
-
declare function buildStshForStyles(names: ReadonlyMap<number, string>): Uint8Array;
|
|
39
|
-
//#endregion
|
|
1
|
+
import { a as StyleSheet, c as parseStsh, i as Style, l as resolveStyleFormatting, n as STI_USER_DEFINED, o as buildStshForStyles, r as STK, s as headingLevelFromIstd, t as ResolvedStyleFormatting } from "../stsh-CK59x6XG.cjs";
|
|
40
2
|
export { ResolvedStyleFormatting, STI_USER_DEFINED, STK, Style, StyleSheet, buildStshForStyles, headingLevelFromIstd, parseStsh, resolveStyleFormatting };
|
package/dist/style/stsh.d.ts
CHANGED
|
@@ -1,40 +1,2 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
//#region src/style/stsh.d.ts
|
|
3
|
-
/** StdfBase.sti's "0x0FFE for user-defined styles"; anything else is an application-defined style whose sti identifies it. */
|
|
4
|
-
declare const STI_USER_DEFINED = 4094;
|
|
5
|
-
/** StdfBase.stk, [MS-DOC] 2.9.269 -- which of ECMA-376's ST_StyleType values this style is. */
|
|
6
|
-
declare const STK: {
|
|
7
|
-
readonly paragraph: 1;
|
|
8
|
-
readonly character: 2;
|
|
9
|
-
readonly table: 3;
|
|
10
|
-
readonly numbering: 4;
|
|
11
|
-
};
|
|
12
|
-
interface Style {
|
|
13
|
-
/** The style's index in STSH.rglpstd, which is what sprmPIstd and sprmCIstd name. */
|
|
14
|
-
readonly istd: number;
|
|
15
|
-
/** The invariant application-defined style identifier, or STI_USER_DEFINED for a style the document itself defines. */
|
|
16
|
-
readonly sti: number;
|
|
17
|
-
readonly stk: number;
|
|
18
|
-
/** The istd this style inherits from, or undefined when StdfBase.istdBase is 0x0FFF ("this style does not inherit from any other style"). */
|
|
19
|
-
readonly istdBase: number | undefined;
|
|
20
|
-
/** The style's primary name, from the STD's own Xstz. */
|
|
21
|
-
readonly name: string;
|
|
22
|
-
/** The style's own paragraph formatting -- StkParaGRLPUPX's lpUpxPapx.PAPX.grpprlPapx -- present only for a paragraph style (STK.paragraph). Undefined for every other stk: table and numbering styles carry their own formatting shapes this package does not read (see the README's own scope note). */
|
|
23
|
-
readonly grpprlPapx: readonly Prl[] | undefined;
|
|
24
|
-
/** The style's own character formatting -- a paragraph style's StkParaGRLPUPX.lpUpxChpx.CHPX.grpprlChpx (the run-level defaults a heading's own text falls back to) or a character style's StkCharGRLPUPX.lpUpxChpx.CHPX.grpprlChpx -- present for STK.paragraph and STK.character, undefined otherwise. */
|
|
25
|
-
readonly grpprlChpx: readonly Prl[] | undefined;
|
|
26
|
-
}
|
|
27
|
-
interface StyleSheet {
|
|
28
|
-
/** Indexed by istd; a hole is a slot [MS-DOC] permits to be empty ("A style definition can be empty, in which case cbStd MUST be 0"). */
|
|
29
|
-
readonly styles: readonly (Style | undefined)[];
|
|
30
|
-
}
|
|
31
|
-
declare function parseStsh(stsh: Uint8Array): StyleSheet;
|
|
32
|
-
interface ResolvedStyleFormatting {
|
|
33
|
-
readonly paragraphPrls: readonly Prl[];
|
|
34
|
-
readonly characterPrls: readonly Prl[];
|
|
35
|
-
}
|
|
36
|
-
declare function resolveStyleFormatting(styleSheet: StyleSheet, istd: number): ResolvedStyleFormatting;
|
|
37
|
-
declare function headingLevelFromIstd(istd: number): number | undefined;
|
|
38
|
-
declare function buildStshForStyles(names: ReadonlyMap<number, string>): Uint8Array;
|
|
39
|
-
//#endregion
|
|
1
|
+
import { a as StyleSheet, c as parseStsh, i as Style, l as resolveStyleFormatting, n as STI_USER_DEFINED, o as buildStshForStyles, r as STK, s as headingLevelFromIstd, t as ResolvedStyleFormatting } from "../stsh-Bj0YSEOp.js";
|
|
40
2
|
export { ResolvedStyleFormatting, STI_USER_DEFINED, STK, Style, StyleSheet, buildStshForStyles, headingLevelFromIstd, parseStsh, resolveStyleFormatting };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_bytes = require("./bytes.cjs");
|
|
3
|
+
const require_plc = require("./plc.cjs");
|
|
4
|
+
const require_text_paragraphs = require("./text/paragraphs.cjs");
|
|
5
|
+
const require_text_characters = require("./text/characters.cjs");
|
|
6
|
+
//#region src/subdocument.ts
|
|
7
|
+
function readSubdocumentStories(wordDocument, table, pieceTable, context, subdocStartCp, subdocLength, boundaryFc, boundaryLcb, what) {
|
|
8
|
+
if (subdocLength <= 0 || boundaryLcb <= 0) return [];
|
|
9
|
+
const range = require_text_characters.readTextRange(wordDocument, pieceTable, subdocStartCp, subdocStartCp + subdocLength);
|
|
10
|
+
const entries = require_text_paragraphs.readParagraphs(range.text, range.fcs, context);
|
|
11
|
+
const plc = require_plc.parsePlc(require_bytes.slice(table, boundaryFc, boundaryLcb, `${what} in the Table stream`), 0, what);
|
|
12
|
+
return require_text_paragraphs.splitEntriesByBoundaries(entries, plc.keys).slice(0, -1).map((story) => story.slice(0, -1));
|
|
13
|
+
}
|
|
14
|
+
/** Joins a story's own paragraphs into plain text -- one line per paragraph, matching how ooxml.js's own Footnote/Comment reading concatenates a footnote or comment body's `w:t` runs rather than preserving paragraph/run structure. A footnote, endnote, or comment in this family is carried as text alone; only a header or footer keeps real block flow (headers-footers.ts). Non-paragraph blocks a story's own entries produced (an inline picture split out of one of its paragraphs) contribute no text of their own here, the same way an image has no plain-text spelling in ooxml.js's own footnote/comment reading either. */
|
|
15
|
+
function storyText(entries) {
|
|
16
|
+
return entries.map((entry) => entry.blocks.flatMap((block) => block.kind === "paragraph" ? block.runs : []).map((run) => run.text).join("")).join("\n");
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.readSubdocumentStories = readSubdocumentStories;
|
|
20
|
+
exports.storyText = storyText;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { n as ReadContext, t as ParagraphEntry } from "./paragraphs-DQUp8_HB.cjs";
|
|
2
|
+
import { n as PieceTable } from "./piece-table-CA18mhjv.cjs";
|
|
3
|
+
//#region src/subdocument.d.ts
|
|
4
|
+
declare function readSubdocumentStories(wordDocument: Uint8Array, table: Uint8Array, pieceTable: PieceTable, context: ReadContext, subdocStartCp: number, subdocLength: number, boundaryFc: number, boundaryLcb: number, what: string): readonly ParagraphEntry[][];
|
|
5
|
+
/** Joins a story's own paragraphs into plain text -- one line per paragraph, matching how ooxml.js's own Footnote/Comment reading concatenates a footnote or comment body's `w:t` runs rather than preserving paragraph/run structure. A footnote, endnote, or comment in this family is carried as text alone; only a header or footer keeps real block flow (headers-footers.ts). Non-paragraph blocks a story's own entries produced (an inline picture split out of one of its paragraphs) contribute no text of their own here, the same way an image has no plain-text spelling in ooxml.js's own footnote/comment reading either. */
|
|
6
|
+
declare function storyText(entries: readonly ParagraphEntry[]): string;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { readSubdocumentStories, storyText };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { n as ReadContext, t as ParagraphEntry } from "./paragraphs-s2lJ6w2I.js";
|
|
2
|
+
import { n as PieceTable } from "./piece-table-CA18mhjv.js";
|
|
3
|
+
//#region src/subdocument.d.ts
|
|
4
|
+
declare function readSubdocumentStories(wordDocument: Uint8Array, table: Uint8Array, pieceTable: PieceTable, context: ReadContext, subdocStartCp: number, subdocLength: number, boundaryFc: number, boundaryLcb: number, what: string): readonly ParagraphEntry[][];
|
|
5
|
+
/** Joins a story's own paragraphs into plain text -- one line per paragraph, matching how ooxml.js's own Footnote/Comment reading concatenates a footnote or comment body's `w:t` runs rather than preserving paragraph/run structure. A footnote, endnote, or comment in this family is carried as text alone; only a header or footer keeps real block flow (headers-footers.ts). Non-paragraph blocks a story's own entries produced (an inline picture split out of one of its paragraphs) contribute no text of their own here, the same way an image has no plain-text spelling in ooxml.js's own footnote/comment reading either. */
|
|
6
|
+
declare function storyText(entries: readonly ParagraphEntry[]): string;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { readSubdocumentStories, storyText };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { slice } from "./bytes.js";
|
|
2
|
+
import { parsePlc } from "./plc.js";
|
|
3
|
+
import { readParagraphs, splitEntriesByBoundaries } from "./text/paragraphs.js";
|
|
4
|
+
import { readTextRange } from "./text/characters.js";
|
|
5
|
+
//#region src/subdocument.ts
|
|
6
|
+
function readSubdocumentStories(wordDocument, table, pieceTable, context, subdocStartCp, subdocLength, boundaryFc, boundaryLcb, what) {
|
|
7
|
+
if (subdocLength <= 0 || boundaryLcb <= 0) return [];
|
|
8
|
+
const range = readTextRange(wordDocument, pieceTable, subdocStartCp, subdocStartCp + subdocLength);
|
|
9
|
+
const entries = readParagraphs(range.text, range.fcs, context);
|
|
10
|
+
const plc = parsePlc(slice(table, boundaryFc, boundaryLcb, `${what} in the Table stream`), 0, what);
|
|
11
|
+
return splitEntriesByBoundaries(entries, plc.keys).slice(0, -1).map((story) => story.slice(0, -1));
|
|
12
|
+
}
|
|
13
|
+
/** Joins a story's own paragraphs into plain text -- one line per paragraph, matching how ooxml.js's own Footnote/Comment reading concatenates a footnote or comment body's `w:t` runs rather than preserving paragraph/run structure. A footnote, endnote, or comment in this family is carried as text alone; only a header or footer keeps real block flow (headers-footers.ts). Non-paragraph blocks a story's own entries produced (an inline picture split out of one of its paragraphs) contribute no text of their own here, the same way an image has no plain-text spelling in ooxml.js's own footnote/comment reading either. */
|
|
14
|
+
function storyText(entries) {
|
|
15
|
+
return entries.map((entry) => entry.blocks.flatMap((block) => block.kind === "paragraph" ? block.runs : []).map((run) => run.text).join("")).join("\n");
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { readSubdocumentStories, storyText };
|
package/dist/table/read.cjs
CHANGED
|
@@ -23,30 +23,44 @@ function effectiveColumnBoundaryTolerance(definitions) {
|
|
|
23
23
|
return narrowestRealGapTwips === void 0 ? TWIPS_PER_POINT : Math.min(TWIPS_PER_POINT, narrowestRealGapTwips - 1);
|
|
24
24
|
}
|
|
25
25
|
function assembleBlocks(entries) {
|
|
26
|
+
return walkBlocksAtDepth(entries, 0);
|
|
27
|
+
}
|
|
28
|
+
function effectiveTableDepth(properties) {
|
|
29
|
+
if (properties.tableDepth !== void 0) return properties.tableDepth;
|
|
30
|
+
return properties.inTable === true ? 1 : 0;
|
|
31
|
+
}
|
|
32
|
+
function isCellBoundary(entry, tableDepth) {
|
|
33
|
+
if (tableDepth === 1) return entry.terminator === 7 && entry.properties.tableRowEnd !== true;
|
|
34
|
+
return entry.terminator === 13 && entry.properties.innerTableCellMark === true;
|
|
35
|
+
}
|
|
36
|
+
function isRowBoundary(entry, tableDepth) {
|
|
37
|
+
return tableDepth === 1 ? entry.properties.tableRowEnd === true : entry.properties.innerTtpMark === true;
|
|
38
|
+
}
|
|
39
|
+
function walkBlocksAtDepth(entries, depth) {
|
|
26
40
|
const blocks = [];
|
|
27
41
|
let index = 0;
|
|
28
42
|
while (index < entries.length) {
|
|
29
43
|
const entry = entries[index];
|
|
30
44
|
if (entry === void 0) break;
|
|
31
|
-
if (entry.properties
|
|
32
|
-
blocks.push(entry.
|
|
45
|
+
if (effectiveTableDepth(entry.properties) <= depth) {
|
|
46
|
+
blocks.push(...entry.blocks);
|
|
33
47
|
index += 1;
|
|
34
48
|
continue;
|
|
35
49
|
}
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
|
|
50
|
+
const tableDepth = depth + 1;
|
|
51
|
+
const { runEntries, nextIndex } = collectTableRun(entries, index, tableDepth);
|
|
52
|
+
const table = tryAssembleTable(runEntries, tableDepth);
|
|
53
|
+
blocks.push(...table !== void 0 ? [table] : runEntries.flatMap((run) => run.blocks));
|
|
39
54
|
index = nextIndex;
|
|
40
55
|
}
|
|
41
56
|
return blocks;
|
|
42
57
|
}
|
|
43
|
-
function collectTableRun(entries, start) {
|
|
58
|
+
function collectTableRun(entries, start, tableDepth) {
|
|
44
59
|
const runEntries = [];
|
|
45
60
|
let index = start;
|
|
46
61
|
while (index < entries.length) {
|
|
47
62
|
const entry = entries[index];
|
|
48
|
-
if (entry
|
|
49
|
-
if (entry.properties.tableDepth !== void 0 && entry.properties.tableDepth > 1 || entry.properties.nestedTableMark === true) throw new require_errors.DocUnsupportedError("doc-codec does not support a table nested inside a table cell (table depth greater than 1)");
|
|
63
|
+
if (entry === void 0 || effectiveTableDepth(entry.properties) < tableDepth) break;
|
|
50
64
|
runEntries.push(entry);
|
|
51
65
|
index += 1;
|
|
52
66
|
}
|
|
@@ -55,15 +69,15 @@ function collectTableRun(entries, start) {
|
|
|
55
69
|
nextIndex: index
|
|
56
70
|
};
|
|
57
71
|
}
|
|
58
|
-
function tryAssembleTable(runEntries) {
|
|
72
|
+
function tryAssembleTable(runEntries, tableDepth) {
|
|
59
73
|
const rawRows = [];
|
|
60
74
|
const rowDefinitions = [];
|
|
61
75
|
const rowHeights = [];
|
|
62
|
-
let
|
|
76
|
+
let cellEntries = [];
|
|
63
77
|
let rowCells = [];
|
|
64
78
|
for (const entry of runEntries) {
|
|
65
|
-
|
|
66
|
-
if (entry
|
|
79
|
+
cellEntries.push(entry);
|
|
80
|
+
if (isRowBoundary(entry, tableDepth)) {
|
|
67
81
|
const rowProperties = require_table_tap.applyTableSprms(entry.grpprl, {});
|
|
68
82
|
const definition = rowProperties.definition;
|
|
69
83
|
if (definition === void 0) return void 0;
|
|
@@ -83,15 +97,15 @@ function tryAssembleTable(runEntries) {
|
|
|
83
97
|
rowDefinitions.push(definition);
|
|
84
98
|
rowHeights.push(rowProperties.heightPt);
|
|
85
99
|
rowCells = [];
|
|
86
|
-
|
|
100
|
+
cellEntries = [];
|
|
87
101
|
continue;
|
|
88
102
|
}
|
|
89
|
-
if (entry
|
|
90
|
-
rowCells.push({ blocks:
|
|
91
|
-
|
|
103
|
+
if (isCellBoundary(entry, tableDepth)) {
|
|
104
|
+
rowCells.push({ blocks: walkBlocksAtDepth(cellEntries, tableDepth) });
|
|
105
|
+
cellEntries = [];
|
|
92
106
|
}
|
|
93
107
|
}
|
|
94
|
-
if (
|
|
108
|
+
if (cellEntries.length > 0 || rowCells.length > 0) throw new require_errors.DocFormatError("a table's paragraphs end without a row-ending mark to close the row's last cell");
|
|
95
109
|
const toleranceTwips = effectiveColumnBoundaryTolerance(rowDefinitions);
|
|
96
110
|
const columnBoundariesTwips = canonicalColumnBoundariesTwips(rowDefinitions, toleranceTwips);
|
|
97
111
|
return {
|
package/dist/table/read.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParagraphEntry } from "../
|
|
1
|
+
import { t as ParagraphEntry } from "../paragraphs-DQUp8_HB.cjs";
|
|
2
2
|
import { ContentBlock } from "document-schema.js";
|
|
3
3
|
//#region src/table/read.d.ts
|
|
4
4
|
declare function assembleBlocks(entries: readonly ParagraphEntry[]): ContentBlock[];
|
package/dist/table/read.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParagraphEntry } from "../
|
|
1
|
+
import { t as ParagraphEntry } from "../paragraphs-s2lJ6w2I.js";
|
|
2
2
|
import { ContentBlock } from "document-schema.js";
|
|
3
3
|
//#region src/table/read.d.ts
|
|
4
4
|
declare function assembleBlocks(entries: readonly ParagraphEntry[]): ContentBlock[];
|