@extend-ai/react-docx 0.1.0 → 0.3.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/dist/index.cjs +28225 -17582
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +816 -4
- package/dist/index.d.ts +816 -4
- package/dist/index.js +39609 -29040
- package/dist/index.js.map +1 -1
- package/package.json +8 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,531 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
interface OoxmlPart {
|
|
4
|
+
name: string;
|
|
5
|
+
content: string;
|
|
6
|
+
}
|
|
7
|
+
interface OoxmlPackage {
|
|
8
|
+
parts: Map<string, OoxmlPart>;
|
|
9
|
+
binaryAssets: Map<string, Uint8Array>;
|
|
10
|
+
}
|
|
11
|
+
declare function parseDocx(input: ArrayBuffer): Promise<OoxmlPackage>;
|
|
12
|
+
declare function packageToArrayBuffer(pkg: OoxmlPackage): ArrayBuffer;
|
|
13
|
+
declare function createMinimalDocxPackage(documentXml?: string): OoxmlPackage;
|
|
14
|
+
declare function getPart(pkg: OoxmlPackage, partName: string): OoxmlPart | undefined;
|
|
15
|
+
declare function withPart(pkg: OoxmlPackage, part: OoxmlPart): OoxmlPackage;
|
|
16
|
+
|
|
17
|
+
type ParagraphAlignment = "left" | "center" | "right" | "justify";
|
|
18
|
+
type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
19
|
+
interface TextRunBorderStyle {
|
|
20
|
+
type: string;
|
|
21
|
+
color?: string;
|
|
22
|
+
sizeEighthPt?: number;
|
|
23
|
+
spacePt?: number;
|
|
24
|
+
frame?: boolean;
|
|
25
|
+
shadow?: boolean;
|
|
26
|
+
}
|
|
27
|
+
interface TextStyle {
|
|
28
|
+
bold?: boolean;
|
|
29
|
+
italic?: boolean;
|
|
30
|
+
underline?: boolean;
|
|
31
|
+
strike?: boolean;
|
|
32
|
+
color?: string;
|
|
33
|
+
highlight?: string;
|
|
34
|
+
backgroundColor?: string;
|
|
35
|
+
fontSizePt?: number;
|
|
36
|
+
fontFamily?: string;
|
|
37
|
+
characterSpacingTwips?: number;
|
|
38
|
+
verticalAlign?: "superscript" | "subscript";
|
|
39
|
+
runBorder?: TextRunBorderStyle;
|
|
40
|
+
}
|
|
41
|
+
interface TextRunNode {
|
|
42
|
+
type: "text";
|
|
43
|
+
text: string;
|
|
44
|
+
style?: TextStyle;
|
|
45
|
+
link?: string;
|
|
46
|
+
noteReference?: {
|
|
47
|
+
kind: "footnote" | "endnote";
|
|
48
|
+
id: number;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
interface ImageRunNode {
|
|
52
|
+
type: "image";
|
|
53
|
+
src?: string;
|
|
54
|
+
alt?: string;
|
|
55
|
+
widthPx?: number;
|
|
56
|
+
heightPx?: number;
|
|
57
|
+
partName?: string;
|
|
58
|
+
contentType?: string;
|
|
59
|
+
data?: Uint8Array;
|
|
60
|
+
sourceXml?: string;
|
|
61
|
+
crop?: {
|
|
62
|
+
leftFraction?: number;
|
|
63
|
+
topFraction?: number;
|
|
64
|
+
rightFraction?: number;
|
|
65
|
+
bottomFraction?: number;
|
|
66
|
+
};
|
|
67
|
+
cssFilter?: string;
|
|
68
|
+
cssOpacity?: number;
|
|
69
|
+
floating?: {
|
|
70
|
+
xPx?: number;
|
|
71
|
+
yPx?: number;
|
|
72
|
+
horizontalAlign?: "left" | "center" | "right" | "inside" | "outside";
|
|
73
|
+
verticalAlign?: "top" | "center" | "bottom" | "inside" | "outside";
|
|
74
|
+
horizontalRelativeTo?: string;
|
|
75
|
+
verticalRelativeTo?: string;
|
|
76
|
+
distLPx?: number;
|
|
77
|
+
distRPx?: number;
|
|
78
|
+
distTPx?: number;
|
|
79
|
+
distBPx?: number;
|
|
80
|
+
wrapType?: "none" | "square" | "tight" | "through" | "topAndBottom";
|
|
81
|
+
wrapText?: "bothSides" | "left" | "right" | "largest";
|
|
82
|
+
behindDocument?: boolean;
|
|
83
|
+
zIndex?: number;
|
|
84
|
+
};
|
|
85
|
+
syntheticTextBox?: boolean;
|
|
86
|
+
textBoxText?: string;
|
|
87
|
+
}
|
|
88
|
+
type FormFieldType = "checkbox" | "text" | "date" | "dropdown";
|
|
89
|
+
type FormFieldSourceKind = "sdt" | "legacy";
|
|
90
|
+
interface FormFieldOption {
|
|
91
|
+
displayText: string;
|
|
92
|
+
value?: string;
|
|
93
|
+
}
|
|
94
|
+
interface FormFieldTextWidgetSettings {
|
|
95
|
+
inputType?: "regular" | "number" | "date" | "currentDate" | "currentTime" | "calculated" | (string & {});
|
|
96
|
+
defaultText?: string;
|
|
97
|
+
maxLength?: number;
|
|
98
|
+
textFormat?: string;
|
|
99
|
+
}
|
|
100
|
+
interface FormFieldCheckboxWidgetSettings {
|
|
101
|
+
defaultChecked?: boolean;
|
|
102
|
+
sizeMode?: "auto" | "exact";
|
|
103
|
+
sizePt?: number;
|
|
104
|
+
}
|
|
105
|
+
interface FormFieldDropdownWidgetSettings {
|
|
106
|
+
defaultValue?: string;
|
|
107
|
+
}
|
|
108
|
+
interface FormFieldWidgetSettings {
|
|
109
|
+
name?: string;
|
|
110
|
+
enabled?: boolean;
|
|
111
|
+
calcOnExit?: boolean;
|
|
112
|
+
text?: FormFieldTextWidgetSettings;
|
|
113
|
+
checkbox?: FormFieldCheckboxWidgetSettings;
|
|
114
|
+
dropdown?: FormFieldDropdownWidgetSettings;
|
|
115
|
+
}
|
|
116
|
+
interface FormFieldRunNode {
|
|
117
|
+
type: "form-field";
|
|
118
|
+
fieldType: FormFieldType;
|
|
119
|
+
sourceKind?: FormFieldSourceKind;
|
|
120
|
+
id?: number;
|
|
121
|
+
tag?: string;
|
|
122
|
+
title?: string;
|
|
123
|
+
placeholder?: string;
|
|
124
|
+
checked?: boolean;
|
|
125
|
+
value?: string;
|
|
126
|
+
options?: FormFieldOption[];
|
|
127
|
+
widget?: FormFieldWidgetSettings;
|
|
128
|
+
checkedSymbol?: string;
|
|
129
|
+
uncheckedSymbol?: string;
|
|
130
|
+
style?: TextStyle;
|
|
131
|
+
link?: string;
|
|
132
|
+
sourceXml?: string;
|
|
133
|
+
}
|
|
134
|
+
type ParagraphChildNode = TextRunNode | ImageRunNode | FormFieldRunNode;
|
|
135
|
+
interface ParagraphNumbering {
|
|
136
|
+
numId: number;
|
|
137
|
+
ilvl: number;
|
|
138
|
+
}
|
|
139
|
+
interface ParagraphSpacing {
|
|
140
|
+
beforeTwips?: number;
|
|
141
|
+
afterTwips?: number;
|
|
142
|
+
lineTwips?: number;
|
|
143
|
+
lineRule?: "auto" | "exact" | "atLeast";
|
|
144
|
+
}
|
|
145
|
+
interface ParagraphIndent {
|
|
146
|
+
leftTwips?: number;
|
|
147
|
+
rightTwips?: number;
|
|
148
|
+
firstLineTwips?: number;
|
|
149
|
+
hangingTwips?: number;
|
|
150
|
+
}
|
|
151
|
+
interface ParagraphBorderStyle {
|
|
152
|
+
type: string;
|
|
153
|
+
color?: string;
|
|
154
|
+
sizeEighthPt?: number;
|
|
155
|
+
spacePt?: number;
|
|
156
|
+
frame?: boolean;
|
|
157
|
+
shadow?: boolean;
|
|
158
|
+
}
|
|
159
|
+
interface ParagraphBorderSet {
|
|
160
|
+
top?: ParagraphBorderStyle;
|
|
161
|
+
right?: ParagraphBorderStyle;
|
|
162
|
+
bottom?: ParagraphBorderStyle;
|
|
163
|
+
left?: ParagraphBorderStyle;
|
|
164
|
+
between?: ParagraphBorderStyle;
|
|
165
|
+
bar?: ParagraphBorderStyle;
|
|
166
|
+
}
|
|
167
|
+
interface ParagraphStyle {
|
|
168
|
+
align?: ParagraphAlignment;
|
|
169
|
+
headingLevel?: HeadingLevel;
|
|
170
|
+
styleId?: string;
|
|
171
|
+
styleName?: string;
|
|
172
|
+
numbering?: ParagraphNumbering;
|
|
173
|
+
spacing?: ParagraphSpacing;
|
|
174
|
+
indent?: ParagraphIndent;
|
|
175
|
+
backgroundColor?: string;
|
|
176
|
+
borders?: ParagraphBorderSet;
|
|
177
|
+
tabStops?: ParagraphTabStop[];
|
|
178
|
+
contextualSpacing?: boolean;
|
|
179
|
+
keepNext?: boolean;
|
|
180
|
+
keepLines?: boolean;
|
|
181
|
+
widowControl?: boolean;
|
|
182
|
+
pageBreakBefore?: boolean;
|
|
183
|
+
dropCap?: {
|
|
184
|
+
type: "drop" | "margin";
|
|
185
|
+
lines?: number;
|
|
186
|
+
wrap?: string;
|
|
187
|
+
horizontalAnchor?: string;
|
|
188
|
+
verticalAnchor?: string;
|
|
189
|
+
xTwips?: number;
|
|
190
|
+
yTwips?: number;
|
|
191
|
+
horizontalSpaceTwips?: number;
|
|
192
|
+
verticalSpaceTwips?: number;
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
interface ParagraphNode {
|
|
196
|
+
type: "paragraph";
|
|
197
|
+
children: ParagraphChildNode[];
|
|
198
|
+
style?: ParagraphStyle;
|
|
199
|
+
paragraphMarkDeleted?: boolean;
|
|
200
|
+
sourceXml?: string;
|
|
201
|
+
}
|
|
202
|
+
interface TableBoxSpacing {
|
|
203
|
+
topTwips?: number;
|
|
204
|
+
rightTwips?: number;
|
|
205
|
+
bottomTwips?: number;
|
|
206
|
+
leftTwips?: number;
|
|
207
|
+
}
|
|
208
|
+
interface TableBorderStyle {
|
|
209
|
+
type: string;
|
|
210
|
+
color?: string;
|
|
211
|
+
sizeEighthPt?: number;
|
|
212
|
+
}
|
|
213
|
+
interface TableBorderSet {
|
|
214
|
+
top?: TableBorderStyle;
|
|
215
|
+
right?: TableBorderStyle;
|
|
216
|
+
bottom?: TableBorderStyle;
|
|
217
|
+
left?: TableBorderStyle;
|
|
218
|
+
insideH?: TableBorderStyle;
|
|
219
|
+
insideV?: TableBorderStyle;
|
|
220
|
+
tl2br?: TableBorderStyle;
|
|
221
|
+
tr2bl?: TableBorderStyle;
|
|
222
|
+
}
|
|
223
|
+
interface TableCellStyle {
|
|
224
|
+
backgroundColor?: string;
|
|
225
|
+
gridSpan?: number;
|
|
226
|
+
rowSpan?: number;
|
|
227
|
+
vMergeContinuation?: boolean;
|
|
228
|
+
widthTwips?: number;
|
|
229
|
+
marginTwips?: TableBoxSpacing;
|
|
230
|
+
verticalAlign?: "top" | "center" | "bottom";
|
|
231
|
+
borders?: TableBorderSet;
|
|
232
|
+
}
|
|
233
|
+
type TableCellContentNode = ParagraphNode | TableNode;
|
|
234
|
+
interface TableCellNode {
|
|
235
|
+
type: "table-cell";
|
|
236
|
+
nodes: TableCellContentNode[];
|
|
237
|
+
style?: TableCellStyle;
|
|
238
|
+
}
|
|
239
|
+
interface TableRowStyle {
|
|
240
|
+
backgroundColor?: string;
|
|
241
|
+
heightTwips?: number;
|
|
242
|
+
heightRule?: "auto" | "atLeast" | "exact";
|
|
243
|
+
cantSplit?: boolean;
|
|
244
|
+
}
|
|
245
|
+
interface TableRowNode {
|
|
246
|
+
type: "table-row";
|
|
247
|
+
cells: TableCellNode[];
|
|
248
|
+
style?: TableRowStyle;
|
|
249
|
+
}
|
|
250
|
+
interface TableStyle {
|
|
251
|
+
widthTwips?: number;
|
|
252
|
+
indentTwips?: number;
|
|
253
|
+
layout?: "fixed" | "autofit";
|
|
254
|
+
cellSpacingTwips?: number;
|
|
255
|
+
cellMarginTwips?: TableBoxSpacing;
|
|
256
|
+
columnWidthsTwips?: number[];
|
|
257
|
+
borders?: TableBorderSet;
|
|
258
|
+
floating?: {
|
|
259
|
+
xTwips?: number;
|
|
260
|
+
yTwips?: number;
|
|
261
|
+
leftFromTextTwips?: number;
|
|
262
|
+
rightFromTextTwips?: number;
|
|
263
|
+
topFromTextTwips?: number;
|
|
264
|
+
bottomFromTextTwips?: number;
|
|
265
|
+
horizontalAnchor?: string;
|
|
266
|
+
verticalAnchor?: string;
|
|
267
|
+
horizontalAlign?: "left" | "center" | "right" | "inside" | "outside";
|
|
268
|
+
verticalAlign?: "top" | "center" | "bottom" | "inside" | "outside";
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
interface TableNode {
|
|
272
|
+
type: "table";
|
|
273
|
+
rows: TableRowNode[];
|
|
274
|
+
style?: TableStyle;
|
|
275
|
+
sourceXml?: string;
|
|
276
|
+
}
|
|
277
|
+
type DocNode = ParagraphNode | TableNode;
|
|
278
|
+
interface HeaderSection {
|
|
279
|
+
partName: string;
|
|
280
|
+
referenceType?: string;
|
|
281
|
+
nodes: DocNode[];
|
|
282
|
+
}
|
|
283
|
+
interface FooterSection {
|
|
284
|
+
partName: string;
|
|
285
|
+
referenceType?: string;
|
|
286
|
+
nodes: DocNode[];
|
|
287
|
+
}
|
|
288
|
+
interface DocumentSection {
|
|
289
|
+
startNodeIndex: number;
|
|
290
|
+
sectionPropertiesXml?: string;
|
|
291
|
+
headerSections: HeaderSection[];
|
|
292
|
+
footerSections: FooterSection[];
|
|
293
|
+
}
|
|
294
|
+
interface ParagraphStyleDefinition {
|
|
295
|
+
id: string;
|
|
296
|
+
name: string;
|
|
297
|
+
basedOnId?: string;
|
|
298
|
+
nextStyleId?: string;
|
|
299
|
+
align?: ParagraphAlignment;
|
|
300
|
+
headingLevel?: HeadingLevel;
|
|
301
|
+
numbering?: ParagraphNumbering;
|
|
302
|
+
spacing?: ParagraphSpacing;
|
|
303
|
+
indent?: ParagraphIndent;
|
|
304
|
+
backgroundColor?: string;
|
|
305
|
+
borders?: ParagraphBorderSet;
|
|
306
|
+
tabStops?: ParagraphTabStop[];
|
|
307
|
+
contextualSpacing?: boolean;
|
|
308
|
+
keepNext?: boolean;
|
|
309
|
+
keepLines?: boolean;
|
|
310
|
+
widowControl?: boolean;
|
|
311
|
+
pageBreakBefore?: boolean;
|
|
312
|
+
runStyle?: TextStyle;
|
|
313
|
+
uiPriority?: number;
|
|
314
|
+
isDefault?: boolean;
|
|
315
|
+
isPrimary?: boolean;
|
|
316
|
+
}
|
|
317
|
+
interface NumberingLevelDefinition {
|
|
318
|
+
ilvl: number;
|
|
319
|
+
start?: number;
|
|
320
|
+
format?: string;
|
|
321
|
+
text?: string;
|
|
322
|
+
suffix?: "tab" | "space" | "nothing";
|
|
323
|
+
indent?: ParagraphIndent;
|
|
324
|
+
runStyle?: TextStyle;
|
|
325
|
+
bulletFontFamily?: string;
|
|
326
|
+
bulletColor?: string;
|
|
327
|
+
pictureBulletId?: number;
|
|
328
|
+
pictureBullet?: NumberingPictureBulletDefinition;
|
|
329
|
+
}
|
|
330
|
+
interface NumberingAbstractDefinition {
|
|
331
|
+
abstractNumId: number;
|
|
332
|
+
levels: NumberingLevelDefinition[];
|
|
333
|
+
}
|
|
334
|
+
interface NumberingInstanceDefinition {
|
|
335
|
+
numId: number;
|
|
336
|
+
abstractNumId: number;
|
|
337
|
+
levelStartOverrides?: Record<string, number>;
|
|
338
|
+
levelOverrides?: NumberingLevelDefinition[];
|
|
339
|
+
}
|
|
340
|
+
interface NumberingDefinitionSet {
|
|
341
|
+
abstracts: NumberingAbstractDefinition[];
|
|
342
|
+
instances: NumberingInstanceDefinition[];
|
|
343
|
+
}
|
|
344
|
+
interface NumberingPictureBulletDefinition {
|
|
345
|
+
numPicBulletId: number;
|
|
346
|
+
src?: string;
|
|
347
|
+
widthPx?: number;
|
|
348
|
+
heightPx?: number;
|
|
349
|
+
partName?: string;
|
|
350
|
+
contentType?: string;
|
|
351
|
+
}
|
|
352
|
+
interface DocumentNoteDefinition {
|
|
353
|
+
id: number;
|
|
354
|
+
text: string;
|
|
355
|
+
nodes?: DocNode[];
|
|
356
|
+
}
|
|
357
|
+
interface DocumentCompatibilitySettings {
|
|
358
|
+
suppressSpacingBeforeAfterPageBreak?: boolean;
|
|
359
|
+
usePrinterMetrics?: boolean;
|
|
360
|
+
useFixedHtmlParagraphSpacing?: boolean;
|
|
361
|
+
doNotBreakWrappedTables?: boolean;
|
|
362
|
+
doNotBreakConstrainedForcedTable?: boolean;
|
|
363
|
+
evenAndOddHeaders?: boolean;
|
|
364
|
+
}
|
|
365
|
+
interface DocModel {
|
|
366
|
+
nodes: DocNode[];
|
|
367
|
+
metadata: {
|
|
368
|
+
sourceParts: number;
|
|
369
|
+
warnings: string[];
|
|
370
|
+
documentPageCount?: number;
|
|
371
|
+
documentOpenTag?: string;
|
|
372
|
+
documentBackgroundColor?: string;
|
|
373
|
+
sectionPropertiesXml?: string;
|
|
374
|
+
sections?: DocumentSection[];
|
|
375
|
+
headerSections: HeaderSection[];
|
|
376
|
+
footerSections: FooterSection[];
|
|
377
|
+
paragraphStyles: ParagraphStyleDefinition[];
|
|
378
|
+
defaultParagraphStyleId?: string;
|
|
379
|
+
numberingDefinitions?: NumberingDefinitionSet;
|
|
380
|
+
compatibility?: DocumentCompatibilitySettings;
|
|
381
|
+
footnotes?: DocumentNoteDefinition[];
|
|
382
|
+
endnotes?: DocumentNoteDefinition[];
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
interface ContentTypeLookup {
|
|
386
|
+
defaultByExtension: Map<string, string>;
|
|
387
|
+
overrideByPartName: Map<string, string>;
|
|
388
|
+
}
|
|
389
|
+
interface ParseContext {
|
|
390
|
+
relationships: Map<string, string>;
|
|
391
|
+
contentTypes: ContentTypeLookup;
|
|
392
|
+
parts: OoxmlPackage["parts"];
|
|
393
|
+
binaryAssets: Map<string, Uint8Array>;
|
|
394
|
+
styleSheet: ParsedStyleSheet;
|
|
395
|
+
warnings: string[];
|
|
396
|
+
}
|
|
397
|
+
interface ThemeFontMap {
|
|
398
|
+
majorLatin?: string;
|
|
399
|
+
minorLatin?: string;
|
|
400
|
+
majorEastAsia?: string;
|
|
401
|
+
minorEastAsia?: string;
|
|
402
|
+
majorComplexScript?: string;
|
|
403
|
+
minorComplexScript?: string;
|
|
404
|
+
}
|
|
405
|
+
interface ThemeColorMap {
|
|
406
|
+
[token: ThemeColorToken]: string;
|
|
407
|
+
}
|
|
408
|
+
interface ParagraphTabStop {
|
|
409
|
+
alignment?: "left" | "center" | "right" | "decimal" | "bar";
|
|
410
|
+
leader?: "none" | "dot" | "hyphen" | "underscore" | "middleDot";
|
|
411
|
+
positionTwips?: number;
|
|
412
|
+
}
|
|
413
|
+
interface ParsedStyleSheet {
|
|
414
|
+
paragraphStyles: ParagraphStyleDefinition[];
|
|
415
|
+
paragraphStyleById: Map<string, ParagraphStyleDefinition>;
|
|
416
|
+
runStyleById: Map<string, TextStyle>;
|
|
417
|
+
tableStyleById: Map<string, ParsedTableStyleDefinition>;
|
|
418
|
+
defaultParagraphStyle?: ParagraphStyle;
|
|
419
|
+
defaultParagraphStyleId?: string;
|
|
420
|
+
defaultRunStyle?: TextStyle;
|
|
421
|
+
themeFonts: ThemeFontMap;
|
|
422
|
+
themeColors: ThemeColorMap;
|
|
423
|
+
}
|
|
424
|
+
type TableConditionalStyleType = "wholeTable" | "firstRow" | "lastRow" | "firstCol" | "lastCol" | "band1Horz" | "band2Horz" | "band1Vert" | "band2Vert" | "nwCell" | "neCell" | "swCell" | "seCell";
|
|
425
|
+
interface ParsedTableStyleCondition {
|
|
426
|
+
rowBackgroundColor?: string;
|
|
427
|
+
cellBackgroundColor?: string;
|
|
428
|
+
paragraphAlign?: ParagraphAlignment;
|
|
429
|
+
runStyle?: TextStyle;
|
|
430
|
+
tableBorders?: TableBorderSet;
|
|
431
|
+
cellBorders?: TableBorderSet;
|
|
432
|
+
tableProperties?: ParsedTableProperties;
|
|
433
|
+
tableLook?: ParsedTableLook;
|
|
434
|
+
}
|
|
435
|
+
interface ParsedTableStyleDefinition {
|
|
436
|
+
id: string;
|
|
437
|
+
basedOnId?: string;
|
|
438
|
+
name: string;
|
|
439
|
+
conditions: Partial<Record<TableConditionalStyleType, ParsedTableStyleCondition>>;
|
|
440
|
+
floating?: NonNullable<TableStyle["floating"]>;
|
|
441
|
+
properties?: ParsedTableProperties;
|
|
442
|
+
}
|
|
443
|
+
interface ParsedTableProperties {
|
|
444
|
+
widthTwips?: number;
|
|
445
|
+
indentTwips?: number;
|
|
446
|
+
layout?: "fixed" | "autofit";
|
|
447
|
+
cellSpacingTwips?: number;
|
|
448
|
+
cellMarginTwips?: TableBoxSpacing;
|
|
449
|
+
floating?: NonNullable<TableStyle["floating"]>;
|
|
450
|
+
}
|
|
451
|
+
interface ParsedTableLook {
|
|
452
|
+
firstRow: boolean;
|
|
453
|
+
lastRow: boolean;
|
|
454
|
+
firstCol: boolean;
|
|
455
|
+
lastCol: boolean;
|
|
456
|
+
noHBand: boolean;
|
|
457
|
+
noVBand: boolean;
|
|
458
|
+
rowBandSize: number;
|
|
459
|
+
colBandSize: number;
|
|
460
|
+
}
|
|
461
|
+
declare function parseDocumentXml(documentXml: string, context?: ParseContext): DocNode[];
|
|
462
|
+
declare function buildDocModel(pkg: OoxmlPackage): DocModel;
|
|
463
|
+
declare function cloneDocModel(model: DocModel): DocModel;
|
|
464
|
+
|
|
465
|
+
interface LayoutOptions {
|
|
466
|
+
pageWidth?: number;
|
|
467
|
+
pageHeight?: number;
|
|
468
|
+
margin?: number;
|
|
469
|
+
minLineHeight?: number;
|
|
470
|
+
paragraphSpacing?: number;
|
|
471
|
+
tableCellPadding?: number;
|
|
472
|
+
}
|
|
473
|
+
interface LayoutTextRun {
|
|
474
|
+
kind: "text";
|
|
475
|
+
id: string;
|
|
476
|
+
text: string;
|
|
477
|
+
style?: TextStyle;
|
|
478
|
+
link?: string;
|
|
479
|
+
}
|
|
480
|
+
interface LayoutImageRun {
|
|
481
|
+
kind: "image";
|
|
482
|
+
id: string;
|
|
483
|
+
src?: string;
|
|
484
|
+
alt?: string;
|
|
485
|
+
widthPx?: number;
|
|
486
|
+
heightPx?: number;
|
|
487
|
+
contentType?: string;
|
|
488
|
+
data?: Uint8Array;
|
|
489
|
+
floating?: boolean;
|
|
490
|
+
}
|
|
491
|
+
type LayoutRun = LayoutTextRun | LayoutImageRun;
|
|
492
|
+
interface LayoutParagraphBlock {
|
|
493
|
+
kind: "paragraph";
|
|
494
|
+
id: string;
|
|
495
|
+
runs: LayoutRun[];
|
|
496
|
+
align: ParagraphAlignment;
|
|
497
|
+
headingLevel?: HeadingLevel;
|
|
498
|
+
x: number;
|
|
499
|
+
y: number;
|
|
500
|
+
width: number;
|
|
501
|
+
height: number;
|
|
502
|
+
}
|
|
503
|
+
interface LayoutTableCell {
|
|
504
|
+
id: string;
|
|
505
|
+
colSpan?: number;
|
|
506
|
+
backgroundColor?: string;
|
|
507
|
+
paragraphs: LayoutParagraphBlock[];
|
|
508
|
+
}
|
|
509
|
+
interface LayoutTableRow {
|
|
510
|
+
id: string;
|
|
511
|
+
backgroundColor?: string;
|
|
512
|
+
cells: LayoutTableCell[];
|
|
513
|
+
}
|
|
514
|
+
interface LayoutTableBlock {
|
|
515
|
+
kind: "table";
|
|
516
|
+
id: string;
|
|
517
|
+
x: number;
|
|
518
|
+
y: number;
|
|
519
|
+
width: number;
|
|
520
|
+
height: number;
|
|
521
|
+
rows: LayoutTableRow[];
|
|
522
|
+
}
|
|
523
|
+
type LayoutBlock = LayoutParagraphBlock | LayoutTableBlock;
|
|
524
|
+
interface LayoutPage {
|
|
525
|
+
number: number;
|
|
526
|
+
blocks: LayoutBlock[];
|
|
527
|
+
}
|
|
528
|
+
declare function layoutDocument(model: DocModel, options?: LayoutOptions): LayoutPage[];
|
|
4
529
|
|
|
5
530
|
interface DocumentLayoutMetrics {
|
|
6
531
|
pageWidthPx: number;
|
|
@@ -298,6 +823,7 @@ interface DocxEditorViewerProps {
|
|
|
298
823
|
editor: DocxEditorController;
|
|
299
824
|
className?: string;
|
|
300
825
|
style?: React.CSSProperties;
|
|
826
|
+
pageBackgroundColor?: string;
|
|
301
827
|
pageGapBackgroundColor?: string;
|
|
302
828
|
deferInitialPaginationPaint?: boolean;
|
|
303
829
|
loadingState?: React.ReactNode;
|
|
@@ -402,8 +928,46 @@ interface DocxPaginationInfo {
|
|
|
402
928
|
interface UseDocxPaginationResult {
|
|
403
929
|
pagination: DocxPaginationInfo;
|
|
404
930
|
}
|
|
931
|
+
interface DocxPageThumbnailResolutionOptions {
|
|
932
|
+
sourceWidthPx: number;
|
|
933
|
+
sourceHeightPx: number;
|
|
934
|
+
maxWidthPx?: number;
|
|
935
|
+
maxHeightPx?: number;
|
|
936
|
+
pixelRatio?: number;
|
|
937
|
+
}
|
|
938
|
+
interface DocxPageThumbnailResolution {
|
|
939
|
+
widthPx: number;
|
|
940
|
+
heightPx: number;
|
|
941
|
+
pixelWidthPx: number;
|
|
942
|
+
pixelHeightPx: number;
|
|
943
|
+
scale: number;
|
|
944
|
+
}
|
|
945
|
+
interface UseDocxPageThumbnailsOptions {
|
|
946
|
+
maxWidthPx?: number;
|
|
947
|
+
maxHeightPx?: number;
|
|
948
|
+
pixelRatio?: number;
|
|
949
|
+
disabled?: boolean;
|
|
950
|
+
}
|
|
951
|
+
type DocxPageThumbnailStatus = "idle" | "rendering" | "ready" | "unavailable" | "error";
|
|
952
|
+
interface DocxPageThumbnailItem extends DocxPageThumbnailResolution {
|
|
953
|
+
pageIndex: number;
|
|
954
|
+
pageNumber: number;
|
|
955
|
+
sourceWidthPx: number;
|
|
956
|
+
sourceHeightPx: number;
|
|
957
|
+
isMounted: boolean;
|
|
958
|
+
status: DocxPageThumbnailStatus;
|
|
959
|
+
error?: Error;
|
|
960
|
+
canvasRef: (canvas: HTMLCanvasElement | null) => void;
|
|
961
|
+
renderToCanvas: (canvas: HTMLCanvasElement) => Promise<void>;
|
|
962
|
+
}
|
|
963
|
+
interface UseDocxPageThumbnailsResult {
|
|
964
|
+
thumbnails: DocxPageThumbnailItem[];
|
|
965
|
+
rerenderAttachedThumbnails: () => Promise<void>;
|
|
966
|
+
}
|
|
405
967
|
declare const defaultStarterModel: DocModel;
|
|
406
968
|
declare function useDocxEditor(options?: UseDocxEditorOptions): DocxEditorController;
|
|
969
|
+
declare function resolveDocxPageThumbnailResolution(options: DocxPageThumbnailResolutionOptions): DocxPageThumbnailResolution;
|
|
970
|
+
declare function useDocxPageThumbnails(editor: DocxEditorController, options?: UseDocxPageThumbnailsOptions): UseDocxPageThumbnailsResult;
|
|
407
971
|
declare function useDocxDocumentTheme(editor: Pick<DocxEditorController, "documentTheme" | "setDocumentTheme">): UseDocxDocumentThemeResult;
|
|
408
972
|
declare function useDocxParagraphStyles(editor: Pick<DocxEditorController, "availableParagraphStyles" | "selectedParagraphStyleId" | "setParagraphStyle">): UseDocxParagraphStylesResult;
|
|
409
973
|
declare function useDocxImageWrapMenu(menu: Pick<DocxContextMenuRenderProps, "context" | "runAction">): UseDocxImageWrapMenuResult | undefined;
|
|
@@ -413,7 +977,255 @@ declare function useDocxFormFields(editor: Pick<DocxEditorController, "model" |
|
|
|
413
977
|
declare function useDocxTrackChanges(editor: Pick<DocxEditorController, "trackedChanges" | "showTrackedChanges" | "setShowTrackedChanges" | "toggleShowTrackedChanges">): UseDocxTrackChangesResult;
|
|
414
978
|
declare function useDocxPageLayout(editor: Pick<DocxEditorController, "model">): UseDocxPageLayoutResult;
|
|
415
979
|
declare function useDocxPagination(editor: Pick<DocxEditorController, "currentPage" | "totalPages">): UseDocxPaginationResult;
|
|
416
|
-
declare function DocxEditorViewer({ editor, className, style, pageGapBackgroundColor, deferInitialPaginationPaint, loadingState, pageVirtualization, visiblePageRange, onPageCountChange, onRequestPageReveal, headingStyles, showTrackedChanges, renderTrackedChangeCard, renderTableContextMenu, renderContextMenu, onFormFieldDoubleClick, mode, }: DocxEditorViewerProps): React.JSX.Element;
|
|
980
|
+
declare function DocxEditorViewer({ editor, className, style, pageBackgroundColor, pageGapBackgroundColor, deferInitialPaginationPaint, loadingState, pageVirtualization, visiblePageRange, onPageCountChange, onRequestPageReveal, headingStyles, showTrackedChanges, renderTrackedChangeCard, renderTableContextMenu, renderContextMenu, onFormFieldDoubleClick, mode, }: DocxEditorViewerProps): React.JSX.Element;
|
|
981
|
+
|
|
982
|
+
interface InsertParagraphOptions {
|
|
983
|
+
paragraphStyle?: ParagraphStyle;
|
|
984
|
+
runStyle?: TextStyle;
|
|
985
|
+
}
|
|
986
|
+
interface UpdateTextOptions {
|
|
987
|
+
insertedStyle?: TextStyle;
|
|
988
|
+
}
|
|
989
|
+
declare function splitParagraphChildrenAtTextOffsets(paragraph: ParagraphNode, text: string, startOffset: number, endOffset: number, options?: {
|
|
990
|
+
beforeInsertedStyle?: TextStyle;
|
|
991
|
+
afterInsertedStyle?: TextStyle;
|
|
992
|
+
}): {
|
|
993
|
+
beforeChildren: ParagraphNode["children"];
|
|
994
|
+
afterChildren: ParagraphNode["children"];
|
|
995
|
+
};
|
|
996
|
+
declare function insertParagraph(model: DocModel, text: string, index?: number, options?: InsertParagraphOptions): DocModel;
|
|
997
|
+
declare function removeParagraph(model: DocModel, index: number): DocModel;
|
|
998
|
+
declare function duplicateParagraph(model: DocModel, index: number): DocModel;
|
|
999
|
+
declare function updateParagraphText(model: DocModel, index: number, text: string, options?: UpdateTextOptions): DocModel;
|
|
1000
|
+
declare function updateTableCellText(model: DocModel, tableIndex: number, rowIndex: number, cellIndex: number, text: string, options?: UpdateTextOptions): DocModel;
|
|
1001
|
+
declare function updateTableCellParagraphText(model: DocModel, tableIndex: number, rowIndex: number, cellIndex: number, paragraphIndex: number, text: string, options?: UpdateTextOptions): DocModel;
|
|
1002
|
+
declare function updateTableCellParagraphTextRecursive(model: DocModel, tableIndex: number, rowIndex: number, cellIndex: number, paragraphIndex: number, text: string, options?: UpdateTextOptions): DocModel;
|
|
1003
|
+
declare function replaceText(model: DocModel, searchValue: string | RegExp, replacement: string): DocModel;
|
|
1004
|
+
declare function setParagraphHeading(model: DocModel, nodeIndex: number, headingLevel?: HeadingLevel): DocModel;
|
|
1005
|
+
declare function setParagraphAlignment(model: DocModel, nodeIndex: number, align?: ParagraphAlignment): DocModel;
|
|
1006
|
+
declare function applyRunStyle(model: DocModel, nodeIndex: number, runIndex: number, style: Partial<TextStyle>): DocModel;
|
|
1007
|
+
declare function toggleRunStyleFlag(model: DocModel, nodeIndex: number, runIndex: number, key: "bold" | "italic" | "underline" | "strike"): DocModel;
|
|
1008
|
+
declare function setRunHighlight(model: DocModel, nodeIndex: number, runIndex: number, highlight?: string): DocModel;
|
|
1009
|
+
declare function setRunColor(model: DocModel, nodeIndex: number, runIndex: number, color?: string): DocModel;
|
|
1010
|
+
declare function copyParagraphs(model: DocModel, startIndex: number, endIndex?: number): ParagraphNode[];
|
|
1011
|
+
declare function pasteParagraphs(model: DocModel, index: number, paragraphs: ParagraphNode[]): DocModel;
|
|
1012
|
+
declare function serializeParagraphsForClipboard(paragraphs: ParagraphNode[]): string;
|
|
1013
|
+
declare function parseParagraphsFromClipboard(input: string): ParagraphNode[] | undefined;
|
|
1014
|
+
|
|
1015
|
+
interface ResolvedModelSection {
|
|
1016
|
+
startNodeIndex: number;
|
|
1017
|
+
sectionPropertiesXml?: string;
|
|
1018
|
+
headerSections: HeaderSection[];
|
|
1019
|
+
footerSections: FooterSection[];
|
|
1020
|
+
}
|
|
1021
|
+
interface PaginationSectionMetrics {
|
|
1022
|
+
startNodeIndex: number;
|
|
1023
|
+
pageContentWidthPx: number;
|
|
1024
|
+
pageContentHeightPx: number;
|
|
1025
|
+
docGridLinePitchPx?: number;
|
|
1026
|
+
}
|
|
1027
|
+
interface TableExplicitPageBreakInfo {
|
|
1028
|
+
startRowIndexes: number[];
|
|
1029
|
+
breakAfterTable: boolean;
|
|
1030
|
+
}
|
|
1031
|
+
interface DocumentPageRange {
|
|
1032
|
+
startNodeIndex: number;
|
|
1033
|
+
endNodeIndex: number;
|
|
1034
|
+
}
|
|
1035
|
+
declare function sectionBreakPropertiesStartNewPage(sectionPropertiesXml: string): boolean;
|
|
1036
|
+
declare function paragraphHasExplicitPageBreak(paragraph: ParagraphNode): boolean;
|
|
1037
|
+
declare function paragraphHasPageBreakBefore(paragraph: ParagraphNode): boolean;
|
|
1038
|
+
declare function sectionBreakAfterParagraphStartsNewPage(paragraph: ParagraphNode): boolean;
|
|
1039
|
+
declare function paragraphHasLastRenderedPageBreak(paragraph: ParagraphNode): boolean;
|
|
1040
|
+
declare function paragraphStartsWithLastRenderedPageBreak(paragraph: ParagraphNode): boolean;
|
|
1041
|
+
declare function paragraphBeforeSpacingPx(paragraph: ParagraphNode): number;
|
|
1042
|
+
declare function paragraphAfterSpacingPx(paragraph: ParagraphNode): number;
|
|
1043
|
+
declare function resolveParagraphBeforeSpacingPx(model: DocModel, nodeIndex: number, paragraph: ParagraphNode, pageConsumedHeightPx: number, suppressSpacingBeforeAfterPageBreak: boolean): number;
|
|
1044
|
+
declare function resolveDocumentSectionsFromMetadata(metadata: DocModel["metadata"]): ResolvedModelSection[];
|
|
1045
|
+
declare function sectionTitlePageEnabled(sectionPropertiesXml?: string): boolean;
|
|
1046
|
+
declare function selectSectionVariantForPage<T extends HeaderSection | FooterSection>(sections: T[], sectionPropertiesXml: string | undefined, pageIndex: number, options?: {
|
|
1047
|
+
evenAndOddHeaders?: boolean;
|
|
1048
|
+
}): T | undefined;
|
|
1049
|
+
declare function resolveSectionIndexForNodeIndex(sections: Pick<ResolvedModelSection, "startNodeIndex">[], nodeIndex: number, previousSectionIndex: number): number;
|
|
1050
|
+
declare function resolveSectionPropertiesXmlForNodeIndex(sections: ResolvedModelSection[], nodeIndex: number, fallbackSectionPropertiesXml?: string): string | undefined;
|
|
1051
|
+
declare function resolvePaginationSectionMetricsIndexForNodeIndex(metricsBySection: PaginationSectionMetrics[], nodeIndex: number, previousSectionIndex: number): number;
|
|
1052
|
+
declare function scalePaginationSectionMetricsHeights(metricsBySection: PaginationSectionMetrics[], heightScale: number): PaginationSectionMetrics[];
|
|
1053
|
+
declare function collectTableExplicitPageBreakInfo(table: TableNode): TableExplicitPageBreakInfo;
|
|
1054
|
+
declare function collectTopLevelExplicitPageBreakStartNodeIndexes(nodes: DocModel["nodes"]): Set<number>;
|
|
1055
|
+
declare function collectDocxHardPageBreakStartNodeIndexes(model: DocModel): Set<number>;
|
|
1056
|
+
declare function collectDocxLastRenderedPageBreakStartNodeIndexes(model: DocModel): number[];
|
|
1057
|
+
declare function buildDocumentPageRanges(nodeCount: number, pageBreakStartNodeIndexes: Iterable<number>): DocumentPageRange[];
|
|
1058
|
+
|
|
1059
|
+
declare const DEFAULT_PAGE_OVERFLOW_TOLERANCE_PX = 2;
|
|
1060
|
+
declare const DEFAULT_MIN_PARAGRAPH_LINE_HEIGHT_PX = 14;
|
|
1061
|
+
interface TableRowRange {
|
|
1062
|
+
startRowIndex: number;
|
|
1063
|
+
endRowIndex: number;
|
|
1064
|
+
}
|
|
1065
|
+
interface ParagraphLineRange {
|
|
1066
|
+
startLineIndex: number;
|
|
1067
|
+
endLineIndex: number;
|
|
1068
|
+
totalLineCount: number;
|
|
1069
|
+
lineHeightPx: number;
|
|
1070
|
+
}
|
|
1071
|
+
interface DocumentPageNodeSegment {
|
|
1072
|
+
nodeIndex: number;
|
|
1073
|
+
tableRowRange?: TableRowRange;
|
|
1074
|
+
paragraphLineRange?: ParagraphLineRange;
|
|
1075
|
+
}
|
|
1076
|
+
interface LetterheadColumnSegmentGroup {
|
|
1077
|
+
startOffset: number;
|
|
1078
|
+
endOffset: number;
|
|
1079
|
+
leftSegments: DocumentPageNodeSegment[];
|
|
1080
|
+
rightSegments: DocumentPageNodeSegment[];
|
|
1081
|
+
}
|
|
1082
|
+
interface ParagraphSplitControlOptions {
|
|
1083
|
+
allowKeepLinesOverflow?: boolean;
|
|
1084
|
+
allowKeepNextOverflow?: boolean;
|
|
1085
|
+
}
|
|
1086
|
+
interface PageSegmentationCallbacks {
|
|
1087
|
+
estimateDocNodeHeightPx: (node: DocModel["nodes"][number], availableWidthPx?: number, numberingDefinitions?: NumberingDefinitionSet, docGridLinePitchPx?: number) => number;
|
|
1088
|
+
paragraphHasVisibleText: (paragraph: ParagraphNode) => boolean;
|
|
1089
|
+
paragraphIsStructuralSectionBreakSpacer: (paragraph: ParagraphNode) => boolean;
|
|
1090
|
+
estimateParagraphHeightPx: (paragraph: ParagraphNode, availableWidthPx?: number, numberingDefinitions?: NumberingDefinitionSet, docGridLinePitchPx?: number) => number;
|
|
1091
|
+
estimateParagraphLineHeightPx: (paragraph: ParagraphNode, docGridLinePitchPx?: number) => number;
|
|
1092
|
+
paragraphLineCountWithinWidth: (paragraph: ParagraphNode, availableWidthPx?: number, numberingDefinitions?: NumberingDefinitionSet) => number;
|
|
1093
|
+
paragraphWidowControlEnabled: (paragraph: ParagraphNode) => boolean;
|
|
1094
|
+
paragraphCanSplitAcrossPages: (paragraph: ParagraphNode, lineCount: number, options?: ParagraphSplitControlOptions) => boolean;
|
|
1095
|
+
estimateTableRowHeightsPx: (table: TableNode, maxAvailableWidthPx?: number, numberingDefinitions?: NumberingDefinitionSet, docGridLinePitchPx?: number) => number[];
|
|
1096
|
+
}
|
|
1097
|
+
interface OverflowBreakCollectionOptions {
|
|
1098
|
+
suppressSpacingBeforeAfterPageBreak?: boolean;
|
|
1099
|
+
pageOverflowTolerancePx?: number;
|
|
1100
|
+
}
|
|
1101
|
+
interface DocumentPageSegmentationOptions extends OverflowBreakCollectionOptions {
|
|
1102
|
+
allowParagraphLineSplitting?: boolean;
|
|
1103
|
+
measuredTableRowHeightsByNodeIndex?: Record<number, number[]>;
|
|
1104
|
+
measuredPageContentHeightsPxByPageIndex?: number[];
|
|
1105
|
+
minParagraphLineHeightPx?: number;
|
|
1106
|
+
preferLastRenderedParagraphStartBreaks?: boolean;
|
|
1107
|
+
}
|
|
1108
|
+
declare function paragraphLetterheadColumnGroupAtSegmentOffset(nodeSegments: DocumentPageNodeSegment[], startOffset: number, resolveFloatSideAtNodeIndex: (nodeIndex: number) => "left" | "right" | undefined): LetterheadColumnSegmentGroup | undefined;
|
|
1109
|
+
declare function collectDocxEstimatedOverflowBreakStartNodeIndexes(model: DocModel, hardBreakStartNodeIndexes: Set<number>, pageContentHeightPx: number, pageContentWidthPx: number, callbacks: PageSegmentationCallbacks, numberingDefinitions?: NumberingDefinitionSet, paginationMetricsBySection?: PaginationSectionMetrics[], options?: OverflowBreakCollectionOptions): Set<number>;
|
|
1110
|
+
declare function buildDocumentPageNodeSegments(model: DocModel, pageContentHeightPx: number, pageContentWidthPx: number, callbacks: PageSegmentationCallbacks, numberingDefinitions?: NumberingDefinitionSet, paginationMetricsBySection?: PaginationSectionMetrics[], options?: DocumentPageSegmentationOptions): DocumentPageNodeSegment[][];
|
|
1111
|
+
declare function resolveDocumentPageSegmentStartNodeIndex(pageSegments: DocumentPageNodeSegment[]): number | undefined;
|
|
1112
|
+
declare function scorePaginationAgainstStoredPageBreaks(pages: DocumentPageNodeSegment[][], storedBreakStartNodeIndexes: number[]): number;
|
|
1113
|
+
|
|
1114
|
+
type LayoutSnapshotOptions = LayoutOptions;
|
|
1115
|
+
interface LayoutSnapshotRect {
|
|
1116
|
+
x: number;
|
|
1117
|
+
y: number;
|
|
1118
|
+
width: number;
|
|
1119
|
+
height: number;
|
|
1120
|
+
}
|
|
1121
|
+
interface LayoutSnapshotPageSize {
|
|
1122
|
+
width: number;
|
|
1123
|
+
height: number;
|
|
1124
|
+
}
|
|
1125
|
+
interface LayoutSnapshotMargins {
|
|
1126
|
+
top: number;
|
|
1127
|
+
right: number;
|
|
1128
|
+
bottom: number;
|
|
1129
|
+
left: number;
|
|
1130
|
+
}
|
|
1131
|
+
interface ResolvedLayoutMetrics {
|
|
1132
|
+
pageSizePx: LayoutSnapshotPageSize;
|
|
1133
|
+
marginsPx: LayoutSnapshotMargins;
|
|
1134
|
+
contentBoxPx: LayoutSnapshotRect;
|
|
1135
|
+
}
|
|
1136
|
+
interface ResolvedDocumentSection {
|
|
1137
|
+
index: number;
|
|
1138
|
+
startNodeIndex: number;
|
|
1139
|
+
synthetic: boolean;
|
|
1140
|
+
layout: ResolvedLayoutMetrics;
|
|
1141
|
+
}
|
|
1142
|
+
interface ResolvedDocument {
|
|
1143
|
+
source: "layout-engine-adapter";
|
|
1144
|
+
nodeCount: number;
|
|
1145
|
+
pageCountHint?: number;
|
|
1146
|
+
layout: ResolvedLayoutMetrics;
|
|
1147
|
+
sections: ResolvedDocumentSection[];
|
|
1148
|
+
metadata: {
|
|
1149
|
+
sourceParts: number;
|
|
1150
|
+
warningCount: number;
|
|
1151
|
+
warnings: string[];
|
|
1152
|
+
headerSectionCount: number;
|
|
1153
|
+
footerSectionCount: number;
|
|
1154
|
+
};
|
|
1155
|
+
}
|
|
1156
|
+
interface LayoutFragmentSource {
|
|
1157
|
+
kind: "paragraph" | "table" | "table-cell" | "table-cell-paragraph";
|
|
1158
|
+
nodeIndex: number;
|
|
1159
|
+
rowIndex?: number;
|
|
1160
|
+
cellIndex?: number;
|
|
1161
|
+
paragraphIndex?: number;
|
|
1162
|
+
}
|
|
1163
|
+
interface LayoutSnapshotTextRun {
|
|
1164
|
+
kind: "text";
|
|
1165
|
+
id: string;
|
|
1166
|
+
text: string;
|
|
1167
|
+
style?: TextStyle;
|
|
1168
|
+
link?: string;
|
|
1169
|
+
}
|
|
1170
|
+
interface LayoutSnapshotImageRun {
|
|
1171
|
+
kind: "image";
|
|
1172
|
+
id: string;
|
|
1173
|
+
src?: string;
|
|
1174
|
+
alt?: string;
|
|
1175
|
+
widthPx?: number;
|
|
1176
|
+
heightPx?: number;
|
|
1177
|
+
floating?: boolean;
|
|
1178
|
+
}
|
|
1179
|
+
type LayoutSnapshotRun = LayoutSnapshotTextRun | LayoutSnapshotImageRun;
|
|
1180
|
+
interface LayoutSnapshotParagraphFragment {
|
|
1181
|
+
kind: "paragraph";
|
|
1182
|
+
id: string;
|
|
1183
|
+
framePx: LayoutSnapshotRect;
|
|
1184
|
+
align: ParagraphAlignment;
|
|
1185
|
+
headingLevel?: HeadingLevel;
|
|
1186
|
+
runs: LayoutSnapshotRun[];
|
|
1187
|
+
source?: LayoutFragmentSource;
|
|
1188
|
+
}
|
|
1189
|
+
interface LayoutSnapshotTableCellFragment {
|
|
1190
|
+
id: string;
|
|
1191
|
+
colSpan?: number;
|
|
1192
|
+
backgroundColor?: string;
|
|
1193
|
+
paragraphs: LayoutSnapshotParagraphFragment[];
|
|
1194
|
+
source?: LayoutFragmentSource;
|
|
1195
|
+
}
|
|
1196
|
+
interface LayoutSnapshotTableRowFragment {
|
|
1197
|
+
id: string;
|
|
1198
|
+
backgroundColor?: string;
|
|
1199
|
+
cells: LayoutSnapshotTableCellFragment[];
|
|
1200
|
+
}
|
|
1201
|
+
interface LayoutSnapshotTableFragment {
|
|
1202
|
+
kind: "table";
|
|
1203
|
+
id: string;
|
|
1204
|
+
framePx: LayoutSnapshotRect;
|
|
1205
|
+
rows: LayoutSnapshotTableRowFragment[];
|
|
1206
|
+
source?: LayoutFragmentSource;
|
|
1207
|
+
}
|
|
1208
|
+
type LayoutSnapshotBlockFragment = LayoutSnapshotParagraphFragment | LayoutSnapshotTableFragment;
|
|
1209
|
+
interface LayoutSnapshotPage {
|
|
1210
|
+
index: number;
|
|
1211
|
+
number: number;
|
|
1212
|
+
pageSizePx: LayoutSnapshotPageSize;
|
|
1213
|
+
marginsPx: LayoutSnapshotMargins;
|
|
1214
|
+
contentBoxPx: LayoutSnapshotRect;
|
|
1215
|
+
blocks: LayoutSnapshotBlockFragment[];
|
|
1216
|
+
}
|
|
1217
|
+
interface LayoutSnapshot {
|
|
1218
|
+
version: 1;
|
|
1219
|
+
source: "layout-engine-adapter";
|
|
1220
|
+
resolvedDocument: ResolvedDocument;
|
|
1221
|
+
pages: LayoutSnapshotPage[];
|
|
1222
|
+
}
|
|
1223
|
+
declare function resolveDocumentForLayout(model: DocModel, options?: LayoutSnapshotOptions): ResolvedDocument;
|
|
1224
|
+
declare function buildLayoutSnapshot(model: DocModel, options?: LayoutSnapshotOptions): LayoutSnapshot;
|
|
1225
|
+
|
|
1226
|
+
declare function modelToDocumentXml(model: DocModel, basePackage?: OoxmlPackage): string;
|
|
1227
|
+
declare function serializeDocModel(model: DocModel, basePackage?: OoxmlPackage): OoxmlPackage;
|
|
1228
|
+
declare function serializeDocx(model: DocModel, basePackage?: OoxmlPackage): ArrayBuffer;
|
|
417
1229
|
|
|
418
1230
|
interface ReactDocxViewerProps {
|
|
419
1231
|
file?: ArrayBuffer;
|
|
@@ -430,4 +1242,4 @@ interface UseDocxModelState {
|
|
|
430
1242
|
declare function useDocxModel(file?: ArrayBuffer): UseDocxModelState;
|
|
431
1243
|
declare function ReactDocxViewer({ file, model, className, layoutOptions, emptyState }: ReactDocxViewerProps): React.JSX.Element;
|
|
432
1244
|
|
|
433
|
-
export { type DocxBorderContext, type DocxBorderPreset, type DocxBorderPresetState, type DocxContextMenuAction, type DocxContextMenuActionId, type DocxContextMenuContext, type DocxContextMenuRenderProps, type DocxDocumentTheme, type DocxEditorController, type DocxEditorSelection, DocxEditorViewer, type DocxEditorViewerMode, type DocxEditorViewerProps, type DocxFormFieldLocation, type DocxHeadingStyleMap, type DocxImageDropTarget, type DocxImageLocation, type DocxImageWrapMenuOption, type DocxImageWrapMode, type DocxImageWrapState, type DocxLineSpacingInfo, type DocxListType, type DocxPageLayoutInfo, type DocxPaginationInfo, type DocxSectionColumnLayout, type DocxSelectedFormField, type DocxTableContextMenuAction, type DocxTableContextMenuActionId, type DocxTableContextMenuContext, type DocxTableContextMenuRenderProps, type DocxTextRange, type DocxTextRangeLocation, type DocxTrackedChange, type DocxTrackedChangeCardRenderProps, type DocxTrackedChangeKind, ReactDocxViewer, type ReactDocxViewerProps, type UseDocxBordersResult, type UseDocxDocumentThemeResult, type UseDocxEditorOptions, type UseDocxFormFieldsResult, type UseDocxImageWrapMenuResult, type UseDocxLineSpacingResult, type UseDocxModelState, type UseDocxPageLayoutResult, type UseDocxPaginationResult, type UseDocxParagraphStylesResult, type UseDocxTrackChangesResult, defaultStarterModel, paragraphLetterheadFloatSideAtNodeIndex, parseSectionLayout, resolveDocumentLayout, useDocxBorders, useDocxDocumentTheme, useDocxEditor, useDocxFormFields, useDocxImageWrapMenu, useDocxLineSpacing, useDocxModel, useDocxPageLayout, useDocxPagination, useDocxParagraphStyles, useDocxTrackChanges };
|
|
1245
|
+
export { DEFAULT_MIN_PARAGRAPH_LINE_HEIGHT_PX, DEFAULT_PAGE_OVERFLOW_TOLERANCE_PX, type DocModel, type DocNode, type DocumentCompatibilitySettings, type DocumentNoteDefinition, type DocumentPageNodeSegment, type DocumentPageRange, type DocumentPageSegmentationOptions, type DocumentSection, type DocxBorderContext, type DocxBorderPreset, type DocxBorderPresetState, type DocxContextMenuAction, type DocxContextMenuActionId, type DocxContextMenuContext, type DocxContextMenuRenderProps, type DocxDocumentTheme, type DocxEditorController, type DocxEditorSelection, DocxEditorViewer, type DocxEditorViewerMode, type DocxEditorViewerProps, type DocxFormFieldLocation, type DocxHeadingStyleMap, type DocxImageDropTarget, type DocxImageLocation, type DocxImageWrapMenuOption, type DocxImageWrapMode, type DocxImageWrapState, type DocxLineSpacingInfo, type DocxListType, type DocxPageLayoutInfo, type DocxPageThumbnailItem, type DocxPageThumbnailResolution, type DocxPageThumbnailResolutionOptions, type DocxPageThumbnailStatus, type DocxPaginationInfo, type DocxSectionColumnLayout, type DocxSelectedFormField, type DocxTableContextMenuAction, type DocxTableContextMenuActionId, type DocxTableContextMenuContext, type DocxTableContextMenuRenderProps, type DocxTextRange, type DocxTextRangeLocation, type DocxTrackedChange, type DocxTrackedChangeCardRenderProps, type DocxTrackedChangeKind, type FooterSection, type FormFieldCheckboxWidgetSettings, type FormFieldDropdownWidgetSettings, type FormFieldOption, type FormFieldRunNode, type FormFieldSourceKind, type FormFieldTextWidgetSettings, type FormFieldType, type FormFieldWidgetSettings, type HeaderSection, type HeadingLevel, type ImageRunNode, type InsertParagraphOptions, type LayoutBlock, type LayoutFragmentSource, type LayoutImageRun, type LayoutOptions, type LayoutPage, type LayoutParagraphBlock, type LayoutRun, type LayoutSnapshot, type LayoutSnapshotBlockFragment, type LayoutSnapshotImageRun, type LayoutSnapshotMargins, type LayoutSnapshotOptions, type LayoutSnapshotPage, type LayoutSnapshotPageSize, type LayoutSnapshotParagraphFragment, type LayoutSnapshotRect, type LayoutSnapshotRun, type LayoutSnapshotTableCellFragment, type LayoutSnapshotTableFragment, type LayoutSnapshotTableRowFragment, type LayoutSnapshotTextRun, type LayoutTableBlock, type LayoutTableCell, type LayoutTableRow, type LayoutTextRun, type LetterheadColumnSegmentGroup, type NumberingAbstractDefinition, type NumberingDefinitionSet, type NumberingInstanceDefinition, type NumberingLevelDefinition, type NumberingPictureBulletDefinition, type OoxmlPackage, type OoxmlPart, type OverflowBreakCollectionOptions, type PageSegmentationCallbacks, type PaginationSectionMetrics, type ParagraphAlignment, type ParagraphBorderSet, type ParagraphBorderStyle, type ParagraphChildNode, type ParagraphIndent, type ParagraphLineRange, type ParagraphNode, type ParagraphNumbering, type ParagraphSpacing, type ParagraphSplitControlOptions, type ParagraphStyle, type ParagraphStyleDefinition, ReactDocxViewer, type ReactDocxViewerProps, type ResolvedDocument, type ResolvedDocumentSection, type ResolvedLayoutMetrics, type ResolvedModelSection, type TableBorderSet, type TableBorderStyle, type TableBoxSpacing, type TableCellContentNode, type TableCellNode, type TableCellStyle, type TableExplicitPageBreakInfo, type TableNode, type TableRowNode, type TableRowRange, type TableRowStyle, type TableStyle, type TextRunBorderStyle, type TextRunNode, type TextStyle, type UpdateTextOptions, type UseDocxBordersResult, type UseDocxDocumentThemeResult, type UseDocxEditorOptions, type UseDocxFormFieldsResult, type UseDocxImageWrapMenuResult, type UseDocxLineSpacingResult, type UseDocxModelState, type UseDocxPageLayoutResult, type UseDocxPageThumbnailsOptions, type UseDocxPageThumbnailsResult, type UseDocxPaginationResult, type UseDocxParagraphStylesResult, type UseDocxTrackChangesResult, applyRunStyle, buildDocModel, buildDocumentPageNodeSegments, buildDocumentPageRanges, buildLayoutSnapshot, cloneDocModel, collectDocxEstimatedOverflowBreakStartNodeIndexes, collectDocxHardPageBreakStartNodeIndexes, collectDocxLastRenderedPageBreakStartNodeIndexes, collectTableExplicitPageBreakInfo, collectTopLevelExplicitPageBreakStartNodeIndexes, copyParagraphs, createMinimalDocxPackage, defaultStarterModel, duplicateParagraph, getPart, insertParagraph, layoutDocument, modelToDocumentXml, packageToArrayBuffer, paragraphAfterSpacingPx, paragraphBeforeSpacingPx, paragraphHasExplicitPageBreak, paragraphHasLastRenderedPageBreak, paragraphHasPageBreakBefore, paragraphLetterheadColumnGroupAtSegmentOffset, paragraphLetterheadFloatSideAtNodeIndex, paragraphStartsWithLastRenderedPageBreak, parseDocumentXml, parseDocx, parseParagraphsFromClipboard, parseSectionLayout, pasteParagraphs, removeParagraph, replaceText, resolveDocumentForLayout, resolveDocumentLayout, resolveDocumentPageSegmentStartNodeIndex, resolveDocumentSectionsFromMetadata, resolveDocxPageThumbnailResolution, resolvePaginationSectionMetricsIndexForNodeIndex, resolveParagraphBeforeSpacingPx, resolveSectionIndexForNodeIndex, resolveSectionPropertiesXmlForNodeIndex, scalePaginationSectionMetricsHeights, scorePaginationAgainstStoredPageBreaks, sectionBreakAfterParagraphStartsNewPage, sectionBreakPropertiesStartNewPage, sectionTitlePageEnabled, selectSectionVariantForPage, serializeDocModel, serializeDocx, serializeParagraphsForClipboard, setParagraphAlignment, setParagraphHeading, setRunColor, setRunHighlight, splitParagraphChildrenAtTextOffsets, toggleRunStyleFlag, updateParagraphText, updateTableCellParagraphText, updateTableCellParagraphTextRecursive, updateTableCellText, useDocxBorders, useDocxDocumentTheme, useDocxEditor, useDocxFormFields, useDocxImageWrapMenu, useDocxLineSpacing, useDocxModel, useDocxPageLayout, useDocxPageThumbnails, useDocxPagination, useDocxParagraphStyles, useDocxTrackChanges, withPart };
|