@docx4j/core-ts 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/NOTICE +4 -0
  2. package/README.md +32 -4
  3. package/dist/html/convert.mjs +2 -1
  4. package/dist/html/elements.mjs +2 -1
  5. package/dist/model/color/ColorMath.d.mts +29 -0
  6. package/dist/model/color/ColorMath.mjs +146 -0
  7. package/dist/model/color/ColorTables.d.mts +6 -0
  8. package/dist/model/color/ColorTables.mjs +83 -0
  9. package/dist/model/color/DrawingMLColors.d.mts +52 -0
  10. package/dist/model/color/DrawingMLColors.mjs +374 -0
  11. package/dist/model/color/ResolvedColor.d.mts +36 -0
  12. package/dist/model/color/ResolvedColor.mjs +65 -0
  13. package/dist/model/color/SpreadsheetColors.d.mts +36 -0
  14. package/dist/model/color/SpreadsheetColors.mjs +84 -0
  15. package/dist/model/color/StyleFill.d.mts +28 -0
  16. package/dist/model/color/StyleFill.mjs +21 -0
  17. package/dist/model/color/ThemeColors.d.mts +86 -0
  18. package/dist/model/color/ThemeColors.mjs +304 -0
  19. package/dist/model/color/WordColors.d.mts +71 -0
  20. package/dist/model/color/WordColors.mjs +121 -0
  21. package/dist/model/color/index.d.mts +6 -0
  22. package/dist/model/color/index.mjs +30 -0
  23. package/dist/model/content/Body.d.mts +145 -23
  24. package/dist/model/content/Body.mjs +509 -141
  25. package/dist/model/content/Comment.d.mts +21 -3
  26. package/dist/model/content/Comment.mjs +195 -19
  27. package/dist/model/content/ContentControl.d.mts +197 -18
  28. package/dist/model/content/ContentControl.mjs +664 -95
  29. package/dist/model/content/Font.d.mts +67 -17
  30. package/dist/model/content/Font.mjs +114 -35
  31. package/dist/model/content/InlinePicture.d.mts +11 -0
  32. package/dist/model/content/InlinePicture.mjs +21 -1
  33. package/dist/model/content/List.mjs +3 -0
  34. package/dist/model/content/Paragraph.d.mts +189 -13
  35. package/dist/model/content/Paragraph.mjs +870 -74
  36. package/dist/model/content/Range.d.mts +227 -12
  37. package/dist/model/content/Range.mjs +785 -59
  38. package/dist/model/content/ResolvedView.d.mts +104 -0
  39. package/dist/model/content/ResolvedView.mjs +596 -0
  40. package/dist/model/content/Table.d.mts +29 -3
  41. package/dist/model/content/Table.mjs +109 -33
  42. package/dist/model/content/TrackedChange.d.mts +172 -13
  43. package/dist/model/content/TrackedChange.mjs +728 -167
  44. package/dist/model/content/comments.d.mts +20 -6
  45. package/dist/model/content/comments.mjs +67 -57
  46. package/dist/model/content/generalException.d.mts +18 -0
  47. package/dist/model/content/generalException.mjs +24 -0
  48. package/dist/model/content/index.d.mts +8 -3
  49. package/dist/model/content/index.mjs +7 -2
  50. package/dist/model/content/mathText.d.mts +21 -0
  51. package/dist/model/content/mathText.mjs +267 -0
  52. package/dist/model/content/officeText.d.mts +27 -0
  53. package/dist/model/content/officeText.mjs +74 -0
  54. package/dist/model/content/outline.d.mts +5 -0
  55. package/dist/model/content/outline.mjs +13 -0
  56. package/dist/model/content/placeholders.d.mts +110 -0
  57. package/dist/model/content/placeholders.mjs +253 -0
  58. package/dist/model/content/search.d.mts +72 -0
  59. package/dist/model/content/search.mjs +204 -2
  60. package/dist/model/content/spanEdits.d.mts +159 -0
  61. package/dist/model/content/spanEdits.mjs +728 -0
  62. package/dist/model/content/story.d.mts +44 -0
  63. package/dist/model/content/story.mjs +92 -0
  64. package/dist/model/content/tableColumns.d.mts +1 -1
  65. package/dist/model/content/tableColumns.mjs +108 -80
  66. package/dist/model/content/tableRevisions.d.mts +11 -3
  67. package/dist/model/content/tableRevisions.mjs +72 -42
  68. package/dist/model/content/tableRules.d.mts +30 -0
  69. package/dist/model/content/tableRules.mjs +100 -0
  70. package/dist/model/content/textBoxes.d.mts +18 -0
  71. package/dist/model/content/textBoxes.mjs +105 -0
  72. package/dist/model/content/trackedChangeFilter.d.mts +39 -0
  73. package/dist/model/content/trackedChangeFilter.mjs +81 -0
  74. package/dist/model/content/tracking.d.mts +28 -0
  75. package/dist/model/content/tracking.mjs +149 -10
  76. package/dist/model/content/tree.d.mts +171 -22
  77. package/dist/model/content/tree.mjs +329 -53
  78. package/dist/model/customxml/CustomXmlPartCollection.d.mts +8 -0
  79. package/dist/model/customxml/CustomXmlPartCollection.mjs +34 -11
  80. package/dist/model/customxml/XmlMapping.d.mts +1 -1
  81. package/dist/model/customxml/XmlMapping.mjs +11 -0
  82. package/dist/model/customxml/bindings.d.mts +21 -2
  83. package/dist/model/customxml/bindings.mjs +76 -32
  84. package/dist/model/customxml/kinds.d.mts +8 -3
  85. package/dist/model/customxml/kinds.mjs +26 -5
  86. package/dist/model/customxml/picturePlaceholder.d.mts +17 -0
  87. package/dist/model/customxml/picturePlaceholder.mjs +32 -0
  88. package/dist/model/customxml/pictures.d.mts +4 -3
  89. package/dist/model/customxml/pictures.mjs +18 -6
  90. package/dist/model/customxml/xhtml.mjs +8 -2
  91. package/dist/model/index.d.mts +2 -0
  92. package/dist/model/index.mjs +4 -0
  93. package/dist/model/listnumbering/Emulator.d.mts +37 -5
  94. package/dist/model/listnumbering/Emulator.mjs +63 -9
  95. package/dist/model/properties/PropertyResolver.d.mts +60 -1
  96. package/dist/model/properties/PropertyResolver.mjs +115 -2
  97. package/dist/model/properties/catalogue.d.mts +19 -5
  98. package/dist/model/properties/catalogue.mjs +41 -15
  99. package/dist/model/properties/log.d.mts +1 -1
  100. package/dist/model/properties/log.mjs +5 -5
  101. package/dist/model/properties/table.mjs +4 -2
  102. package/dist/model/text/Extractor.d.mts +289 -0
  103. package/dist/model/text/Extractor.mjs +2162 -0
  104. package/dist/model/text/LinkTargets.d.mts +45 -0
  105. package/dist/model/text/LinkTargets.mjs +170 -0
  106. package/dist/model/text/MarkdownExporter.d.mts +140 -0
  107. package/dist/model/text/MarkdownExporter.mjs +255 -0
  108. package/dist/model/text/PlainText.d.mts +29 -0
  109. package/dist/model/text/PlainText.mjs +539 -0
  110. package/dist/model/text/TextContext.d.mts +161 -0
  111. package/dist/model/text/TextContext.mjs +425 -0
  112. package/dist/model/text/TextOptions.d.mts +150 -0
  113. package/dist/model/text/TextOptions.mjs +278 -0
  114. package/dist/model/text/TextResult.d.mts +504 -0
  115. package/dist/model/text/TextResult.mjs +526 -0
  116. package/dist/model/text/Texts.d.mts +99 -0
  117. package/dist/model/text/Texts.mjs +187 -0
  118. package/dist/model/text/WmlToMarkdown.d.mts +120 -0
  119. package/dist/model/text/WmlToMarkdown.mjs +911 -0
  120. package/dist/model/text/commonmark.d.mts +121 -0
  121. package/dist/model/text/commonmark.mjs +655 -0
  122. package/dist/model/text/index.d.mts +7 -0
  123. package/dist/model/text/index.mjs +8 -0
  124. package/dist/model/text/normalize.d.mts +8 -0
  125. package/dist/model/text/normalize.mjs +13 -0
  126. package/dist/model/text/outline.d.mts +4 -0
  127. package/dist/model/text/outline.mjs +71 -0
  128. package/dist/office-js/fragment.d.mts +7 -5
  129. package/dist/office-js/fragment.mjs +63 -14
  130. package/dist/office-js/proxy.d.mts +8 -0
  131. package/dist/office-js/proxy.mjs +29 -0
  132. package/dist/office-js/run.mjs +2 -0
  133. package/dist/office-js/supported.generated.mjs +16 -0
  134. package/dist/office-js/toApiScript.mjs +21 -5
  135. package/dist/opc/Save.d.mts +17 -0
  136. package/dist/opc/Save.mjs +12 -2
  137. package/dist/opc/index.d.mts +3 -3
  138. package/dist/opc/index.mjs +1 -1
  139. package/dist/opc/mce/preprocessor.d.mts +28 -3
  140. package/dist/opc/mce/preprocessor.mjs +4 -4
  141. package/dist/opc/mce/understood.d.mts +30 -6
  142. package/dist/opc/mce/understood.mjs +37 -7
  143. package/dist/packages/OpcPackage.d.mts +13 -0
  144. package/dist/packages/OpcPackage.mjs +1 -0
  145. package/dist/packages/WordprocessingMLPackage.d.mts +45 -8
  146. package/dist/packages/WordprocessingMLPackage.mjs +155 -20
  147. package/dist/parts/DefaultXmlPart.mjs +2 -2
  148. package/dist/parts/Part.d.mts +10 -2
  149. package/dist/parts/XmlPart.d.mts +12 -30
  150. package/dist/parts/XmlPart.mjs +44 -93
  151. package/dist/parts/wml/comments.mjs +30 -0
  152. package/dist/parts/wml/index.mjs +12 -0
  153. package/dist/xml/dom.d.mts +7 -0
  154. package/dist/xml/dom.mjs +18 -0
  155. package/package.json +2 -2
