doc-codec 2.4.2 → 2.5.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 +47 -16
- 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/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 +47 -151
- package/dist/read.d.cts +13 -15
- package/dist/read.d.ts +13 -15
- package/dist/read.js +49 -153
- 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 +3 -3
- package/dist/numbering-DSpm9w6y.d.cts +0 -24
- package/dist/numbering-DayjnHXY.d.ts +0 -24
package/dist/read.cjs
CHANGED
|
@@ -3,22 +3,21 @@ const require_errors = require("./errors.cjs");
|
|
|
3
3
|
const require_bytes = require("./bytes.cjs");
|
|
4
4
|
const require_detect = require("./detect.cjs");
|
|
5
5
|
const require_encryption = require("./encryption.cjs");
|
|
6
|
-
const
|
|
6
|
+
const require_prop_fkp = require("./prop/fkp.cjs");
|
|
7
|
+
const require_style_stsh = require("./style/stsh.cjs");
|
|
8
|
+
const require_text_paragraphs = require("./text/paragraphs.cjs");
|
|
7
9
|
const require_text_piece_table = require("./text/piece-table.cjs");
|
|
8
10
|
const require_text_characters = require("./text/characters.cjs");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const require_prop_chp = require("./prop/chp.cjs");
|
|
13
|
-
const require_prop_pap = require("./prop/pap.cjs");
|
|
11
|
+
const require_table_read = require("./table/read.cjs");
|
|
12
|
+
const require_headers_footers = require("./headers-footers.cjs");
|
|
13
|
+
const require_fib_fib = require("./fib/fib.cjs");
|
|
14
14
|
const require_prop_sep = require("./prop/sep.cjs");
|
|
15
|
-
const require_style_stsh = require("./style/stsh.cjs");
|
|
16
15
|
const require_style_fonts = require("./style/fonts.cjs");
|
|
17
16
|
const require_list_numbering = require("./list/numbering.cjs");
|
|
18
|
-
const
|
|
17
|
+
const require_notes = require("./notes.cjs");
|
|
19
18
|
let archive_codec = require("archive-codec");
|
|
20
19
|
//#region src/read.ts
|
|
21
|
-
/** 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
|
|
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 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. */
|
|
22
21
|
const DEFAULT_PAGE_SIZE = {
|
|
23
22
|
widthPt: 612,
|
|
24
23
|
heightPt: 792
|
|
@@ -47,170 +46,67 @@ function readDocStreams(bytes, password) {
|
|
|
47
46
|
}
|
|
48
47
|
const fib = require_fib_fib.parseFib(wordDocument);
|
|
49
48
|
const metadata = streams.find((stream) => stream.path === require_detect.SUMMARY_INFORMATION_STREAM);
|
|
49
|
+
const data = streams.find((stream) => stream.path === require_detect.DATA_STREAM);
|
|
50
50
|
return {
|
|
51
51
|
wordDocument,
|
|
52
52
|
table,
|
|
53
53
|
fib,
|
|
54
|
-
metadata: metadata?.bytes
|
|
54
|
+
metadata: metadata?.bytes,
|
|
55
|
+
data: data?.bytes
|
|
55
56
|
};
|
|
56
57
|
}
|
|
57
58
|
function readDocContent(bytes, password) {
|
|
58
|
-
const { wordDocument, table, fib, metadata } = readDocStreams(bytes, password);
|
|
59
|
+
const { wordDocument, table, fib, metadata, data } = readDocStreams(bytes, password);
|
|
59
60
|
const pieceTable = require_text_piece_table.parseClx(require_bytes.slice(table, fib.fcClx, fib.lcbClx, "Clx in the Table stream"));
|
|
60
61
|
const styles = fib.lcbStshf > 0 ? require_style_stsh.parseStsh(require_bytes.slice(table, fib.fcStshf, fib.lcbStshf, "STSH in the Table stream")) : void 0;
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const range = require_text_characters.readTextRange(wordDocument, pieceTable, 0, fib.ccpText);
|
|
65
|
-
const entries = readParagraphs(range.text, range.fcs, {
|
|
66
|
-
chpxTable,
|
|
67
|
-
papxTable,
|
|
62
|
+
const context = {
|
|
63
|
+
chpxTable: new require_prop_fkp.PropertyBinTable(wordDocument, require_bytes.slice(table, fib.fcPlcfBteChpx, fib.lcbPlcfBteChpx, "PlcBteChpx in the Table stream"), "PlcBteChpx"),
|
|
64
|
+
papxTable: new require_prop_fkp.PropertyBinTable(wordDocument, require_bytes.slice(table, fib.fcPlcfBtePapx, fib.lcbPlcfBtePapx, "PlcBtePapx in the Table stream"), "PlcBtePapx"),
|
|
68
65
|
styles,
|
|
69
|
-
|
|
66
|
+
dataStream: data,
|
|
67
|
+
fonts: fib.lcbSttbfFfn > 0 ? require_style_fonts.parseFontTable(require_bytes.slice(table, fib.fcSttbfFfn, fib.lcbSttbfFfn, "SttbfFfn in the Table stream")) : void 0,
|
|
70
68
|
characterProperties: /* @__PURE__ */ new Map()
|
|
71
|
-
}
|
|
72
|
-
const
|
|
69
|
+
};
|
|
70
|
+
const range = require_text_characters.readTextRange(wordDocument, pieceTable, 0, fib.ccpText);
|
|
71
|
+
const entries = require_text_paragraphs.readParagraphs(range.text, range.fcs, context);
|
|
73
72
|
const numbering = require_list_numbering.readNumberingDefinitions(table, fib);
|
|
74
|
-
const sectionProperties = require_prop_sep.
|
|
73
|
+
const sectionProperties = require_prop_sep.readAllSectionProperties(wordDocument, table, fib);
|
|
74
|
+
const entriesBySection = splitIntoSections(entries, sectionProperties);
|
|
75
|
+
const { footnotes, endnotes, comments } = require_notes.readNoteBodies(wordDocument, table, pieceTable, context, fib);
|
|
76
|
+
const headerFooterStories = require_headers_footers.readHeaderFooterStories(wordDocument, table, pieceTable, context, fib, sectionProperties.length);
|
|
75
77
|
return {
|
|
76
78
|
kind: "wordprocessing",
|
|
77
79
|
metadata: metadata === void 0 ? {} : (0, archive_codec.summaryInformationToLayoutMetadata)((0, archive_codec.readSummaryInformation)(metadata)),
|
|
78
|
-
sections:
|
|
80
|
+
sections: sectionProperties.map((properties, index) => ({
|
|
79
81
|
pageSize: {
|
|
80
|
-
widthPt:
|
|
81
|
-
heightPt:
|
|
82
|
+
widthPt: properties.pageWidthPt ?? DEFAULT_PAGE_SIZE.widthPt,
|
|
83
|
+
heightPt: properties.pageHeightPt ?? DEFAULT_PAGE_SIZE.heightPt
|
|
82
84
|
},
|
|
83
85
|
margins: {
|
|
84
|
-
leftPt:
|
|
85
|
-
rightPt:
|
|
86
|
-
topPt:
|
|
87
|
-
bottomPt:
|
|
86
|
+
leftPt: properties.marginLeftPt ?? DEFAULT_MARGINS.leftPt,
|
|
87
|
+
rightPt: properties.marginRightPt ?? DEFAULT_MARGINS.rightPt,
|
|
88
|
+
topPt: properties.marginTopPt ?? DEFAULT_MARGINS.topPt,
|
|
89
|
+
bottomPt: properties.marginBottomPt ?? DEFAULT_MARGINS.bottomPt
|
|
88
90
|
},
|
|
89
|
-
blocks
|
|
90
|
-
}
|
|
91
|
-
numbering
|
|
91
|
+
blocks: require_table_read.assembleBlocks(entriesBySection[index] ?? [])
|
|
92
|
+
})),
|
|
93
|
+
numbering,
|
|
94
|
+
footnotes,
|
|
95
|
+
endnotes,
|
|
96
|
+
comments,
|
|
97
|
+
headerFooterStories
|
|
92
98
|
};
|
|
93
99
|
}
|
|
94
|
-
function
|
|
95
|
-
const
|
|
96
|
-
let
|
|
97
|
-
for (
|
|
98
|
-
const
|
|
99
|
-
if (
|
|
100
|
-
|
|
101
|
-
if (
|
|
102
|
-
entries.push(buildParagraph(text.slice(start, index), fcs.slice(start, index), markFc, code, context));
|
|
103
|
-
start = index + 1;
|
|
104
|
-
}
|
|
105
|
-
if (start < text.length) {
|
|
106
|
-
const firstFc = fcs[start];
|
|
107
|
-
if (firstFc === void 0) throw new require_errors.DocFormatError(`character ${start} has no byte offset, so the trailing paragraph's properties cannot be located`);
|
|
108
|
-
entries.push(buildParagraph(text.slice(start), fcs.slice(start), firstFc, 13, context));
|
|
109
|
-
}
|
|
110
|
-
return entries;
|
|
111
|
-
}
|
|
112
|
-
function buildParagraph(text, fcs, propertyFc, terminator, context) {
|
|
113
|
-
const papx = context.papxTable.papx(propertyFc);
|
|
114
|
-
const properties = {};
|
|
115
|
-
const grpprl = papx !== void 0 ? require_prop_sprm.readGrpprl(papx.grpprl) : [];
|
|
116
|
-
if (papx !== void 0) {
|
|
117
|
-
properties.istd = papx.istd;
|
|
118
|
-
if (context.styles !== void 0) require_prop_pap.applyParagraphSprms(require_style_stsh.resolveStyleFormatting(context.styles, papx.istd).paragraphPrls, properties);
|
|
119
|
-
require_prop_pap.applyParagraphSprms(grpprl, properties);
|
|
120
|
-
}
|
|
121
|
-
return {
|
|
122
|
-
paragraph: {
|
|
123
|
-
kind: "paragraph",
|
|
124
|
-
runs: buildRuns(text, fcs, context, papx?.istd),
|
|
125
|
-
...paragraphAttributes(properties, context)
|
|
126
|
-
},
|
|
127
|
-
properties,
|
|
128
|
-
grpprl,
|
|
129
|
-
terminator
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
function paragraphAttributes(properties, context) {
|
|
133
|
-
const attributes = {};
|
|
134
|
-
const istd = properties.istd;
|
|
135
|
-
if (istd !== void 0) {
|
|
136
|
-
const style = context.styles?.styles[istd];
|
|
137
|
-
if (style !== void 0 && style.name !== "") attributes.styleId = style.name;
|
|
138
|
-
const headingLevel = require_style_stsh.headingLevelFromIstd(istd);
|
|
139
|
-
if (headingLevel !== void 0) attributes.headingLevel = headingLevel;
|
|
140
|
-
}
|
|
141
|
-
if (attributes.headingLevel === void 0 && properties.outlineLevel !== void 0) attributes.headingLevel = properties.outlineLevel + 1;
|
|
142
|
-
if (properties.alignment !== void 0) attributes.alignment = properties.alignment;
|
|
143
|
-
if (properties.spacingBeforePt !== void 0) attributes.spacingBeforePt = properties.spacingBeforePt;
|
|
144
|
-
if (properties.spacingAfterPt !== void 0) attributes.spacingAfterPt = properties.spacingAfterPt;
|
|
145
|
-
if (properties.lineSpacing !== void 0) attributes.lineSpacing = properties.lineSpacing;
|
|
146
|
-
if (properties.indentLeftPt !== void 0) attributes.indentLeftPt = properties.indentLeftPt;
|
|
147
|
-
if (properties.indentRightPt !== void 0) attributes.indentRightPt = properties.indentRightPt;
|
|
148
|
-
if (properties.indentFirstLinePt !== void 0) attributes.indentFirstLinePt = properties.indentFirstLinePt;
|
|
149
|
-
if (properties.pageBreakBefore === true) attributes.pageBreakBefore = true;
|
|
150
|
-
if (properties.listId !== void 0) attributes.list = {
|
|
151
|
-
numId: String(properties.listId),
|
|
152
|
-
level: properties.listLevel ?? 0
|
|
153
|
-
};
|
|
154
|
-
return attributes;
|
|
155
|
-
}
|
|
156
|
-
function buildRuns(text, fcs, context, paragraphIstd) {
|
|
157
|
-
const runs = [];
|
|
158
|
-
let currentKey;
|
|
159
|
-
let currentText = "";
|
|
160
|
-
let currentProperties = {};
|
|
161
|
-
const paragraphStyleCharacterPrls = context.styles !== void 0 && paragraphIstd !== void 0 ? require_style_stsh.resolveStyleFormatting(context.styles, paragraphIstd).characterPrls : [];
|
|
162
|
-
const enclosingInstruction = [];
|
|
163
|
-
let inInstruction = false;
|
|
164
|
-
const flush = () => {
|
|
165
|
-
if (currentText !== "") runs.push({
|
|
166
|
-
text: currentText,
|
|
167
|
-
...currentProperties
|
|
168
|
-
});
|
|
169
|
-
currentText = "";
|
|
170
|
-
};
|
|
171
|
-
for (let index = 0; index < text.length; index += 1) {
|
|
172
|
-
const code = text.charCodeAt(index);
|
|
173
|
-
if (code === 19) {
|
|
174
|
-
flush();
|
|
175
|
-
enclosingInstruction.push(inInstruction);
|
|
176
|
-
inInstruction = true;
|
|
177
|
-
continue;
|
|
178
|
-
}
|
|
179
|
-
if (code === 20) {
|
|
180
|
-
inInstruction = false;
|
|
181
|
-
continue;
|
|
182
|
-
}
|
|
183
|
-
if (code === 21) {
|
|
184
|
-
inInstruction = enclosingInstruction.pop() ?? inInstruction;
|
|
185
|
-
continue;
|
|
186
|
-
}
|
|
187
|
-
if (inInstruction || require_text_special.isAnchorOnly(code)) continue;
|
|
188
|
-
const fc = fcs[index];
|
|
189
|
-
if (fc === void 0) throw new require_errors.DocFormatError(`character ${index} of a paragraph has no byte offset, so its formatting cannot be located`);
|
|
190
|
-
const grpprl = context.chpxTable.chpxGrpprl(fc);
|
|
191
|
-
const chpxKey = grpprl === void 0 ? "none" : `${grpprl.byteOffset}:${grpprl.byteLength}`;
|
|
192
|
-
const key = `${paragraphIstd ?? "none"}:${chpxKey}`;
|
|
193
|
-
if (key !== currentKey) {
|
|
194
|
-
flush();
|
|
195
|
-
currentKey = key;
|
|
196
|
-
let properties = context.characterProperties.get(key);
|
|
197
|
-
if (properties === void 0) {
|
|
198
|
-
properties = {};
|
|
199
|
-
require_prop_chp.applyCharacterSprms(paragraphStyleCharacterPrls, properties, context.fonts);
|
|
200
|
-
if (grpprl !== void 0) {
|
|
201
|
-
const runPrls = require_prop_sprm.readGrpprl(grpprl);
|
|
202
|
-
const characterIstd = require_prop_chp.characterIstdFromGrpprl(runPrls);
|
|
203
|
-
if (characterIstd !== void 0 && context.styles !== void 0) require_prop_chp.applyCharacterSprms(require_style_stsh.resolveStyleFormatting(context.styles, characterIstd).characterPrls, properties, context.fonts);
|
|
204
|
-
require_prop_chp.applyCharacterSprms(runPrls, properties, context.fonts);
|
|
205
|
-
}
|
|
206
|
-
context.characterProperties.set(key, properties);
|
|
207
|
-
}
|
|
208
|
-
currentProperties = properties;
|
|
209
|
-
}
|
|
210
|
-
currentText += String.fromCharCode(code === 11 ? 10 : code);
|
|
100
|
+
function splitIntoSections(entries, sections) {
|
|
101
|
+
const groups = sections.map(() => []);
|
|
102
|
+
let sectionIndex = 0;
|
|
103
|
+
for (const entry of entries) {
|
|
104
|
+
const group = groups[sectionIndex];
|
|
105
|
+
if (group === void 0) throw new require_errors.DocFormatError(`internal defect: section index ${sectionIndex} has no group despite ${sections.length} sections`);
|
|
106
|
+
group.push(entry);
|
|
107
|
+
if (entry.endCp === sections[sectionIndex + 1]?.startCp) sectionIndex += 1;
|
|
211
108
|
}
|
|
212
|
-
|
|
213
|
-
return runs;
|
|
109
|
+
return groups;
|
|
214
110
|
}
|
|
215
111
|
//#endregion
|
|
216
112
|
exports.readDocContent = readDocContent;
|
package/dist/read.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as Fib } from "./fib-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { ContentDocument
|
|
1
|
+
import { t as Fib } from "./fib-6BFIx153.cjs";
|
|
2
|
+
import { HeaderFooterStories } from "./headers-footers.cjs";
|
|
3
|
+
import { NumberingDefinitions } from "./list/numbering.cjs";
|
|
4
|
+
import { NoteBodies } from "./notes.cjs";
|
|
5
|
+
import { ContentDocument } from "document-schema.js";
|
|
6
6
|
//#region src/read.d.ts
|
|
7
7
|
interface DocStreams {
|
|
8
8
|
readonly wordDocument: Uint8Array;
|
|
@@ -10,20 +10,18 @@ interface DocStreams {
|
|
|
10
10
|
readonly fib: Fib;
|
|
11
11
|
/** The raw "\x05SummaryInformation" stream bytes, or undefined when the container carries none -- a valid, spec-conformant Word Binary File need not carry document properties at all. */
|
|
12
12
|
readonly metadata: Uint8Array<ArrayBuffer> | undefined;
|
|
13
|
+
/** The raw "Data" stream bytes, or undefined when the container carries none -- a valid Word Binary File with no pictures need not have one. sprmCPicLocation's operand addresses this stream (pictures.ts). */
|
|
14
|
+
readonly data: Uint8Array<ArrayBuffer> | undefined;
|
|
13
15
|
}
|
|
14
16
|
declare function readDocStreams(bytes: Uint8Array<ArrayBuffer>, password?: string): DocStreams;
|
|
15
|
-
/** readDocContent's own return type: a ContentDocument (kind 'wordprocessing') plus numbering --
|
|
17
|
+
/** readDocContent's own return type: a ContentDocument (kind 'wordprocessing') plus numbering, footnotes, endnotes, comments, and headerFooterStories -- constructs [MS-DOC] carries outside the main document's own text and document-schema.js's ContentDocument has nowhere to hold. Mirrors ooxml.js's own DocxDocument in field name and shape wherever the two formats' own constructs genuinely agree (numbering/NumberingDefinitions, footnotes/endnotes/comments as plain-text `Footnote`/`Comment`); headerFooterStories is doc-codec's own shape rather than DocxDocument's path-addressed HeaderFooterPart, since [MS-DOC] has no named parts of its own for a header or footer to be identified by, only a (section, slot) position (see headers-footers.ts's own top comment). Unlike DocxDocument, DocContent stays a genuine ContentDocument subtype (an intersection, not a fresh shape) since readDocContent already had one return type to widen rather than several to reconcile. */
|
|
16
18
|
type DocContent = ContentDocument & {
|
|
17
19
|
readonly numbering: NumberingDefinitions;
|
|
20
|
+
readonly footnotes: NoteBodies["footnotes"];
|
|
21
|
+
readonly endnotes: NoteBodies["endnotes"];
|
|
22
|
+
readonly comments: NoteBodies["comments"];
|
|
23
|
+
readonly headerFooterStories: HeaderFooterStories;
|
|
18
24
|
};
|
|
19
25
|
declare function readDocContent(bytes: Uint8Array<ArrayBuffer>, password?: string): DocContent;
|
|
20
|
-
/** One paragraph/cell/row-ending mark, still flat -- table/read.ts's assembleBlocks is what folds a run of these into a real ContentTable. `properties` and `grpprl` are carried alongside the already-built `paragraph` because table grouping needs sprmPFInTable/sprmPFTtp/sprmPItap (properties) and, on a row's own mark, its table-defining sgc-5 sprms (grpprl) -- neither of which survives onto a plain ContentParagraph. */
|
|
21
|
-
interface ParagraphEntry {
|
|
22
|
-
readonly paragraph: ContentParagraph;
|
|
23
|
-
readonly properties: ParagraphProperties;
|
|
24
|
-
readonly grpprl: readonly Prl[];
|
|
25
|
-
/** The character that terminated this paragraph in the text stream: PARAGRAPH_MARK, CELL_MARK, or SECTION_MARK. */
|
|
26
|
-
readonly terminator: number;
|
|
27
|
-
}
|
|
28
26
|
//#endregion
|
|
29
|
-
export { DocContent, DocStreams,
|
|
27
|
+
export { DocContent, DocStreams, readDocContent, readDocStreams };
|
package/dist/read.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as Fib } from "./fib-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { ContentDocument
|
|
1
|
+
import { t as Fib } from "./fib-6BFIx153.js";
|
|
2
|
+
import { HeaderFooterStories } from "./headers-footers.js";
|
|
3
|
+
import { NumberingDefinitions } from "./list/numbering.js";
|
|
4
|
+
import { NoteBodies } from "./notes.js";
|
|
5
|
+
import { ContentDocument } from "document-schema.js";
|
|
6
6
|
//#region src/read.d.ts
|
|
7
7
|
interface DocStreams {
|
|
8
8
|
readonly wordDocument: Uint8Array;
|
|
@@ -10,20 +10,18 @@ interface DocStreams {
|
|
|
10
10
|
readonly fib: Fib;
|
|
11
11
|
/** The raw "\x05SummaryInformation" stream bytes, or undefined when the container carries none -- a valid, spec-conformant Word Binary File need not carry document properties at all. */
|
|
12
12
|
readonly metadata: Uint8Array<ArrayBuffer> | undefined;
|
|
13
|
+
/** The raw "Data" stream bytes, or undefined when the container carries none -- a valid Word Binary File with no pictures need not have one. sprmCPicLocation's operand addresses this stream (pictures.ts). */
|
|
14
|
+
readonly data: Uint8Array<ArrayBuffer> | undefined;
|
|
13
15
|
}
|
|
14
16
|
declare function readDocStreams(bytes: Uint8Array<ArrayBuffer>, password?: string): DocStreams;
|
|
15
|
-
/** readDocContent's own return type: a ContentDocument (kind 'wordprocessing') plus numbering --
|
|
17
|
+
/** readDocContent's own return type: a ContentDocument (kind 'wordprocessing') plus numbering, footnotes, endnotes, comments, and headerFooterStories -- constructs [MS-DOC] carries outside the main document's own text and document-schema.js's ContentDocument has nowhere to hold. Mirrors ooxml.js's own DocxDocument in field name and shape wherever the two formats' own constructs genuinely agree (numbering/NumberingDefinitions, footnotes/endnotes/comments as plain-text `Footnote`/`Comment`); headerFooterStories is doc-codec's own shape rather than DocxDocument's path-addressed HeaderFooterPart, since [MS-DOC] has no named parts of its own for a header or footer to be identified by, only a (section, slot) position (see headers-footers.ts's own top comment). Unlike DocxDocument, DocContent stays a genuine ContentDocument subtype (an intersection, not a fresh shape) since readDocContent already had one return type to widen rather than several to reconcile. */
|
|
16
18
|
type DocContent = ContentDocument & {
|
|
17
19
|
readonly numbering: NumberingDefinitions;
|
|
20
|
+
readonly footnotes: NoteBodies["footnotes"];
|
|
21
|
+
readonly endnotes: NoteBodies["endnotes"];
|
|
22
|
+
readonly comments: NoteBodies["comments"];
|
|
23
|
+
readonly headerFooterStories: HeaderFooterStories;
|
|
18
24
|
};
|
|
19
25
|
declare function readDocContent(bytes: Uint8Array<ArrayBuffer>, password?: string): DocContent;
|
|
20
|
-
/** One paragraph/cell/row-ending mark, still flat -- table/read.ts's assembleBlocks is what folds a run of these into a real ContentTable. `properties` and `grpprl` are carried alongside the already-built `paragraph` because table grouping needs sprmPFInTable/sprmPFTtp/sprmPItap (properties) and, on a row's own mark, its table-defining sgc-5 sprms (grpprl) -- neither of which survives onto a plain ContentParagraph. */
|
|
21
|
-
interface ParagraphEntry {
|
|
22
|
-
readonly paragraph: ContentParagraph;
|
|
23
|
-
readonly properties: ParagraphProperties;
|
|
24
|
-
readonly grpprl: readonly Prl[];
|
|
25
|
-
/** The character that terminated this paragraph in the text stream: PARAGRAPH_MARK, CELL_MARK, or SECTION_MARK. */
|
|
26
|
-
readonly terminator: number;
|
|
27
|
-
}
|
|
28
26
|
//#endregion
|
|
29
|
-
export { DocContent, DocStreams,
|
|
27
|
+
export { DocContent, DocStreams, readDocContent, readDocStreams };
|
package/dist/read.js
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
import { DocFormatError, DocUnsupportedError } 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
|
|
@@ -46,170 +45,67 @@ function readDocStreams(bytes, password) {
|
|
|
46
45
|
}
|
|
47
46
|
const fib = parseFib(wordDocument);
|
|
48
47
|
const metadata = streams.find((stream) => stream.path === SUMMARY_INFORMATION_STREAM);
|
|
48
|
+
const data = streams.find((stream) => stream.path === DATA_STREAM);
|
|
49
49
|
return {
|
|
50
50
|
wordDocument,
|
|
51
51
|
table,
|
|
52
52
|
fib,
|
|
53
|
-
metadata: metadata?.bytes
|
|
53
|
+
metadata: metadata?.bytes,
|
|
54
|
+
data: data?.bytes
|
|
54
55
|
};
|
|
55
56
|
}
|
|
56
57
|
function readDocContent(bytes, password) {
|
|
57
|
-
const { wordDocument, table, fib, metadata } = readDocStreams(bytes, password);
|
|
58
|
+
const { wordDocument, table, fib, metadata, data } = readDocStreams(bytes, password);
|
|
58
59
|
const pieceTable = parseClx(slice(table, fib.fcClx, fib.lcbClx, "Clx in the Table stream"));
|
|
59
60
|
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,
|
|
61
|
+
const context = {
|
|
62
|
+
chpxTable: new PropertyBinTable(wordDocument, slice(table, fib.fcPlcfBteChpx, fib.lcbPlcfBteChpx, "PlcBteChpx in the Table stream"), "PlcBteChpx"),
|
|
63
|
+
papxTable: new PropertyBinTable(wordDocument, slice(table, fib.fcPlcfBtePapx, fib.lcbPlcfBtePapx, "PlcBtePapx in the Table stream"), "PlcBtePapx"),
|
|
67
64
|
styles,
|
|
68
|
-
|
|
65
|
+
dataStream: data,
|
|
66
|
+
fonts: fib.lcbSttbfFfn > 0 ? parseFontTable(slice(table, fib.fcSttbfFfn, fib.lcbSttbfFfn, "SttbfFfn in the Table stream")) : void 0,
|
|
69
67
|
characterProperties: /* @__PURE__ */ new Map()
|
|
70
|
-
}
|
|
71
|
-
const
|
|
68
|
+
};
|
|
69
|
+
const range = readTextRange(wordDocument, pieceTable, 0, fib.ccpText);
|
|
70
|
+
const entries = readParagraphs(range.text, range.fcs, context);
|
|
72
71
|
const numbering = readNumberingDefinitions(table, fib);
|
|
73
|
-
const sectionProperties =
|
|
72
|
+
const sectionProperties = readAllSectionProperties(wordDocument, table, fib);
|
|
73
|
+
const entriesBySection = splitIntoSections(entries, sectionProperties);
|
|
74
|
+
const { footnotes, endnotes, comments } = readNoteBodies(wordDocument, table, pieceTable, context, fib);
|
|
75
|
+
const headerFooterStories = readHeaderFooterStories(wordDocument, table, pieceTable, context, fib, sectionProperties.length);
|
|
74
76
|
return {
|
|
75
77
|
kind: "wordprocessing",
|
|
76
78
|
metadata: metadata === void 0 ? {} : summaryInformationToLayoutMetadata(readSummaryInformation(metadata)),
|
|
77
|
-
sections:
|
|
79
|
+
sections: sectionProperties.map((properties, index) => ({
|
|
78
80
|
pageSize: {
|
|
79
|
-
widthPt:
|
|
80
|
-
heightPt:
|
|
81
|
+
widthPt: properties.pageWidthPt ?? DEFAULT_PAGE_SIZE.widthPt,
|
|
82
|
+
heightPt: properties.pageHeightPt ?? DEFAULT_PAGE_SIZE.heightPt
|
|
81
83
|
},
|
|
82
84
|
margins: {
|
|
83
|
-
leftPt:
|
|
84
|
-
rightPt:
|
|
85
|
-
topPt:
|
|
86
|
-
bottomPt:
|
|
85
|
+
leftPt: properties.marginLeftPt ?? DEFAULT_MARGINS.leftPt,
|
|
86
|
+
rightPt: properties.marginRightPt ?? DEFAULT_MARGINS.rightPt,
|
|
87
|
+
topPt: properties.marginTopPt ?? DEFAULT_MARGINS.topPt,
|
|
88
|
+
bottomPt: properties.marginBottomPt ?? DEFAULT_MARGINS.bottomPt
|
|
87
89
|
},
|
|
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
|
|
90
|
+
blocks: assembleBlocks(entriesBySection[index] ?? [])
|
|
91
|
+
})),
|
|
92
|
+
numbering,
|
|
93
|
+
footnotes,
|
|
94
|
+
endnotes,
|
|
95
|
+
comments,
|
|
96
|
+
headerFooterStories
|
|
129
97
|
};
|
|
130
98
|
}
|
|
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);
|
|
99
|
+
function splitIntoSections(entries, sections) {
|
|
100
|
+
const groups = sections.map(() => []);
|
|
101
|
+
let sectionIndex = 0;
|
|
102
|
+
for (const entry of entries) {
|
|
103
|
+
const group = groups[sectionIndex];
|
|
104
|
+
if (group === void 0) throw new DocFormatError(`internal defect: section index ${sectionIndex} has no group despite ${sections.length} sections`);
|
|
105
|
+
group.push(entry);
|
|
106
|
+
if (entry.endCp === sections[sectionIndex + 1]?.startCp) sectionIndex += 1;
|
|
210
107
|
}
|
|
211
|
-
|
|
212
|
-
return runs;
|
|
108
|
+
return groups;
|
|
213
109
|
}
|
|
214
110
|
//#endregion
|
|
215
111
|
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 };
|