@docx4j/core-ts 0.5.0 → 0.7.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/NOTICE +4 -0
- package/README.md +92 -4
- package/dist/html/convert.mjs +2 -1
- package/dist/html/elements.mjs +2 -1
- package/dist/model/color/ColorMath.d.mts +29 -0
- package/dist/model/color/ColorMath.mjs +146 -0
- package/dist/model/color/ColorTables.d.mts +6 -0
- package/dist/model/color/ColorTables.mjs +83 -0
- package/dist/model/color/DrawingMLColors.d.mts +52 -0
- package/dist/model/color/DrawingMLColors.mjs +374 -0
- package/dist/model/color/ResolvedColor.d.mts +36 -0
- package/dist/model/color/ResolvedColor.mjs +65 -0
- package/dist/model/color/SpreadsheetColors.d.mts +36 -0
- package/dist/model/color/SpreadsheetColors.mjs +84 -0
- package/dist/model/color/StyleFill.d.mts +28 -0
- package/dist/model/color/StyleFill.mjs +21 -0
- package/dist/model/color/ThemeColors.d.mts +86 -0
- package/dist/model/color/ThemeColors.mjs +304 -0
- package/dist/model/color/WordColors.d.mts +71 -0
- package/dist/model/color/WordColors.mjs +121 -0
- package/dist/model/color/index.d.mts +6 -0
- package/dist/model/color/index.mjs +30 -0
- package/dist/model/content/Body.d.mts +145 -23
- package/dist/model/content/Body.mjs +507 -150
- package/dist/model/content/Comment.d.mts +23 -5
- package/dist/model/content/Comment.mjs +207 -26
- package/dist/model/content/ContentControl.d.mts +198 -19
- package/dist/model/content/ContentControl.mjs +672 -99
- package/dist/model/content/Font.d.mts +70 -17
- package/dist/model/content/Font.mjs +119 -36
- package/dist/model/content/InlinePicture.d.mts +11 -0
- package/dist/model/content/InlinePicture.mjs +21 -1
- package/dist/model/content/List.d.mts +6 -3
- package/dist/model/content/List.mjs +18 -8
- package/dist/model/content/Paragraph.d.mts +200 -14
- package/dist/model/content/Paragraph.mjs +898 -82
- package/dist/model/content/Range.d.mts +227 -12
- package/dist/model/content/Range.mjs +785 -59
- package/dist/model/content/ResolvedView.d.mts +104 -0
- package/dist/model/content/ResolvedView.mjs +596 -0
- package/dist/model/content/Table.d.mts +29 -3
- package/dist/model/content/Table.mjs +135 -49
- package/dist/model/content/TrackedChange.d.mts +174 -15
- package/dist/model/content/TrackedChange.mjs +734 -170
- package/dist/model/content/comments.d.mts +20 -6
- package/dist/model/content/comments.mjs +67 -57
- package/dist/model/content/generalException.d.mts +18 -0
- package/dist/model/content/generalException.mjs +24 -0
- package/dist/model/content/index.d.mts +10 -3
- package/dist/model/content/index.mjs +10 -2
- package/dist/model/content/mathText.d.mts +21 -0
- package/dist/model/content/mathText.mjs +267 -0
- package/dist/model/content/officeText.d.mts +27 -0
- package/dist/model/content/officeText.mjs +74 -0
- package/dist/model/content/ooxml.mjs +12 -1
- package/dist/model/content/outline.d.mts +5 -0
- package/dist/model/content/outline.mjs +13 -0
- package/dist/model/content/paraIds.d.mts +5 -0
- package/dist/model/content/paraIds.mjs +54 -0
- package/dist/model/content/placeholders.d.mts +110 -0
- package/dist/model/content/placeholders.mjs +253 -0
- package/dist/model/content/search.d.mts +74 -0
- package/dist/model/content/search.mjs +255 -9
- package/dist/model/content/spanEdits.d.mts +159 -0
- package/dist/model/content/spanEdits.mjs +728 -0
- package/dist/model/content/story.d.mts +47 -0
- package/dist/model/content/story.mjs +95 -0
- package/dist/model/content/tableColumns.d.mts +1 -1
- package/dist/model/content/tableColumns.mjs +108 -80
- package/dist/model/content/tableRevisions.d.mts +11 -3
- package/dist/model/content/tableRevisions.mjs +72 -42
- package/dist/model/content/tableRules.d.mts +30 -0
- package/dist/model/content/tableRules.mjs +102 -0
- package/dist/model/content/textBoxes.d.mts +18 -0
- package/dist/model/content/textBoxes.mjs +105 -0
- package/dist/model/content/trackedChangeFilter.d.mts +39 -0
- package/dist/model/content/trackedChangeFilter.mjs +81 -0
- package/dist/model/content/tracking.d.mts +63 -6
- package/dist/model/content/tracking.mjs +242 -22
- package/dist/model/content/tree.d.mts +172 -24
- package/dist/model/content/tree.mjs +328 -54
- package/dist/model/content/wordRange.d.mts +48 -0
- package/dist/model/content/wordRange.mjs +97 -0
- package/dist/model/customxml/CustomXmlPartCollection.d.mts +30 -1
- package/dist/model/customxml/CustomXmlPartCollection.mjs +81 -12
- package/dist/model/customxml/XmlMapping.d.mts +32 -8
- package/dist/model/customxml/XmlMapping.mjs +64 -10
- package/dist/model/customxml/bindings.d.mts +33 -4
- package/dist/model/customxml/bindings.mjs +171 -45
- package/dist/model/customxml/index.d.mts +1 -0
- package/dist/model/customxml/index.mjs +1 -0
- package/dist/model/customxml/kinds.d.mts +8 -3
- package/dist/model/customxml/kinds.mjs +26 -5
- package/dist/model/customxml/opendope.d.mts +4 -1
- package/dist/model/customxml/opendope.mjs +9 -6
- package/dist/model/customxml/picturePlaceholder.d.mts +17 -0
- package/dist/model/customxml/picturePlaceholder.mjs +32 -0
- package/dist/model/customxml/pictures.d.mts +4 -3
- package/dist/model/customxml/pictures.mjs +22 -8
- package/dist/model/customxml/storeItems.d.mts +57 -0
- package/dist/model/customxml/storeItems.mjs +122 -0
- package/dist/model/customxml/xhtml.mjs +23 -22
- package/dist/model/dateZone.d.mts +25 -0
- package/dist/model/dateZone.mjs +57 -0
- package/dist/model/index.d.mts +3 -0
- package/dist/model/index.mjs +5 -0
- package/dist/model/listnumbering/Emulator.d.mts +37 -5
- package/dist/model/listnumbering/Emulator.mjs +63 -9
- package/dist/model/properties/PropertyResolver.d.mts +74 -2
- package/dist/model/properties/PropertyResolver.mjs +133 -5
- package/dist/model/properties/catalogue.d.mts +19 -5
- package/dist/model/properties/catalogue.mjs +41 -15
- package/dist/model/properties/index.d.mts +1 -1
- package/dist/model/properties/log.d.mts +1 -1
- package/dist/model/properties/log.mjs +5 -5
- package/dist/model/properties/styleUtil.d.mts +3 -1
- package/dist/model/properties/styleUtil.mjs +20 -24
- package/dist/model/properties/table.mjs +4 -2
- package/dist/model/text/CaseMapping.d.mts +38 -0
- package/dist/model/text/CaseMapping.mjs +86 -0
- package/dist/model/text/Extractor.d.mts +349 -0
- package/dist/model/text/Extractor.mjs +2406 -0
- package/dist/model/text/LinkTargets.d.mts +45 -0
- package/dist/model/text/LinkTargets.mjs +170 -0
- package/dist/model/text/MarkdownExporter.d.mts +140 -0
- package/dist/model/text/MarkdownExporter.mjs +255 -0
- package/dist/model/text/PlainText.d.mts +29 -0
- package/dist/model/text/PlainText.mjs +542 -0
- package/dist/model/text/TextContext.d.mts +256 -0
- package/dist/model/text/TextContext.mjs +600 -0
- package/dist/model/text/TextOptions.d.mts +233 -0
- package/dist/model/text/TextOptions.mjs +419 -0
- package/dist/model/text/TextResult.d.mts +621 -0
- package/dist/model/text/TextResult.mjs +629 -0
- package/dist/model/text/Texts.d.mts +99 -0
- package/dist/model/text/Texts.mjs +187 -0
- package/dist/model/text/WmlToMarkdown.d.mts +120 -0
- package/dist/model/text/WmlToMarkdown.mjs +936 -0
- package/dist/model/text/caseMapping.generated.d.mts +7 -0
- package/dist/model/text/caseMapping.generated.mjs +214 -0
- package/dist/model/text/commonmark.d.mts +121 -0
- package/dist/model/text/commonmark.mjs +655 -0
- package/dist/model/text/index.d.mts +8 -0
- package/dist/model/text/index.mjs +9 -0
- package/dist/model/text/normalize.d.mts +8 -0
- package/dist/model/text/normalize.mjs +13 -0
- package/dist/model/text/outline.d.mts +4 -0
- package/dist/model/text/outline.mjs +71 -0
- package/dist/model/wordIntegers.d.mts +29 -0
- package/dist/model/wordIntegers.mjs +78 -0
- package/dist/office-js/document.mjs +15 -1
- package/dist/office-js/fragment.d.mts +7 -5
- package/dist/office-js/fragment.mjs +63 -14
- package/dist/office-js/proxy.d.mts +8 -0
- package/dist/office-js/proxy.mjs +29 -0
- package/dist/office-js/run.mjs +2 -0
- package/dist/office-js/supported.generated.mjs +16 -0
- package/dist/office-js/toApiScript.mjs +29 -12
- package/dist/opc/DirectoryPartStore.d.mts +6 -2
- package/dist/opc/DirectoryPartStore.mjs +11 -4
- package/dist/opc/FlatOpcPartStore.d.mts +4 -2
- package/dist/opc/FlatOpcPartStore.mjs +11 -8
- package/dist/opc/Load.d.mts +32 -0
- package/dist/opc/Load.mjs +115 -5
- package/dist/opc/PartStore.d.mts +34 -1
- package/dist/opc/PartStore.mjs +71 -8
- package/dist/opc/Save.d.mts +32 -0
- package/dist/opc/Save.mjs +110 -4
- package/dist/opc/ZipPartStore.d.mts +4 -2
- package/dist/opc/ZipPartStore.mjs +12 -7
- package/dist/opc/exceptions.d.mts +140 -0
- package/dist/opc/exceptions.mjs +108 -0
- package/dist/opc/index.d.mts +8 -5
- package/dist/opc/index.mjs +5 -3
- package/dist/opc/mce/preprocessor.d.mts +141 -5
- package/dist/opc/mce/preprocessor.mjs +119 -18
- package/dist/opc/mce/understood.d.mts +3 -11
- package/dist/opc/mce/understood.mjs +27 -23
- package/dist/opc/repair/breaks.d.mts +23 -0
- package/dist/opc/repair/breaks.mjs +288 -0
- package/dist/opc/repair/hosts.d.mts +12 -0
- package/dist/opc/repair/hosts.mjs +33 -0
- package/dist/opc/repair/mainRoot.d.mts +19 -0
- package/dist/opc/repair/mainRoot.mjs +168 -0
- package/dist/opc/repair/unknownElements.d.mts +8 -0
- package/dist/opc/repair/unknownElements.mjs +180 -0
- package/dist/opc/repair/wmlNames.generated.d.mts +2 -0
- package/dist/opc/repair/wmlNames.generated.mjs +80 -0
- package/dist/opc/skipped.d.mts +50 -0
- package/dist/opc/skipped.mjs +140 -0
- package/dist/packages/OpcPackage.d.mts +110 -4
- package/dist/packages/OpcPackage.mjs +123 -7
- package/dist/packages/WordprocessingMLPackage.d.mts +45 -8
- package/dist/packages/WordprocessingMLPackage.mjs +158 -21
- package/dist/packages/index.d.mts +1 -1
- package/dist/parts/DefaultXmlPart.mjs +2 -2
- package/dist/parts/Part.d.mts +14 -2
- package/dist/parts/RelationshipsPart.d.mts +15 -0
- package/dist/parts/RelationshipsPart.mjs +66 -1
- package/dist/parts/XmlPart.d.mts +63 -32
- package/dist/parts/XmlPart.mjs +240 -96
- package/dist/parts/wml/comments.mjs +30 -0
- package/dist/parts/wml/index.d.mts +12 -1
- package/dist/parts/wml/index.mjs +37 -1
- package/dist/xml/dom.d.mts +7 -0
- package/dist/xml/dom.mjs +18 -0
- package/package.json +2 -2
|
@@ -0,0 +1,621 @@
|
|
|
1
|
+
import type * as wml from '@docx4j/generated-objects-ts/modules/org_docx4j_wml';
|
|
2
|
+
import type { Part } from '../../parts/Part.mjs';
|
|
3
|
+
import type { TextOptions } from './TextOptions.mjs';
|
|
4
|
+
/** What a block is (docx4j `TextBlock.Kind`). */
|
|
5
|
+
export type TextBlockKind = 'PARAGRAPH' | 'TABLE' | 'CHART';
|
|
6
|
+
/**
|
|
7
|
+
* The story a block is in (WD section 5.1; docx4j `TextBlock.Story`). SmartArt's text and an embedded
|
|
8
|
+
* package's content follow their anchoring paragraph but are kept apart from its story; an `altChunk`'s
|
|
9
|
+
* content is in the story the chunk is in.
|
|
10
|
+
*/
|
|
11
|
+
export type TextStory = 'MAIN' | 'TEXT_BOX' | 'FOOTNOTE' | 'ENDNOTE' | 'HEADER' | 'FOOTER' | 'COMMENT' | 'GLOSSARY' | 'SMARTART' | 'EMBEDDED';
|
|
12
|
+
/** What a run is (docx4j `TextRun.Kind`). */
|
|
13
|
+
export type TextRunKind =
|
|
14
|
+
/** Document text: `w:t`, tabs and breaks as REQ-601 maps them, a field's result. */
|
|
15
|
+
'TEXT'
|
|
16
|
+
/** A field's instruction, present only under `field_codes: true` (REQ-505). */
|
|
17
|
+
| 'FIELD_CODE'
|
|
18
|
+
/** A footnote or endnote reference in the story (REQ-503). */
|
|
19
|
+
| 'NOTE_REFERENCE'
|
|
20
|
+
/** The note's own mark at its start (`w:footnoteRef`, or added where it has none). */
|
|
21
|
+
| 'NOTE_MARK'
|
|
22
|
+
/** A comment's reference, where the comment is rendered in plain text (REQ-504). */
|
|
23
|
+
| 'COMMENT_REFERENCE'
|
|
24
|
+
/** A list label from the numbering model, under `list_labels: true` (REQ-510). */
|
|
25
|
+
| 'LIST_LABEL'
|
|
26
|
+
/** A picture, with its description where the describer gives one (REQ-514). */
|
|
27
|
+
| 'IMAGE'
|
|
28
|
+
/** An embedded object, OLE link or ActiveX control (`w:object`; REQ-512): no text. */
|
|
29
|
+
| 'OBJECT'
|
|
30
|
+
/** A `w:lastRenderedPageBreak`: where the page began when Word last laid the document out (REQ-708). */
|
|
31
|
+
| 'PAGE_MARKER';
|
|
32
|
+
/** `footnote` or `endnote`, as a note reference, mark or block says whose it is. */
|
|
33
|
+
export type NoteType = 'footnote' | 'endnote';
|
|
34
|
+
/**
|
|
35
|
+
* A run's `w:vertAlign` (WD REQ-710): `SUPERSCRIPT`, `SUBSCRIPT`, or `BASELINE` for neither. docx4j's
|
|
36
|
+
* `TextRun.VerticalAlignment` names as strings (CR-012 section 24, D3).
|
|
37
|
+
*/
|
|
38
|
+
export type TextVerticalAlignment = 'BASELINE' | 'SUPERSCRIPT' | 'SUBSCRIPT';
|
|
39
|
+
/** Where a run's text was read from: its run and its paragraph (CR-012 section 4.4). */
|
|
40
|
+
export interface TextRunSource {
|
|
41
|
+
run: wml.R;
|
|
42
|
+
paragraph: wml.P;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A run's revision in the `markup` view (WD REQ-706): `w:ins` and `w:moveTo` are insertions, `w:del`
|
|
46
|
+
* and `w:moveFrom` deletions, with their author and date as written. docx4j `TextRevision`.
|
|
47
|
+
*/
|
|
48
|
+
export declare class TextRevision {
|
|
49
|
+
readonly type: 'INSERTION' | 'DELETION';
|
|
50
|
+
readonly author: string | undefined;
|
|
51
|
+
/** The date as the package wrote it (`w:date`), or undefined. */
|
|
52
|
+
readonly date: string | undefined;
|
|
53
|
+
constructor(type: 'INSERTION' | 'DELETION', author: string | undefined,
|
|
54
|
+
/** The date as the package wrote it (`w:date`), or undefined. */
|
|
55
|
+
date: string | undefined);
|
|
56
|
+
equals(o: TextRevision | undefined): boolean;
|
|
57
|
+
toString(): string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* An image's description (WD REQ-514) and where it came from: the document's author, or a describer
|
|
61
|
+
* that generated it. Plain text writes it `[image: ...]` or `[image, generated: ...]` under
|
|
62
|
+
* `alt_text: true` (REQ-707). docx4j `ImageDescription`.
|
|
63
|
+
*/
|
|
64
|
+
export declare class ImageDescription {
|
|
65
|
+
readonly text: string;
|
|
66
|
+
readonly provenance: 'AUTHOR' | 'GENERATED';
|
|
67
|
+
constructor(text: string, provenance: 'AUTHOR' | 'GENERATED');
|
|
68
|
+
/** An author's description. */
|
|
69
|
+
static author(text: string): ImageDescription;
|
|
70
|
+
/** A generated description. */
|
|
71
|
+
static generated(text: string): ImageDescription;
|
|
72
|
+
toString(): string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* A picture as the document gives it, for an `ImageDescriber` (WD REQ-514): its alt text
|
|
76
|
+
* (`wp:docPr/@descr`, or VML's `v:shape/@alt`), its name and title, whether it is marked decorative
|
|
77
|
+
* (`adec:decorative`), and its image part where the package holds one. The title is never read as text.
|
|
78
|
+
* docx4j `TextImage`.
|
|
79
|
+
*/
|
|
80
|
+
export declare class TextImage {
|
|
81
|
+
/**
|
|
82
|
+
* The alt text: `wp:docPr/@descr` (or a nested picture's `pic:cNvPr/@descr`), `''` where a DrawingML picture has
|
|
83
|
+
* none (the schema's default); VML `v:shape/@alt`.
|
|
84
|
+
*/
|
|
85
|
+
readonly descr: string | undefined;
|
|
86
|
+
/** `wp:docPr/@name` (`pic:cNvPr/@name`); undefined for a VML picture. */
|
|
87
|
+
readonly name: string | undefined;
|
|
88
|
+
/** `wp:docPr/@title`, `''` where it has none (the schema's default); undefined for a VML picture. */
|
|
89
|
+
readonly title: string | undefined;
|
|
90
|
+
/** True for a picture marked decorative (`adec:decorative val="1"` in `wp:docPr`'s extensions). */
|
|
91
|
+
readonly decorative: boolean;
|
|
92
|
+
/** True for a VML picture (`v:shape` with `v:imagedata`). */
|
|
93
|
+
readonly vml: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* The image part (`a:blip/@r:embed`, else its `asvg:svgBlip`'s; `v:imagedata/@r:id`), or undefined
|
|
96
|
+
* for a linked or missing one.
|
|
97
|
+
*/
|
|
98
|
+
readonly part: Part | undefined;
|
|
99
|
+
/** The tree object the picture is read from: a `wp:inline`, `wp:anchor`, `pic:pic` or `v:shape`. */
|
|
100
|
+
readonly source: object | undefined;
|
|
101
|
+
constructor(
|
|
102
|
+
/**
|
|
103
|
+
* The alt text: `wp:docPr/@descr` (or a nested picture's `pic:cNvPr/@descr`), `''` where a DrawingML picture has
|
|
104
|
+
* none (the schema's default); VML `v:shape/@alt`.
|
|
105
|
+
*/
|
|
106
|
+
descr: string | undefined,
|
|
107
|
+
/** `wp:docPr/@name` (`pic:cNvPr/@name`); undefined for a VML picture. */
|
|
108
|
+
name: string | undefined,
|
|
109
|
+
/** `wp:docPr/@title`, `''` where it has none (the schema's default); undefined for a VML picture. */
|
|
110
|
+
title: string | undefined,
|
|
111
|
+
/** True for a picture marked decorative (`adec:decorative val="1"` in `wp:docPr`'s extensions). */
|
|
112
|
+
decorative: boolean,
|
|
113
|
+
/** True for a VML picture (`v:shape` with `v:imagedata`). */
|
|
114
|
+
vml: boolean,
|
|
115
|
+
/**
|
|
116
|
+
* The image part (`a:blip/@r:embed`, else its `asvg:svgBlip`'s; `v:imagedata/@r:id`), or undefined
|
|
117
|
+
* for a linked or missing one.
|
|
118
|
+
*/
|
|
119
|
+
part: Part | undefined,
|
|
120
|
+
/** The tree object the picture is read from: a `wp:inline`, `wp:anchor`, `pic:pic` or `v:shape`. */
|
|
121
|
+
source: object | undefined);
|
|
122
|
+
toJSON(): Record<string, unknown>;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Gives an image its text (WD REQ-514): one describer per extraction, `AltTextDescriber` by default. A
|
|
126
|
+
* host may replace or wrap the default (a captioning model); what it generates it marks `GENERATED`.
|
|
127
|
+
* An SVG's `<text>` and the glyph runs of EMF and WMF are not the document's text. docx4j `ImageDescriber`.
|
|
128
|
+
*/
|
|
129
|
+
export type ImageDescriber = (image: TextImage) => ImageDescription | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* The default `ImageDescriber` (WD REQ-514): the author's alt text, `wp:docPr/@descr`, else the
|
|
132
|
+
* picture's `@name`; for VML, `v:shape/@alt`; nothing for a picture marked decorative.
|
|
133
|
+
* docx4j `AltTextDescriber`.
|
|
134
|
+
*/
|
|
135
|
+
export declare const AltTextDescriber: {
|
|
136
|
+
INSTANCE: ImageDescriber;
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* A piece of a block's content (WD REQ-706): document text, or a typed item whose text, if any, the
|
|
140
|
+
* serialiser adds (a note reference is written `[n]` in plain text, REQ-707; it is a field of the run
|
|
141
|
+
* here, never text). docx4j `TextRun`.
|
|
142
|
+
*
|
|
143
|
+
* `source` and `officeOffset` are this package's (CR-012 section 4.4; WD REQ-202's emulated-API
|
|
144
|
+
* exemption): where the run's text was read from, and where it lies in its paragraph's `Paragraph.text`.
|
|
145
|
+
*/
|
|
146
|
+
export declare class TextRun {
|
|
147
|
+
readonly kind: TextRunKind;
|
|
148
|
+
/** The text: the document's for `TEXT`, `FIELD_CODE` and `LIST_LABEL`; empty for the others. */
|
|
149
|
+
readonly text: string;
|
|
150
|
+
/** The run's revision in the `markup` view; undefined in the other views and for an unrevised run. */
|
|
151
|
+
readonly revision: TextRevision | undefined;
|
|
152
|
+
/** True for hidden text included under `hidden: true` (REQ-507). */
|
|
153
|
+
hidden: boolean;
|
|
154
|
+
/** True for a content control's placeholder text (REQ-508). */
|
|
155
|
+
placeholder: boolean;
|
|
156
|
+
/** For a note reference or mark: whose. */
|
|
157
|
+
noteType: NoteType | undefined;
|
|
158
|
+
/** For a note reference or mark: its number in reference order, from 1; 0 for a custom mark. */
|
|
159
|
+
noteNumber: number;
|
|
160
|
+
/** For a note reference or mark: the note's `w:id`. */
|
|
161
|
+
noteId: string | undefined;
|
|
162
|
+
/** For a comment reference: the comment's `w:id`. */
|
|
163
|
+
commentId: string | undefined;
|
|
164
|
+
/** For an image: what the document says of it. */
|
|
165
|
+
image: TextImage | undefined;
|
|
166
|
+
/** For an image: the describer's description; undefined for none (a decorative picture's). */
|
|
167
|
+
description: ImageDescription | undefined;
|
|
168
|
+
/** For an object: its ProgID (`o:OLEObject/@ProgID`). */
|
|
169
|
+
progId: string | undefined;
|
|
170
|
+
/** For a page marker: the number of the page that begins there, from 2. */
|
|
171
|
+
pageNumber: number;
|
|
172
|
+
/** Bold where its paragraph's style is not: the run's `w:b`, else its styles' (CR-046 phase 3). */
|
|
173
|
+
bold: boolean;
|
|
174
|
+
/** Italic where its paragraph's style is not. */
|
|
175
|
+
italic: boolean;
|
|
176
|
+
/** Struck through where its paragraph's style is not: `w:strike`, or `w:dstrike`, struck twice (CR-012 section 24.5). */
|
|
177
|
+
strike: boolean;
|
|
178
|
+
/** In a monospaced font where its paragraph's style is not in one. */
|
|
179
|
+
monospace: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Shown in capitals (`w:caps`): the run's own property, else its styles', the paragraph style's among them (the case is
|
|
182
|
+
* the text's, not emphasis). `text` stays the stored characters; the plain-text and Markdown writers write them in
|
|
183
|
+
* capitals by `language` (`CaseMapping`; WD REQ-607, CR-012 section 24).
|
|
184
|
+
*/
|
|
185
|
+
caps: boolean;
|
|
186
|
+
/**
|
|
187
|
+
* In small capitals (`w:smallCaps`), folded as `caps` is, and not caps: a run under both is a caps run. The writers write
|
|
188
|
+
* its stored characters, unless `small_caps: upper` is set (WD REQ-607).
|
|
189
|
+
*/
|
|
190
|
+
smallCaps: boolean;
|
|
191
|
+
/**
|
|
192
|
+
* The text's `w:vertAlign`, the run's own, else its styles' (WD REQ-710); `BASELINE` for a note reference, which is a
|
|
193
|
+
* reference (REQ-503), not a superscript.
|
|
194
|
+
*/
|
|
195
|
+
verticalAlignment: TextVerticalAlignment;
|
|
196
|
+
/**
|
|
197
|
+
* For a caps or small-caps run, the language its capitals are mapped by (WD REQ-607, the WD's `lang`): its
|
|
198
|
+
* `w:lang/@w:val`, else its styles' or the document defaults', else the `default_language` option (`en-US` by default;
|
|
199
|
+
* `w:themeFontLang` is no link, WD 0.80); undefined for any other run, so that a `w:lang` alone never splits runs.
|
|
200
|
+
*/
|
|
201
|
+
language: string | undefined;
|
|
202
|
+
/** For text in a link: its target (a `w:hyperlink`'s, or a HYPERLINK field's, REQ-703). */
|
|
203
|
+
link: string | undefined;
|
|
204
|
+
/** True for an equation (REQ-604). */
|
|
205
|
+
math: boolean;
|
|
206
|
+
/** True for a display equation (`m:oMathPara`). */
|
|
207
|
+
displayMath: boolean;
|
|
208
|
+
/**
|
|
209
|
+
* Where the run's text starts in its paragraph's `Paragraph.text` (the Office JS reader, CR-012 D2),
|
|
210
|
+
* where it contributes there; within the run the two texts agree character for character. Undefined
|
|
211
|
+
* for a run only the model writes: a note reference or mark, a list label, a page marker, a field code,
|
|
212
|
+
* an image, a field result or bound value computed here, text `Paragraph.text` does not hold.
|
|
213
|
+
*/
|
|
214
|
+
officeOffset: number | undefined;
|
|
215
|
+
constructor(kind: TextRunKind,
|
|
216
|
+
/** The text: the document's for `TEXT`, `FIELD_CODE` and `LIST_LABEL`; empty for the others. */
|
|
217
|
+
text: string,
|
|
218
|
+
/** The run's revision in the `markup` view; undefined in the other views and for an unrevised run. */
|
|
219
|
+
revision: TextRevision | undefined);
|
|
220
|
+
/** Where the run's text was read from (not in the JSON). */
|
|
221
|
+
get source(): TextRunSource | undefined;
|
|
222
|
+
set source(value: TextRunSource | undefined);
|
|
223
|
+
/** Whether two runs' text can be one run: the same formatting, link and equation. */
|
|
224
|
+
sameFormat(o: TextRun): boolean;
|
|
225
|
+
copyFormat(from: TextRun): void;
|
|
226
|
+
toString(): string;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* A field in a block (WD REQ-505): its instruction, and its cached result, undefined where it has none.
|
|
230
|
+
* docx4j `TextField`.
|
|
231
|
+
*/
|
|
232
|
+
export declare class TextField {
|
|
233
|
+
/** The instruction (`w:instrText`, `w:fldSimple/@instr`), as written. */
|
|
234
|
+
readonly instr: string;
|
|
235
|
+
/** The cached result's text in the view; undefined for a field with none. */
|
|
236
|
+
readonly result: string | undefined;
|
|
237
|
+
/** True when the result was computed under `fields: update` (REQ-506), rather than cached. */
|
|
238
|
+
readonly updated: boolean;
|
|
239
|
+
constructor(
|
|
240
|
+
/** The instruction (`w:instrText`, `w:fldSimple/@instr`), as written. */
|
|
241
|
+
instr: string,
|
|
242
|
+
/** The cached result's text in the view; undefined for a field with none. */
|
|
243
|
+
result: string | undefined,
|
|
244
|
+
/** True when the result was computed under `fields: update` (REQ-506), rather than cached. */
|
|
245
|
+
updated?: boolean);
|
|
246
|
+
toString(): string;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* A paragraph's numbering, as its effective `w:numPr` and the numbering definitions give it: what
|
|
250
|
+
* Markdown's list markers are made from (WD REQ-510, REQ-703). The label itself is the block's
|
|
251
|
+
* `listLabel`, under `list_labels: true`. docx4j `TextNumbering`.
|
|
252
|
+
*/
|
|
253
|
+
export declare class TextNumbering {
|
|
254
|
+
/** The `w:numId`. */
|
|
255
|
+
readonly numId: string;
|
|
256
|
+
/** The level, `w:ilvl`: 0 to 8. */
|
|
257
|
+
readonly level: number;
|
|
258
|
+
/** The level's `w:numFmt` value, or undefined where the definitions don't give one. */
|
|
259
|
+
readonly format: string | undefined;
|
|
260
|
+
/** The level's `w:lvlText` value, or undefined. */
|
|
261
|
+
readonly levelText: string | undefined;
|
|
262
|
+
/** The level's `w:start`: 1 where it has none. */
|
|
263
|
+
readonly start: number;
|
|
264
|
+
/** The count the paragraph's level shows, as the list labels count it (the 3 of "1.3."), or undefined. */
|
|
265
|
+
value: number | undefined;
|
|
266
|
+
/** The list the paragraph belongs to: its `w:abstractNum`'s id, or undefined. */
|
|
267
|
+
abstractNumId: string | undefined;
|
|
268
|
+
constructor(
|
|
269
|
+
/** The `w:numId`. */
|
|
270
|
+
numId: string,
|
|
271
|
+
/** The level, `w:ilvl`: 0 to 8. */
|
|
272
|
+
level: number,
|
|
273
|
+
/** The level's `w:numFmt` value, or undefined where the definitions don't give one. */
|
|
274
|
+
format: string | undefined,
|
|
275
|
+
/** The level's `w:lvlText` value, or undefined. */
|
|
276
|
+
levelText: string | undefined,
|
|
277
|
+
/** The level's `w:start`: 1 where it has none. */
|
|
278
|
+
start: number);
|
|
279
|
+
/** True for a bullet level. */
|
|
280
|
+
get bullet(): boolean;
|
|
281
|
+
/** True for a level that is a label rather than a number: not a bullet, and its format `none` or its text with no `%n`. */
|
|
282
|
+
get label(): boolean;
|
|
283
|
+
toString(): string;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* A table row of the block model: its cells, and whether it is a header row (`w:tblHeader`).
|
|
287
|
+
* docx4j `TextRow`.
|
|
288
|
+
*/
|
|
289
|
+
export declare class TextRow {
|
|
290
|
+
readonly address: string;
|
|
291
|
+
readonly cells: TextCell[];
|
|
292
|
+
/** True for a row marked `w:tblHeader`. */
|
|
293
|
+
header: boolean;
|
|
294
|
+
constructor(address: string);
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* A table cell of the block model: its blocks (paragraphs, and nested tables), how many grid columns it
|
|
298
|
+
* spans, and whether it is in a vertical merge. docx4j `TextCell`.
|
|
299
|
+
*/
|
|
300
|
+
export declare class TextCell {
|
|
301
|
+
readonly address: string;
|
|
302
|
+
readonly blocks: TextBlock[];
|
|
303
|
+
/** `w:gridSpan`, 1 by default. */
|
|
304
|
+
gridSpan: number;
|
|
305
|
+
/** True for a cell continuing a vertical merge (`w:vMerge` without `restart`). */
|
|
306
|
+
mergeContinue: boolean;
|
|
307
|
+
/** True for a cell starting a vertical merge (`w:vMerge w:val="restart"`). */
|
|
308
|
+
mergeRestart: boolean;
|
|
309
|
+
constructor(address: string);
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* A block of the block model (WD REQ-706): a paragraph, a table whose cells hold blocks, or a chart. A
|
|
313
|
+
* paragraph's text is its runs' in the view; what an extractor adds in plain text (note numbers, a
|
|
314
|
+
* table-format note, an image's bracket) is not in it, but carried as fields (REQ-707). docx4j `TextBlock`.
|
|
315
|
+
*
|
|
316
|
+
* Addresses are CR-002 section 3.3's ordinal form, on the unresolved document (REQ-405, REQ-518):
|
|
317
|
+
* `body/3`, `body/4/1/0/2` (a table's row 1, cell 0, block 2), `header:rId3/0`, `footnote:2/0`,
|
|
318
|
+
* `comment:5/0`, and what follows an anchoring paragraph is addressed from it, each kind counted apart
|
|
319
|
+
* (REQ-519): `body/3/textbox:0/1` (legacy WordArt too), `body/3/chart:0`, `body/3/smartart:0/1`,
|
|
320
|
+
* `body/3/object:0/...`, `body/7/altchunk:0/...`; the glossary's `glossary:0/1`. A paragraph joined to
|
|
321
|
+
* the next in the `accepted` view (a deleted mark) takes the first paragraph's address and `w14:paraId`.
|
|
322
|
+
*/
|
|
323
|
+
export declare class TextBlock {
|
|
324
|
+
readonly kind: TextBlockKind;
|
|
325
|
+
/** The story; not readonly, since an embedded package's or a chunk's content takes the story it is read into. */
|
|
326
|
+
story: TextStory;
|
|
327
|
+
readonly address: string;
|
|
328
|
+
/** The paragraph's `w14:paraId` where Word wrote one. */
|
|
329
|
+
paraId: string | undefined;
|
|
330
|
+
/** The paragraph's style id (`w:pStyle`). */
|
|
331
|
+
style: string | undefined;
|
|
332
|
+
readonly runs: TextRun[];
|
|
333
|
+
/** The fields whose result or instruction is in the block (REQ-505). */
|
|
334
|
+
readonly fields: TextField[];
|
|
335
|
+
/** A table's rows; empty for a paragraph. */
|
|
336
|
+
readonly rows: TextRow[];
|
|
337
|
+
/** True for a hidden paragraph included under `hidden: true`: its runs and mark are hidden (REQ-507). */
|
|
338
|
+
hidden: boolean;
|
|
339
|
+
/** How many revisions (run-level revisions and paragraph marks) the block's paragraphs hold, in any view. */
|
|
340
|
+
revisions: number;
|
|
341
|
+
/** The effective left indent in twips. */
|
|
342
|
+
indentLeft: number | undefined;
|
|
343
|
+
/** The effective hanging indent in twips. */
|
|
344
|
+
indentHanging: number | undefined;
|
|
345
|
+
/** The effective first-line indent in twips. */
|
|
346
|
+
indentFirstLine: number | undefined;
|
|
347
|
+
/** The effective alignment (`w:jc`'s value). */
|
|
348
|
+
alignment: string | undefined;
|
|
349
|
+
/** True when every text run is in a monospaced font, and at least one is. */
|
|
350
|
+
monospace: boolean;
|
|
351
|
+
/** The paragraph's list label from the numbering model, under `list_labels: true`. */
|
|
352
|
+
listLabel: string | undefined;
|
|
353
|
+
/** The effective outline level (`w:outlineLvl`), 0 to 8; undefined for body text. */
|
|
354
|
+
outlineLevel: number | undefined;
|
|
355
|
+
/** The paragraph's numbering (its effective `w:numPr` with a `w:numId` other than 0). */
|
|
356
|
+
numbering: TextNumbering | undefined;
|
|
357
|
+
/** The effective `w:contextualSpacing`, undefined where neither the paragraph nor its styles set it. */
|
|
358
|
+
contextualSpacing: boolean | undefined;
|
|
359
|
+
/** True when the paragraph has a bottom border of its own (`w:pBdr/w:bottom` in its `w:pPr`). */
|
|
360
|
+
bottomBorder: boolean;
|
|
361
|
+
/** For a note's block: whose. */
|
|
362
|
+
noteType: NoteType | undefined;
|
|
363
|
+
/** For a note's block: the note's number in reference order; else 0. */
|
|
364
|
+
noteNumber: number;
|
|
365
|
+
/** For a note's block: the note's `w:id`. */
|
|
366
|
+
noteId: string | undefined;
|
|
367
|
+
/** The section the block ends or is in (main story only). */
|
|
368
|
+
section: number;
|
|
369
|
+
/** For a table: always written in REQ-605's simple form (an embedded workbook's sheet). */
|
|
370
|
+
simpleForm: boolean;
|
|
371
|
+
/** For a chart: its title as Office shows it. */
|
|
372
|
+
chartTitle: string | undefined;
|
|
373
|
+
/** For a chart: its description (docx4j CR-047's `ChartDescription`); CR-012 phase 5c. */
|
|
374
|
+
chart: {
|
|
375
|
+
note: string;
|
|
376
|
+
kind?: string;
|
|
377
|
+
axes?: unknown[];
|
|
378
|
+
secondarySeries?: string[];
|
|
379
|
+
} | undefined;
|
|
380
|
+
/** For a chart: its table's column headings. */
|
|
381
|
+
chartHeader: string[];
|
|
382
|
+
/** For a chart: its table's rows. */
|
|
383
|
+
chartRows: string[][];
|
|
384
|
+
constructor(kind: TextBlockKind,
|
|
385
|
+
/** The story; not readonly, since an embedded package's or a chunk's content takes the story it is read into. */
|
|
386
|
+
story: TextStory, address: string);
|
|
387
|
+
/**
|
|
388
|
+
* What the block was read from (CR-012 section 4.4; not in the JSON): a paragraph's `w:p` (a joined
|
|
389
|
+
* block's first, as its paraId is, REQ-405), a table's `w:tbl`, a bound control's `w:sdt`; undefined
|
|
390
|
+
* for a block the model makes (a chart, a WordArt line).
|
|
391
|
+
*/
|
|
392
|
+
get source(): object | undefined;
|
|
393
|
+
set source(value: object | undefined);
|
|
394
|
+
/**
|
|
395
|
+
* For a paragraph the view joins to the paragraphs after it (a deleted mark in `accepted`, an inserted one
|
|
396
|
+
* in `original`), their addresses, in order; empty for any other block (CR-012 section 17.13; not in the JSON).
|
|
397
|
+
*/
|
|
398
|
+
get joined(): readonly string[];
|
|
399
|
+
set joined(value: readonly string[]);
|
|
400
|
+
/** True when the block holds placeholder text (REQ-508). */
|
|
401
|
+
get placeholder(): boolean;
|
|
402
|
+
/** True for a block in a text box (REQ-518). */
|
|
403
|
+
get textbox(): boolean;
|
|
404
|
+
/** True for a paragraph whose only content is one or more pictures marked decorative (REQ-514). */
|
|
405
|
+
get decorative(): boolean;
|
|
406
|
+
/**
|
|
407
|
+
* The block's text in the view: its text runs (and field codes, where included); for a table, its
|
|
408
|
+
* rows a line apart, their cells a tab apart. No list label, note number or comment.
|
|
409
|
+
*/
|
|
410
|
+
get text(): string;
|
|
411
|
+
/** `text` with each text run's text as the function gives it (`CaseMapping.written`). */
|
|
412
|
+
textWith(runText: (run: TextRun) => string): string;
|
|
413
|
+
/** The block model's JSON (REQ-706): the fields, the text and the flags; never a tree object. */
|
|
414
|
+
toJSON(): Record<string, unknown>;
|
|
415
|
+
toString(): string;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* A comment (WD REQ-504): its author, date and blocks, the comment it replies to, and whether it is
|
|
419
|
+
* resolved (`w15:done`). Plain text renders a comment at its reference, replies after it. docx4j `TextComment`.
|
|
420
|
+
*/
|
|
421
|
+
export declare class TextComment {
|
|
422
|
+
readonly id: string;
|
|
423
|
+
author: string | undefined;
|
|
424
|
+
initials: string | undefined;
|
|
425
|
+
/** The date as the package wrote it. */
|
|
426
|
+
date: string | undefined;
|
|
427
|
+
/** The `w:id` of the comment this one replies to (`w15:paraIdParent`). */
|
|
428
|
+
parentId: string | undefined;
|
|
429
|
+
/** True when the comment is resolved (`w15:done`). */
|
|
430
|
+
resolved: boolean;
|
|
431
|
+
readonly blocks: TextBlock[];
|
|
432
|
+
/** The replies, in the comments part's order. */
|
|
433
|
+
readonly replies: TextComment[];
|
|
434
|
+
constructor(/** The comment's `w:id`. */ id: string);
|
|
435
|
+
/** The comment's text: its blocks a line apart. */
|
|
436
|
+
get text(): string;
|
|
437
|
+
toJSON(): Record<string, unknown>;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Where a result is not the whole document (WD section 8, REQ-801): a kind, the address it is at where
|
|
441
|
+
* there is one, and its selector: for `mce.branches_differ` the name of the branch selected, for
|
|
442
|
+
* `altchunk.not_expanded`, `content.not_read` and `image.not_described` the part's name (the chunk's since
|
|
443
|
+
* CR-012 section 22.2 (a), WD 0.47; it was the chunk's content type, which the warning still carries), for
|
|
444
|
+
* `paragraph.drop_cap_joined` the name of the part the paragraphs are in. Never the document's text (REQ-802).
|
|
445
|
+
* docx4j `TextWarning`.
|
|
446
|
+
*/
|
|
447
|
+
export declare class TextWarning {
|
|
448
|
+
readonly kind: string;
|
|
449
|
+
/** The address of the block it is in (REQ-518's grammar), or undefined. */
|
|
450
|
+
readonly address?: string | undefined;
|
|
451
|
+
/** For `mce.branches_differ`, the selected branch (`mc:Choice Requires="wps"`, `mc:Fallback`). */
|
|
452
|
+
readonly branch?: string | undefined;
|
|
453
|
+
/** For `altchunk.not_expanded`, the chunk's content type as the package declares it. */
|
|
454
|
+
readonly contentType?: string | undefined;
|
|
455
|
+
/**
|
|
456
|
+
* For `content.not_read`, `part.not_read` and `part.absent`, the part's name; for `image.not_described`, the image part's; for `altchunk.not_expanded`,
|
|
457
|
+
* the chunk's (`/word/afchunk.rtf`), so that a host can read it itself; for `paragraph.drop_cap_joined`, the part the
|
|
458
|
+
* paragraphs are in (`/word/document.xml`); for `package.multiple_main_parts` and `package.external_main_part`, the part
|
|
459
|
+
* read; for `package.relationships_namespace`, the relationships part; for `mce.nothing_selected`,
|
|
460
|
+
* the part holding the element.
|
|
461
|
+
*/
|
|
462
|
+
readonly partName?: string | undefined;
|
|
463
|
+
/**
|
|
464
|
+
* What the kind says beyond its selector (REQ-801's `detail`): for `package.duplicate_entry`, the entries of the name; for
|
|
465
|
+
* `package.multiple_main_parts`, the relationships; for `package.external_main_part`, the first URL as written; for
|
|
466
|
+
* `package.relationships_namespace`, the relationships read; for `mce.nothing_selected`, the namespaces required.
|
|
467
|
+
*/
|
|
468
|
+
readonly detail?: (number | string) | undefined;
|
|
469
|
+
/** Both branches of an `mc:AlternateContent` hold text, and the texts differ (REQ-307). */
|
|
470
|
+
static readonly MCE_BRANCHES_DIFFER = "mce.branches_differ";
|
|
471
|
+
/**
|
|
472
|
+
* An `mc:AlternateContent` with Choices, none understood, and no Fallback, so it reads as absent (REQ-305): at its address,
|
|
473
|
+
* or with none where the walk can't meet it (a resolved load took it out, or it is a part's root). The part's name is the
|
|
474
|
+
* selector, and `detail` the namespaces its Choices require, as one string of URIs, empty if every prefix binds to nothing.
|
|
475
|
+
*/
|
|
476
|
+
static readonly MCE_NOTHING_SELECTED = "mce.nothing_selected";
|
|
477
|
+
/**
|
|
478
|
+
* An `mc:Ignorable` listing a prefix no declaration in scope binds, read as though the list didn't hold it (REQ-323, CR-030):
|
|
479
|
+
* once a part the reading took, no address, the part's name the selector and `detail` the prefixes, separated by spaces.
|
|
480
|
+
*/
|
|
481
|
+
static readonly MCE_UNDECLARED_PREFIX = "mce.undeclared_prefix";
|
|
482
|
+
/**
|
|
483
|
+
* A main document part whose root Word opens showing nothing of, read as an empty document (REQ-320, CR-028 D11): once, no
|
|
484
|
+
* address, the part's name the selector and `detail` the root's qualified name.
|
|
485
|
+
*/
|
|
486
|
+
static readonly PART_UNEXPECTED_ROOT = "part.unexpected_root";
|
|
487
|
+
/** A field with no cached result (REQ-505). */
|
|
488
|
+
static readonly FIELD_NO_RESULT = "field.no_result";
|
|
489
|
+
/** A data-bound control whose surface differs from its bound value (REQ-509). */
|
|
490
|
+
static readonly SDT_BINDING_DIFFERS = "sdt.binding_differs";
|
|
491
|
+
/** An `altChunk` not expanded (REQ-513). */
|
|
492
|
+
static readonly ALTCHUNK_NOT_EXPANDED = "altchunk.not_expanded";
|
|
493
|
+
/** A chart, a SmartArt data part, or an embedded package or a part inside it, that can't be read. */
|
|
494
|
+
static readonly CONTENT_NOT_READ = "content.not_read";
|
|
495
|
+
/**
|
|
496
|
+
* A part the reading consulted and needed for this document, but does not emit, that cannot be read (REQ-801, WD 0.66):
|
|
497
|
+
* a styles, numbering or settings part, a document-properties part where the metadata is written, or a custom XML store
|
|
498
|
+
* a binding names. The reading proceeds as for a package that lacks it; once per part, no address, the part's name the
|
|
499
|
+
* selector (CR-012 section 28).
|
|
500
|
+
*/
|
|
501
|
+
static readonly PART_NOT_READ = "part.not_read";
|
|
502
|
+
/**
|
|
503
|
+
* A part the reading needed that the package does not hold, where the reading supplies what it would have: the numbering
|
|
504
|
+
* part, for a numbered paragraph, counted as Word's default definition (REQ-510, WD 0.76). Once, no address, the name the
|
|
505
|
+
* package would have held the part under (`/word/numbering.xml`) the selector.
|
|
506
|
+
*/
|
|
507
|
+
static readonly PART_ABSENT = "part.absent";
|
|
508
|
+
/**
|
|
509
|
+
* A name the package's container holds more than one entry of, read from the first under `repair: 'word'`
|
|
510
|
+
* (REQ-206, CR-024): no address, the entry as its first copy spells it the selector, the number of entries `detail`.
|
|
511
|
+
*/
|
|
512
|
+
static readonly PACKAGE_DUPLICATE_ENTRY = "package.duplicate_entry";
|
|
513
|
+
/**
|
|
514
|
+
* A package with more than one officeDocument relationship, the last's target read under `repair: 'word'`
|
|
515
|
+
* (REQ-206's statement, CR-024 section 9): once a package, no address, that part's name the selector, the number of relationships `detail`.
|
|
516
|
+
*/
|
|
517
|
+
static readonly PACKAGE_MULTIPLE_MAIN_PARTS = "package.multiple_main_parts";
|
|
518
|
+
/**
|
|
519
|
+
* An `External` officeDocument relationship beside an internal one, dropped under `repair: 'all'`, a repair of this package's
|
|
520
|
+
* own (REQ-206's NOTE, CR-031): once a package, no address, the part read the selector, the first URL as written `detail`.
|
|
521
|
+
*/
|
|
522
|
+
static readonly PACKAGE_EXTERNAL_MAIN_PART = "package.external_main_part";
|
|
523
|
+
/**
|
|
524
|
+
* A relationships part in a wrong namespace, read by local name under `repair: 'word'` (REQ-801's NOTE, CR-031 section 2.3):
|
|
525
|
+
* once a part, no address, the relationships part's name the selector, the relationships read `detail`.
|
|
526
|
+
*/
|
|
527
|
+
static readonly PACKAGE_RELATIONSHIPS_NAMESPACE = "package.relationships_namespace";
|
|
528
|
+
/** An image the `ImageDescriber` failed to describe (REQ-514). */
|
|
529
|
+
static readonly IMAGE_NOT_DESCRIBED = "image.not_described";
|
|
530
|
+
/**
|
|
531
|
+
* A drop cap's frame paragraph joined to the paragraph after it, two `w:p` read as one (REQ-521): at the frame paragraph's
|
|
532
|
+
* address (CR-012 section 24.3).
|
|
533
|
+
*/
|
|
534
|
+
static readonly DROP_CAP_JOINED = "paragraph.drop_cap_joined";
|
|
535
|
+
constructor(kind: string,
|
|
536
|
+
/** The address of the block it is in (REQ-518's grammar), or undefined. */
|
|
537
|
+
address?: string | undefined,
|
|
538
|
+
/** For `mce.branches_differ`, the selected branch (`mc:Choice Requires="wps"`, `mc:Fallback`). */
|
|
539
|
+
branch?: string | undefined,
|
|
540
|
+
/** For `altchunk.not_expanded`, the chunk's content type as the package declares it. */
|
|
541
|
+
contentType?: string | undefined,
|
|
542
|
+
/**
|
|
543
|
+
* For `content.not_read`, `part.not_read` and `part.absent`, the part's name; for `image.not_described`, the image part's; for `altchunk.not_expanded`,
|
|
544
|
+
* the chunk's (`/word/afchunk.rtf`), so that a host can read it itself; for `paragraph.drop_cap_joined`, the part the
|
|
545
|
+
* paragraphs are in (`/word/document.xml`); for `package.multiple_main_parts` and `package.external_main_part`, the part
|
|
546
|
+
* read; for `package.relationships_namespace`, the relationships part; for `mce.nothing_selected`,
|
|
547
|
+
* the part holding the element.
|
|
548
|
+
*/
|
|
549
|
+
partName?: string | undefined,
|
|
550
|
+
/**
|
|
551
|
+
* What the kind says beyond its selector (REQ-801's `detail`): for `package.duplicate_entry`, the entries of the name; for
|
|
552
|
+
* `package.multiple_main_parts`, the relationships; for `package.external_main_part`, the first URL as written; for
|
|
553
|
+
* `package.relationships_namespace`, the relationships read; for `mce.nothing_selected`, the namespaces required.
|
|
554
|
+
*/
|
|
555
|
+
detail?: (number | string) | undefined);
|
|
556
|
+
/**
|
|
557
|
+
* The selector of REQ-801: the branch, else the part's name, else the content type (a warning made without a part
|
|
558
|
+
* name). `altchunk.not_expanded`'s is its part name since CR-012 section 22.2 (a) (WD 0.47), its content type before.
|
|
559
|
+
*/
|
|
560
|
+
get selector(): string | undefined;
|
|
561
|
+
/** The identity a result keeps each warning once by. */
|
|
562
|
+
get key(): string;
|
|
563
|
+
toJSON(): Record<string, unknown>;
|
|
564
|
+
toString(): string;
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* A text in the block model (WD sections 7.4 and 8): the blocks in reading order, the comments, the
|
|
568
|
+
* warnings and the metadata. Plain text (`PlainText`) and the other serialisations are written from it
|
|
569
|
+
* (REQ-202). docx4j `TextResult`.
|
|
570
|
+
*/
|
|
571
|
+
export declare class TextResult {
|
|
572
|
+
/** The blocks in reading order (REQ-501, REQ-502, REQ-518, REQ-606). Comments are not among them. */
|
|
573
|
+
readonly blocks: readonly TextBlock[];
|
|
574
|
+
/** The comments the view includes, by `w:id`, in the comments part's order (REQ-504). */
|
|
575
|
+
readonly comments: ReadonlyMap<string, TextComment>;
|
|
576
|
+
/** The warnings raised (REQ-801), never with the document's text (REQ-802). */
|
|
577
|
+
readonly warnings: readonly TextWarning[];
|
|
578
|
+
/**
|
|
579
|
+
* The result's metadata (REQ-801, REQ-515), whatever the options: `fields_update_on_open`, `repaired` (REQ-207), and the
|
|
580
|
+
* document properties under `core`, `app` and `custom`, each a record, present when the package has
|
|
581
|
+
* that part. Property values are document text, in the text stream only under `metadata: true`.
|
|
582
|
+
*/
|
|
583
|
+
readonly metadata: Readonly<Record<string, unknown>>;
|
|
584
|
+
/** The options the result was made with. */
|
|
585
|
+
readonly options: TextOptions;
|
|
586
|
+
/** The metadata's key for the settings' `w:updateFields` (REQ-506, REQ-801): a boolean. */
|
|
587
|
+
static readonly FIELDS_UPDATE_ON_OPEN = "fields_update_on_open";
|
|
588
|
+
/**
|
|
589
|
+
* The metadata's key for what the load repaired (REQ-207, REQ-801; CR-031): `none`, `word` where only Word's repairs were
|
|
590
|
+
* followed, `own` where a repair of this package's own was made. docx4j `TextResult.REPAIRED`.
|
|
591
|
+
*/
|
|
592
|
+
static readonly REPAIRED = "repaired";
|
|
593
|
+
/** The metadata's key for the core properties (REQ-515): each property's element name to its value. */
|
|
594
|
+
static readonly CORE = "core";
|
|
595
|
+
/** The metadata's key for the application properties (REQ-515), the statistics left out. */
|
|
596
|
+
static readonly APP = "app";
|
|
597
|
+
/** The metadata's key for the custom properties (REQ-515): each property's name to its typed value. */
|
|
598
|
+
static readonly CUSTOM = "custom";
|
|
599
|
+
constructor(
|
|
600
|
+
/** The blocks in reading order (REQ-501, REQ-502, REQ-518, REQ-606). Comments are not among them. */
|
|
601
|
+
blocks: readonly TextBlock[],
|
|
602
|
+
/** The comments the view includes, by `w:id`, in the comments part's order (REQ-504). */
|
|
603
|
+
comments: ReadonlyMap<string, TextComment>,
|
|
604
|
+
/** The warnings raised (REQ-801), never with the document's text (REQ-802). */
|
|
605
|
+
warnings: readonly TextWarning[],
|
|
606
|
+
/**
|
|
607
|
+
* The result's metadata (REQ-801, REQ-515), whatever the options: `fields_update_on_open`, `repaired` (REQ-207), and the
|
|
608
|
+
* document properties under `core`, `app` and `custom`, each a record, present when the package has
|
|
609
|
+
* that part. Property values are document text, in the text stream only under `metadata: true`.
|
|
610
|
+
*/
|
|
611
|
+
metadata: Readonly<Record<string, unknown>>,
|
|
612
|
+
/** The options the result was made with. */
|
|
613
|
+
options: TextOptions);
|
|
614
|
+
/**
|
|
615
|
+
* Several results as one, in the order given (CR-012 section 4.4): the blocks one after another, the
|
|
616
|
+
* comments together, each warning once, the metadata and options the first's. What the editor
|
|
617
|
+
* assembles from its per-part calls under one `TextContext`.
|
|
618
|
+
*/
|
|
619
|
+
static concat(...results: TextResult[]): TextResult;
|
|
620
|
+
toJSON(): Record<string, unknown>;
|
|
621
|
+
}
|