@@ -0,0 +1,504 @@
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
+ /** Where a run's text was read from: its run and its paragraph (CR-012 section 4.4). */
35
+ export interface TextRunSource {
36
+ run: wml.R;
37
+ paragraph: wml.P;
38
+ }
39
+ /**
40
+ * A run's revision in the `markup` view (WD REQ-706): `w:ins` and `w:moveTo` are insertions, `w:del`
41
+ * and `w:moveFrom` deletions, with their author and date as written. docx4j `TextRevision`.
42
+ */
43
+ export declare class TextRevision {
44
+ readonly type: 'INSERTION' | 'DELETION';
45
+ readonly author: string | undefined;
46
+ /** The date as the package wrote it (`w:date`), or undefined. */
47
+ readonly date: string | undefined;
48
+ constructor(type: 'INSERTION' | 'DELETION', author: string | undefined,
49
+ /** The date as the package wrote it (`w:date`), or undefined. */
50
+ date: string | undefined);
51
+ equals(o: TextRevision | undefined): boolean;
52
+ toString(): string;
53
+ }
54
+ /**
55
+ * An image's description (WD REQ-514) and where it came from: the document's author, or a describer
56
+ * that generated it. Plain text writes it `[image: ...]` or `[image, generated: ...]` under
57
+ * `alt_text: true` (REQ-707). docx4j `ImageDescription`.
58
+ */
59
+ export declare class ImageDescription {
60
+ readonly text: string;
61
+ readonly provenance: 'AUTHOR' | 'GENERATED';
62
+ constructor(text: string, provenance: 'AUTHOR' | 'GENERATED');
63
+ /** An author's description. */
64
+ static author(text: string): ImageDescription;
65
+ /** A generated description. */
66
+ static generated(text: string): ImageDescription;
67
+ toString(): string;
68
+ }
69
+ /**
70
+ * A picture as the document gives it, for an `ImageDescriber` (WD REQ-514): its alt text
71
+ * (`wp:docPr/@descr`, or VML's `v:shape/@alt`), its name and title, whether it is marked decorative
72
+ * (`adec:decorative`), and its image part where the package holds one. The title is never read as text.
73
+ * docx4j `TextImage`.
74
+ */
75
+ export declare class TextImage {
76
+ /**
77
+ * The alt text: `wp:docPr/@descr` (or a nested picture's `pic:cNvPr/@descr`), `''` where a DrawingML picture has
78
+ * none (the schema's default); VML `v:shape/@alt`.
79
+ */
80
+ readonly descr: string | undefined;
81
+ /** `wp:docPr/@name` (`pic:cNvPr/@name`); undefined for a VML picture. */
82
+ readonly name: string | undefined;
83
+ /** `wp:docPr/@title`, `''` where it has none (the schema's default); undefined for a VML picture. */
84
+ readonly title: string | undefined;
85
+ /** True for a picture marked decorative (`adec:decorative val="1"` in `wp:docPr`'s extensions). */
86
+ readonly decorative: boolean;
87
+ /** True for a VML picture (`v:shape` with `v:imagedata`). */
88
+ readonly vml: boolean;
89
+ /**
90
+ * The image part (`a:blip/@r:embed`, else its `asvg:svgBlip`'s; `v:imagedata/@r:id`), or undefined
91
+ * for a linked or missing one.
92
+ */
93
+ readonly part: Part | undefined;
94
+ /** The tree object the picture is read from: a `wp:inline`, `wp:anchor`, `pic:pic` or `v:shape`. */
95
+ readonly source: object | undefined;
96
+ constructor(
97
+ /**
98
+ * The alt text: `wp:docPr/@descr` (or a nested picture's `pic:cNvPr/@descr`), `''` where a DrawingML picture has
99
+ * none (the schema's default); VML `v:shape/@alt`.
100
+ */
101
+ descr: string | undefined,
102
+ /** `wp:docPr/@name` (`pic:cNvPr/@name`); undefined for a VML picture. */
103
+ name: string | undefined,
104
+ /** `wp:docPr/@title`, `''` where it has none (the schema's default); undefined for a VML picture. */
105
+ title: string | undefined,
106
+ /** True for a picture marked decorative (`adec:decorative val="1"` in `wp:docPr`'s extensions). */
107
+ decorative: boolean,
108
+ /** True for a VML picture (`v:shape` with `v:imagedata`). */
109
+ vml: boolean,
110
+ /**
111
+ * The image part (`a:blip/@r:embed`, else its `asvg:svgBlip`'s; `v:imagedata/@r:id`), or undefined
112
+ * for a linked or missing one.
113
+ */
114
+ part: Part | undefined,
115
+ /** The tree object the picture is read from: a `wp:inline`, `wp:anchor`, `pic:pic` or `v:shape`. */
116
+ source: object | undefined);
117
+ toJSON(): Record<string, unknown>;
118
+ }
119
+ /**
120
+ * Gives an image its text (WD REQ-514): one describer per extraction, `AltTextDescriber` by default. A
121
+ * host may replace or wrap the default (a captioning model); what it generates it marks `GENERATED`.
122
+ * An SVG's `<text>` and the glyph runs of EMF and WMF are not the document's text. docx4j `ImageDescriber`.
123
+ */
124
+ export type ImageDescriber = (image: TextImage) => ImageDescription | undefined;
125
+ /**
126
+ * The default `ImageDescriber` (WD REQ-514): the author's alt text, `wp:docPr/@descr`, else the
127
+ * picture's `@name`; for VML, `v:shape/@alt`; nothing for a picture marked decorative.
128
+ * docx4j `AltTextDescriber`.
129
+ */
130
+ export declare const AltTextDescriber: {
131
+ INSTANCE: ImageDescriber;
132
+ };
133
+ /**
134
+ * A piece of a block's content (WD REQ-706): document text, or a typed item whose text, if any, the
135
+ * serialiser adds (a note reference is written `[n]` in plain text, REQ-707; it is a field of the run
136
+ * here, never text). docx4j `TextRun`.
137
+ *
138
+ * `source` and `officeOffset` are this package's (CR-012 section 4.4; WD REQ-202's emulated-API
139
+ * exemption): where the run's text was read from, and where it lies in its paragraph's `Paragraph.text`.
140
+ */
141
+ export declare class TextRun {
142
+ readonly kind: TextRunKind;
143
+ /** The text: the document's for `TEXT`, `FIELD_CODE` and `LIST_LABEL`; empty for the others. */
144
+ readonly text: string;
145
+ /** The run's revision in the `markup` view; undefined in the other views and for an unrevised run. */
146
+ readonly revision: TextRevision | undefined;
147
+ /** True for hidden text included under `hidden: true` (REQ-507). */
148
+ hidden: boolean;
149
+ /** True for a content control's placeholder text (REQ-508). */
150
+ placeholder: boolean;
151
+ /** For a note reference or mark: whose. */
152
+ noteType: NoteType | undefined;
153
+ /** For a note reference or mark: its number in reference order, from 1; 0 for a custom mark. */
154
+ noteNumber: number;
155
+ /** For a note reference or mark: the note's `w:id`. */
156
+ noteId: string | undefined;
157
+ /** For a comment reference: the comment's `w:id`. */
158
+ commentId: string | undefined;
159
+ /** For an image: what the document says of it. */
160
+ image: TextImage | undefined;
161
+ /** For an image: the describer's description; undefined for none (a decorative picture's). */
162
+ description: ImageDescription | undefined;
163
+ /** For an object: its ProgID (`o:OLEObject/@ProgID`). */
164
+ progId: string | undefined;
165
+ /** For a page marker: the number of the page that begins there, from 2. */
166
+ pageNumber: number;
167
+ /** Bold where its paragraph's style is not: the run's `w:b`, else its styles' (CR-046 phase 3). */
168
+ bold: boolean;
169
+ /** Italic where its paragraph's style is not. */
170
+ italic: boolean;
171
+ /** Struck through where its paragraph's style is not. */
172
+ strike: boolean;
173
+ /** In a monospaced font where its paragraph's style is not in one. */
174
+ monospace: boolean;
175
+ /** For text in a link: its target (a `w:hyperlink`'s, or a HYPERLINK field's, REQ-703). */
176
+ link: string | undefined;
177
+ /** True for an equation (REQ-604). */
178
+ math: boolean;
179
+ /** True for a display equation (`m:oMathPara`). */
180
+ displayMath: boolean;
181
+ /**
182
+ * Where the run's text starts in its paragraph's `Paragraph.text` (the Office JS reader, CR-012 D2),
183
+ * where it contributes there; within the run the two texts agree character for character. Undefined
184
+ * for a run only the model writes: a note reference or mark, a list label, a page marker, a field code,
185
+ * an image, a field result or bound value computed here, text `Paragraph.text` does not hold.
186
+ */
187
+ officeOffset: number | undefined;
188
+ constructor(kind: TextRunKind,
189
+ /** The text: the document's for `TEXT`, `FIELD_CODE` and `LIST_LABEL`; empty for the others. */
190
+ text: string,
191
+ /** The run's revision in the `markup` view; undefined in the other views and for an unrevised run. */
192
+ revision: TextRevision | undefined);
193
+ /** Where the run's text was read from (not in the JSON). */
194
+ get source(): TextRunSource | undefined;
195
+ set source(value: TextRunSource | undefined);
196
+ /** Whether two runs' text can be one run: the same formatting, link and equation. */
197
+ sameFormat(o: TextRun): boolean;
198
+ copyFormat(from: TextRun): void;
199
+ toString(): string;
200
+ }
201
+ /**
202
+ * A field in a block (WD REQ-505): its instruction, and its cached result, undefined where it has none.
203
+ * docx4j `TextField`.
204
+ */
205
+ export declare class TextField {
206
+ /** The instruction (`w:instrText`, `w:fldSimple/@instr`), as written. */
207
+ readonly instr: string;
208
+ /** The cached result's text in the view; undefined for a field with none. */
209
+ readonly result: string | undefined;
210
+ /** True when the result was computed under `fields: update` (REQ-506), rather than cached. */
211
+ readonly updated: boolean;
212
+ constructor(
213
+ /** The instruction (`w:instrText`, `w:fldSimple/@instr`), as written. */
214
+ instr: string,
215
+ /** The cached result's text in the view; undefined for a field with none. */
216
+ result: string | undefined,
217
+ /** True when the result was computed under `fields: update` (REQ-506), rather than cached. */
218
+ updated?: boolean);
219
+ toString(): string;
220
+ }
221
+ /**
222
+ * A paragraph's numbering, as its effective `w:numPr` and the numbering definitions give it: what
223
+ * Markdown's list markers are made from (WD REQ-510, REQ-703). The label itself is the block's
224
+ * `listLabel`, under `list_labels: true`. docx4j `TextNumbering`.
225
+ */
226
+ export declare class TextNumbering {
227
+ /** The `w:numId`. */
228
+ readonly numId: string;
229
+ /** The level, `w:ilvl`: 0 to 8. */
230
+ readonly level: number;
231
+ /** The level's `w:numFmt` value, or undefined where the definitions don't give one. */
232
+ readonly format: string | undefined;
233
+ /** The level's `w:lvlText` value, or undefined. */
234
+ readonly levelText: string | undefined;
235
+ /** The level's `w:start`: 1 where it has none. */
236
+ readonly start: number;
237
+ /** The count the paragraph's level shows, as the list labels count it (the 3 of "1.3."), or undefined. */
238
+ value: number | undefined;
239
+ /** The list the paragraph belongs to: its `w:abstractNum`'s id, or undefined. */
240
+ abstractNumId: string | undefined;
241
+ constructor(
242
+ /** The `w:numId`. */
243
+ numId: string,
244
+ /** The level, `w:ilvl`: 0 to 8. */
245
+ level: number,
246
+ /** The level's `w:numFmt` value, or undefined where the definitions don't give one. */
247
+ format: string | undefined,
248
+ /** The level's `w:lvlText` value, or undefined. */
249
+ levelText: string | undefined,
250
+ /** The level's `w:start`: 1 where it has none. */
251
+ start: number);
252
+ /** True for a bullet level. */
253
+ get bullet(): boolean;
254
+ /** 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`. */
255
+ get label(): boolean;
256
+ toString(): string;
257
+ }
258
+ /**
259
+ * A table row of the block model: its cells, and whether it is a header row (`w:tblHeader`).
260
+ * docx4j `TextRow`.
261
+ */
262
+ export declare class TextRow {
263
+ readonly address: string;
264
+ readonly cells: TextCell[];
265
+ /** True for a row marked `w:tblHeader`. */
266
+ header: boolean;
267
+ constructor(address: string);
268
+ }
269
+ /**
270
+ * A table cell of the block model: its blocks (paragraphs, and nested tables), how many grid columns it
271
+ * spans, and whether it is in a vertical merge. docx4j `TextCell`.
272
+ */
273
+ export declare class TextCell {
274
+ readonly address: string;
275
+ readonly blocks: TextBlock[];
276
+ /** `w:gridSpan`, 1 by default. */
277
+ gridSpan: number;
278
+ /** True for a cell continuing a vertical merge (`w:vMerge` without `restart`). */
279
+ mergeContinue: boolean;
280
+ /** True for a cell starting a vertical merge (`w:vMerge w:val="restart"`). */
281
+ mergeRestart: boolean;
282
+ constructor(address: string);
283
+ }
284
+ /**
285
+ * A block of the block model (WD REQ-706): a paragraph, a table whose cells hold blocks, or a chart. A
286
+ * paragraph's text is its runs' in the view; what an extractor adds in plain text (note numbers, a
287
+ * table-format note, an image's bracket) is not in it, but carried as fields (REQ-707). docx4j `TextBlock`.
288
+ *
289
+ * Addresses are CR-002 section 3.3's ordinal form, on the unresolved document (REQ-405, REQ-518):
290
+ * `body/3`, `body/4/1/0/2` (a table's row 1, cell 0, block 2), `header:rId3/0`, `footnote:2/0`,
291
+ * `comment:5/0`, and what follows an anchoring paragraph is addressed from it, each kind counted apart
292
+ * (REQ-519): `body/3/textbox:0/1` (legacy WordArt too), `body/3/chart:0`, `body/3/smartart:0/1`,
293
+ * `body/3/object:0/...`, `body/7/altchunk:0/...`; the glossary's `glossary:0/1`. A paragraph joined to
294
+ * the next in the `accepted` view (a deleted mark) takes the first paragraph's address and `w14:paraId`.
295
+ */
296
+ export declare class TextBlock {
297
+ readonly kind: TextBlockKind;
298
+ /** The story; not readonly, since an embedded package's or a chunk's content takes the story it is read into. */
299
+ story: TextStory;
300
+ readonly address: string;
301
+ /** The paragraph's `w14:paraId` where Word wrote one. */
302
+ paraId: string | undefined;
303
+ /** The paragraph's style id (`w:pStyle`). */
304
+ style: string | undefined;
305
+ readonly runs: TextRun[];
306
+ /** The fields whose result or instruction is in the block (REQ-505). */
307
+ readonly fields: TextField[];
308
+ /** A table's rows; empty for a paragraph. */
309
+ readonly rows: TextRow[];
310
+ /** True for a hidden paragraph included under `hidden: true`: its runs and mark are hidden (REQ-507). */
311
+ hidden: boolean;
312
+ /** How many revisions (run-level revisions and paragraph marks) the block's paragraphs hold, in any view. */
313
+ revisions: number;
314
+ /** The effective left indent in twips. */
315
+ indentLeft: number | undefined;
316
+ /** The effective hanging indent in twips. */
317
+ indentHanging: number | undefined;
318
+ /** The effective first-line indent in twips. */
319
+ indentFirstLine: number | undefined;
320
+ /** The effective alignment (`w:jc`'s value). */
321
+ alignment: string | undefined;
322
+ /** True when every text run is in a monospaced font, and at least one is. */
323
+ monospace: boolean;
324
+ /** The paragraph's list label from the numbering model, under `list_labels: true`. */
325
+ listLabel: string | undefined;
326
+ /** The effective outline level (`w:outlineLvl`), 0 to 8; undefined for body text. */
327
+ outlineLevel: number | undefined;
328
+ /** The paragraph's numbering (its effective `w:numPr` with a `w:numId` other than 0). */
329
+ numbering: TextNumbering | undefined;
330
+ /** The effective `w:contextualSpacing`, undefined where neither the paragraph nor its styles set it. */
331
+ contextualSpacing: boolean | undefined;
332
+ /** True when the paragraph has a bottom border of its own (`w:pBdr/w:bottom` in its `w:pPr`). */
333
+ bottomBorder: boolean;
334
+ /** For a note's block: whose. */
335
+ noteType: NoteType | undefined;
336
+ /** For a note's block: the note's number in reference order; else 0. */
337
+ noteNumber: number;
338
+ /** For a note's block: the note's `w:id`. */
339
+ noteId: string | undefined;
340
+ /** The section the block ends or is in (main story only). */
341
+ section: number;
342
+ /** For a table: always written in REQ-605's simple form (an embedded workbook's sheet). */
343
+ simpleForm: boolean;
344
+ /** For a chart: its title as Office shows it. */
345
+ chartTitle: string | undefined;
346
+ /** For a chart: its description (docx4j CR-047's `ChartDescription`); CR-012 phase 5c. */
347
+ chart: {
348
+ note: string;
349
+ kind?: string;
350
+ axes?: unknown[];
351
+ secondarySeries?: string[];
352
+ } | undefined;
353
+ /** For a chart: its table's column headings. */
354
+ chartHeader: string[];
355
+ /** For a chart: its table's rows. */
356
+ chartRows: string[][];
357
+ constructor(kind: TextBlockKind,
358
+ /** The story; not readonly, since an embedded package's or a chunk's content takes the story it is read into. */
359
+ story: TextStory, address: string);
360
+ /**
361
+ * What the block was read from (CR-012 section 4.4; not in the JSON): a paragraph's `w:p` (a joined
362
+ * block's first, as its paraId is, REQ-405), a table's `w:tbl`, a bound control's `w:sdt`; undefined
363
+ * for a block the model makes (a chart, a WordArt line).
364
+ */
365
+ get source(): object | undefined;
366
+ set source(value: object | undefined);
367
+ /**
368
+ * For a paragraph the view joins to the paragraphs after it (a deleted mark in `accepted`, an inserted one
369
+ * in `original`), their addresses, in order; empty for any other block (CR-012 section 17.13; not in the JSON).
370
+ */
371
+ get joined(): readonly string[];
372
+ set joined(value: readonly string[]);
373
+ /** True when the block holds placeholder text (REQ-508). */
374
+ get placeholder(): boolean;
375
+ /** True for a block in a text box (REQ-518). */
376
+ get textbox(): boolean;
377
+ /** True for a paragraph whose only content is one or more pictures marked decorative (REQ-514). */
378
+ get decorative(): boolean;
379
+ /**
380
+ * The block's text in the view: its text runs (and field codes, where included); for a table, its
381
+ * rows a line apart, their cells a tab apart. No list label, note number or comment.
382
+ */
383
+ get text(): string;
384
+ /** The block model's JSON (REQ-706): the fields, the text and the flags; never a tree object. */
385
+ toJSON(): Record<string, unknown>;
386
+ toString(): string;
387
+ }
388
+ /**
389
+ * A comment (WD REQ-504): its author, date and blocks, the comment it replies to, and whether it is
390
+ * resolved (`w15:done`). Plain text renders a comment at its reference, replies after it. docx4j `TextComment`.
391
+ */
392
+ export declare class TextComment {
393
+ readonly id: string;
394
+ author: string | undefined;
395
+ initials: string | undefined;
396
+ /** The date as the package wrote it. */
397
+ date: string | undefined;
398
+ /** The `w:id` of the comment this one replies to (`w15:paraIdParent`). */
399
+ parentId: string | undefined;
400
+ /** True when the comment is resolved (`w15:done`). */
401
+ resolved: boolean;
402
+ readonly blocks: TextBlock[];
403
+ /** The replies, in the comments part's order. */
404
+ readonly replies: TextComment[];
405
+ constructor(/** The comment's `w:id`. */ id: string);
406
+ /** The comment's text: its blocks a line apart. */
407
+ get text(): string;
408
+ toJSON(): Record<string, unknown>;
409
+ }
410
+ /**
411
+ * Where a result is not the whole document (WD section 8, REQ-801): a kind, the address it is at where
412
+ * there is one, and its selector: for `mce.branches_differ` the name of the branch selected, for
413
+ * `altchunk.not_expanded` the chunk's content type, for `content.not_read` and `image.not_described` the
414
+ * part's name. Never the document's text (REQ-802). docx4j `TextWarning`.
415
+ */
416
+ export declare class TextWarning {
417
+ readonly kind: string;
418
+ /** The address of the block it is in (REQ-518's grammar), or undefined. */
419
+ readonly address?: string | undefined;
420
+ /** For `mce.branches_differ`, the selected branch (`mc:Choice Requires="wps"`, `mc:Fallback`). */
421
+ readonly branch?: string | undefined;
422
+ /** For `altchunk.not_expanded`, the chunk's content type as the package declares it. */
423
+ readonly contentType?: string | undefined;
424
+ /** For `content.not_read` and `image.not_described`, the part's name. */
425
+ readonly partName?: string | undefined;
426
+ /** Both branches of an `mc:AlternateContent` hold text, and the texts differ (REQ-307). */
427
+ static readonly MCE_BRANCHES_DIFFER = "mce.branches_differ";
428
+ /** A field with no cached result (REQ-505). */
429
+ static readonly FIELD_NO_RESULT = "field.no_result";
430
+ /** A data-bound control whose surface differs from its bound value (REQ-509). */
431
+ static readonly SDT_BINDING_DIFFERS = "sdt.binding_differs";
432
+ /** An `altChunk` not expanded (REQ-513). */
433
+ static readonly ALTCHUNK_NOT_EXPANDED = "altchunk.not_expanded";
434
+ /** A chart, a SmartArt data part, or an embedded package or a part inside it, that can't be read. */
435
+ static readonly CONTENT_NOT_READ = "content.not_read";
436
+ /** An image the `ImageDescriber` failed to describe (REQ-514). */
437
+ static readonly IMAGE_NOT_DESCRIBED = "image.not_described";
438
+ constructor(kind: string,
439
+ /** The address of the block it is in (REQ-518's grammar), or undefined. */
440
+ address?: string | undefined,
441
+ /** For `mce.branches_differ`, the selected branch (`mc:Choice Requires="wps"`, `mc:Fallback`). */
442
+ branch?: string | undefined,
443
+ /** For `altchunk.not_expanded`, the chunk's content type as the package declares it. */
444
+ contentType?: string | undefined,
445
+ /** For `content.not_read` and `image.not_described`, the part's name. */
446
+ partName?: string | undefined);
447
+ /** The selector of REQ-801: the branch, the content type or the part's name, whichever the kind has. */
448
+ get selector(): string | undefined;
449
+ /** The identity a result keeps each warning once by. */
450
+ get key(): string;
451
+ toJSON(): Record<string, unknown>;
452
+ toString(): string;
453
+ }
454
+ /**
455
+ * A text in the block model (WD sections 7.4 and 8): the blocks in reading order, the comments, the
456
+ * warnings and the metadata. Plain text (`PlainText`) and the other serialisations are written from it
457
+ * (REQ-202). docx4j `TextResult`.
458
+ */
459
+ export declare class TextResult {
460
+ /** The blocks in reading order (REQ-501, REQ-502, REQ-518, REQ-606). Comments are not among them. */
461
+ readonly blocks: readonly TextBlock[];
462
+ /** The comments the view includes, by `w:id`, in the comments part's order (REQ-504). */
463
+ readonly comments: ReadonlyMap<string, TextComment>;
464
+ /** The warnings raised (REQ-801), never with the document's text (REQ-802). */
465
+ readonly warnings: readonly TextWarning[];
466
+ /**
467
+ * The result's metadata (REQ-801, REQ-515), whatever the options: `fields_update_on_open`, and the
468
+ * document properties under `core`, `app` and `custom`, each a record, present when the package has
469
+ * that part. Property values are document text, in the text stream only under `metadata: true`.
470
+ */
471
+ readonly metadata: Readonly<Record<string, unknown>>;
472
+ /** The options the result was made with. */
473
+ readonly options: TextOptions;
474
+ /** The metadata's key for the settings' `w:updateFields` (REQ-506, REQ-801): a boolean. */
475
+ static readonly FIELDS_UPDATE_ON_OPEN = "fields_update_on_open";
476
+ /** The metadata's key for the core properties (REQ-515): each property's element name to its value. */
477
+ static readonly CORE = "core";
478
+ /** The metadata's key for the application properties (REQ-515), the statistics left out. */
479
+ static readonly APP = "app";
480
+ /** The metadata's key for the custom properties (REQ-515): each property's name to its typed value. */
481
+ static readonly CUSTOM = "custom";
482
+ constructor(
483
+ /** The blocks in reading order (REQ-501, REQ-502, REQ-518, REQ-606). Comments are not among them. */
484
+ blocks: readonly TextBlock[],
485
+ /** The comments the view includes, by `w:id`, in the comments part's order (REQ-504). */
486
+ comments: ReadonlyMap<string, TextComment>,
487
+ /** The warnings raised (REQ-801), never with the document's text (REQ-802). */
488
+ warnings: readonly TextWarning[],
489
+ /**
490
+ * The result's metadata (REQ-801, REQ-515), whatever the options: `fields_update_on_open`, and the
491
+ * document properties under `core`, `app` and `custom`, each a record, present when the package has
492
+ * that part. Property values are document text, in the text stream only under `metadata: true`.
493
+ */
494
+ metadata: Readonly<Record<string, unknown>>,
495
+ /** The options the result was made with. */
496
+ options: TextOptions);
497
+ /**
498
+ * Several results as one, in the order given (CR-012 section 4.4): the blocks one after another, the
499
+ * comments together, each warning once, the metadata and options the first's. What the editor
500
+ * assembles from its per-part calls under one `TextContext`.
501
+ */
502
+ static concat(...results: TextResult[]): TextResult;
503
+ toJSON(): Record<string, unknown>;
504
+ }