@docx4j/core-ts 0.4.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.
- package/NOTICE +4 -0
- package/README.md +34 -3
- package/dist/html/convert.mjs +40 -15
- 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 +153 -19
- package/dist/model/content/Body.mjs +570 -131
- package/dist/model/content/Comment.d.mts +21 -3
- package/dist/model/content/Comment.mjs +202 -19
- package/dist/model/content/ContentControl.d.mts +197 -18
- package/dist/model/content/ContentControl.mjs +664 -95
- package/dist/model/content/Font.d.mts +67 -17
- package/dist/model/content/Font.mjs +114 -35
- package/dist/model/content/InlinePicture.d.mts +82 -7
- package/dist/model/content/InlinePicture.mjs +221 -28
- package/dist/model/content/List.mjs +13 -1
- package/dist/model/content/Paragraph.d.mts +213 -14
- package/dist/model/content/Paragraph.mjs +936 -100
- package/dist/model/content/Range.d.mts +242 -11
- package/dist/model/content/Range.mjs +975 -119
- 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 +109 -33
- package/dist/model/content/TrackedChange.d.mts +301 -16
- package/dist/model/content/TrackedChange.mjs +1284 -158
- package/dist/model/content/binder.d.mts +2 -1
- package/dist/model/content/binder.mjs +48 -1
- 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 +8 -3
- package/dist/model/content/index.mjs +7 -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/outline.d.mts +5 -0
- package/dist/model/content/outline.mjs +13 -0
- package/dist/model/content/placeholders.d.mts +110 -0
- package/dist/model/content/placeholders.mjs +253 -0
- package/dist/model/content/relationships.d.mts +30 -0
- package/dist/model/content/relationships.mjs +133 -0
- package/dist/model/content/search.d.mts +72 -0
- package/dist/model/content/search.mjs +204 -2
- package/dist/model/content/spanEdits.d.mts +159 -0
- package/dist/model/content/spanEdits.mjs +728 -0
- package/dist/model/content/story.d.mts +44 -0
- package/dist/model/content/story.mjs +92 -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 +100 -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 +28 -0
- package/dist/model/content/tracking.mjs +149 -10
- package/dist/model/content/tree.d.mts +212 -13
- package/dist/model/content/tree.mjs +356 -35
- package/dist/model/customxml/CustomXmlPartCollection.d.mts +8 -0
- package/dist/model/customxml/CustomXmlPartCollection.mjs +34 -11
- package/dist/model/customxml/XmlMapping.d.mts +1 -1
- package/dist/model/customxml/XmlMapping.mjs +11 -0
- package/dist/model/customxml/bindings.d.mts +21 -2
- package/dist/model/customxml/bindings.mjs +76 -32
- package/dist/model/customxml/kinds.d.mts +8 -3
- package/dist/model/customxml/kinds.mjs +26 -5
- package/dist/model/customxml/picturePlaceholder.d.mts +17 -0
- package/dist/model/customxml/picturePlaceholder.mjs +32 -0
- package/dist/model/customxml/pictures.d.mts +9 -5
- package/dist/model/customxml/pictures.mjs +31 -13
- package/dist/model/customxml/xhtml.mjs +8 -2
- package/dist/model/fonts/families.generated.mjs +2 -2
- package/dist/model/fonts/registry.mjs +7 -1
- package/dist/model/fonts/substitutions.generated.mjs +2 -2
- package/dist/model/fonts/themes.generated.mjs +1 -1
- package/dist/model/index.d.mts +2 -0
- package/dist/model/index.mjs +4 -0
- package/dist/model/listnumbering/Emulator.d.mts +37 -5
- package/dist/model/listnumbering/Emulator.mjs +63 -9
- package/dist/model/listnumbering/definitions.mjs +18 -0
- package/dist/model/properties/PropertyResolver.d.mts +87 -7
- package/dist/model/properties/PropertyResolver.mjs +197 -17
- package/dist/model/properties/catalogue.d.mts +32 -4
- package/dist/model/properties/catalogue.mjs +115 -36
- package/dist/model/properties/log.d.mts +1 -1
- package/dist/model/properties/log.mjs +5 -5
- package/dist/model/properties/table.d.mts +16 -2
- package/dist/model/properties/table.mjs +17 -5
- package/dist/model/text/Extractor.d.mts +289 -0
- package/dist/model/text/Extractor.mjs +2162 -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 +539 -0
- package/dist/model/text/TextContext.d.mts +161 -0
- package/dist/model/text/TextContext.mjs +425 -0
- package/dist/model/text/TextOptions.d.mts +150 -0
- package/dist/model/text/TextOptions.mjs +278 -0
- package/dist/model/text/TextResult.d.mts +504 -0
- package/dist/model/text/TextResult.mjs +526 -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 +911 -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 +7 -0
- package/dist/model/text/index.mjs +8 -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/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 +21 -5
- package/dist/opc/Load.d.mts +9 -2
- package/dist/opc/Save.d.mts +17 -0
- package/dist/opc/Save.mjs +12 -2
- package/dist/opc/index.d.mts +3 -3
- package/dist/opc/index.mjs +2 -2
- package/dist/opc/mce/preprocessor.d.mts +88 -7
- package/dist/opc/mce/preprocessor.mjs +144 -37
- package/dist/opc/mce/understood.d.mts +34 -0
- package/dist/opc/mce/understood.mjs +55 -3
- package/dist/packages/OpcPackage.d.mts +20 -0
- package/dist/packages/OpcPackage.mjs +16 -3
- package/dist/packages/WordprocessingMLPackage.d.mts +77 -7
- package/dist/packages/WordprocessingMLPackage.mjs +242 -11
- package/dist/parts/DefaultXmlPart.mjs +2 -2
- package/dist/parts/Part.d.mts +10 -2
- package/dist/parts/XmlPart.d.mts +35 -32
- package/dist/parts/XmlPart.mjs +107 -107
- package/dist/parts/wml/comments.mjs +30 -0
- package/dist/parts/wml/index.mjs +12 -0
- package/dist/xml/dom.d.mts +7 -0
- package/dist/xml/dom.mjs +18 -0
- package/package.json +2 -2
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type * as wml from '@docx4j/generated-objects-ts/modules/org_docx4j_wml';
|
|
2
2
|
import { XmlMapping } from '../customxml/XmlMapping.mjs';
|
|
3
3
|
import { CheckboxContentControl, DatePickerContentControl, ListContentControl, PictureContentControl, RepeatingSectionContentControl, GroupContentControl } from '../customxml/kinds.mjs';
|
|
4
|
+
import { type LineBreaks } from './officeText.mjs';
|
|
5
|
+
import { type DefaultEntry } from './placeholders.mjs';
|
|
4
6
|
import { type SdtKind } from '@docx4j/generated-objects-ts/builders/wml';
|
|
5
|
-
import { type Element } from './tree.mjs';
|
|
7
|
+
import { type Element, type BranchMode } from './tree.mjs';
|
|
6
8
|
import type { Body } from './Body.mjs';
|
|
7
9
|
import type { Paragraph } from './Paragraph.mjs';
|
|
8
10
|
import { Range } from './Range.mjs';
|
|
@@ -56,7 +58,11 @@ export declare class ContentControl {
|
|
|
56
58
|
set title(value: string);
|
|
57
59
|
/** w:id, the number Word gives a control; 0 when it has none. */
|
|
58
60
|
get id(): number;
|
|
59
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* The control's text as Office JS gives it (CR-012 phase 4): a run-level control's span of
|
|
63
|
+
* `Paragraph.text`; a block-level one's content as `Body.text` reads it, its paragraphs a mark `\r` apart
|
|
64
|
+
* (check 51); a row control's cells a `\t` apart and a cell control's paragraphs `\r` apart (check 53).
|
|
65
|
+
*/
|
|
60
66
|
get text(): string;
|
|
61
67
|
/** Every paragraph in the control; for a run-level control, the paragraph it is in. */
|
|
62
68
|
get paragraphs(): Paragraph[];
|
|
@@ -64,6 +70,12 @@ export declare class ContentControl {
|
|
|
64
70
|
get tables(): Table[];
|
|
65
71
|
/** The controls nested in this one, in document order. */
|
|
66
72
|
get contentControls(): ContentControl[];
|
|
73
|
+
/**
|
|
74
|
+
* Office JS `getContentControls` (WordApi 1.5): the content controls `contentControls` lists, those of `options.types`
|
|
75
|
+
* where given. Word's `contentControls` lists rich-text controls only; this package's lists every kind, a recorded
|
|
76
|
+
* departure (CR-002 section 60 G1, check 55b), so this is how add-in code that asks for plain-text controls finds them.
|
|
77
|
+
*/
|
|
78
|
+
getContentControls(options?: ContentControlOptions): ContentControl[];
|
|
67
79
|
/**
|
|
68
80
|
* Text at the start, the end, or replacing the control's text. On a **bound** control the value
|
|
69
81
|
* is written through to the custom XML node as well when the mapping resolves (CR-002 phase E):
|
|
@@ -72,17 +84,112 @@ export declare class ContentControl {
|
|
|
72
84
|
* write is left to `pkg.customXmlParts.updateFromContentControls()`.
|
|
73
85
|
*/
|
|
74
86
|
insertText(text: string, location: 'Start' | 'End' | 'Replace'): Range;
|
|
87
|
+
/**
|
|
88
|
+
* The glossary entry the control's `w:placeholder` names, which makes it Word's form; undefined where it names none,
|
|
89
|
+
* the bare form, which has no entry to show once emptied, nor for `placeholderText` to read (CR-002 section 63; an
|
|
90
|
+
* extension). Writes are the same in both forms (check 63's run 2).
|
|
91
|
+
*/
|
|
92
|
+
get placeholderEntry(): string | undefined;
|
|
93
|
+
/** @internal True for a block or run-level control showing its placeholder, which a text write replaces (section 63). */
|
|
94
|
+
get showsPlaceholderContent(): boolean;
|
|
95
|
+
/** The package's glossary entries, where the control is in a package. */
|
|
96
|
+
private get glossary();
|
|
97
|
+
/**
|
|
98
|
+
* @internal Text written into the content of this control while it shows its placeholder, by any route: its own
|
|
99
|
+
* `insertText`, its 'Content' range's, a block control's paragraph's (CR-002 section 63, D1, D2 (b), D5, D11). The
|
|
100
|
+
* placeholder is no content, in either form (checks 64 and 67, check 63's run 2): its runs go, untracked, the text takes
|
|
101
|
+
* their place in one paragraph, and the flag is cleared; under tracking only the insertion is recorded. The text takes
|
|
102
|
+
* the control's own run properties (`w:sdtPr/w:rPr`) and nothing of the placeholder's (check 68, cases 1 to 20).
|
|
103
|
+
*/
|
|
104
|
+
writePlaceholder(text: string, options?: {
|
|
105
|
+
lineBreaks?: LineBreaks;
|
|
106
|
+
}): Range;
|
|
107
|
+
/** The control's first paragraph, made where its content has none. */
|
|
108
|
+
private firstParagraph;
|
|
109
|
+
/**
|
|
110
|
+
* Takes the placeholder's runs out of the content: a run-level control's, or a block control's paragraphs', the first
|
|
111
|
+
* paragraph kept, emptied, and any other going. What held them.
|
|
112
|
+
*/
|
|
113
|
+
private takePlaceholderRuns;
|
|
114
|
+
/**
|
|
115
|
+
* Shows Word's filler for a control emptied in the bare form, where no glossary entry gives it a placeholder: the flag
|
|
116
|
+
* on over a run of five spaces, in the control's own run properties (CR-002 section 63, D10; check 63's run 2, cases 6,
|
|
117
|
+
* 17, 32 and 43, and check 52's case 13). Nothing is marked under tracking. The spaces read as no text while the flag is
|
|
118
|
+
* on (CR-012 section 18).
|
|
119
|
+
*/
|
|
120
|
+
private showFiller;
|
|
121
|
+
/**
|
|
122
|
+
* @internal A write through the control's 'Content' or 'Whole' range that the control takes (D3, D4): text into a
|
|
123
|
+
* control showing its placeholder, or into an empty run-level control, goes inside it; a 'Whole' range's Replace over
|
|
124
|
+
* a run-level control showing its placeholder takes the control, the text in its place. Undefined where the range's
|
|
125
|
+
* own write applies.
|
|
126
|
+
*/
|
|
127
|
+
writeThrough(part: 'Content' | 'Whole', text: string, location: string): Range | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* @internal A delete through the control's 'Content' or 'Whole' range that the control takes; false where the range's
|
|
130
|
+
* own delete applies. A 'Content' delete of a control showing its placeholder keeps the control and the flag: in the
|
|
131
|
+
* bare form over Word's filler, five spaces (D10; check 63's run 2, cases 6, 17, 32 and 43, nothing marked under
|
|
132
|
+
* tracking); in Word's form nothing changes, the placeholder being no content. A 'Whole' delete takes a run-level
|
|
133
|
+
* control showing its placeholder (D3).
|
|
134
|
+
*/
|
|
135
|
+
deleteThrough(part: 'Content' | 'Whole'): boolean;
|
|
136
|
+
/**
|
|
137
|
+
* @internal After a 'Content' delete, untracked, that left the control holding no text: in Word's form it shows its
|
|
138
|
+
* entry again (check 66 case 3); in the bare form Word's filler (D10; check 52's case 13), as for a control of a kind
|
|
139
|
+
* Word gives no default entry, naming an entry the glossary lacks.
|
|
140
|
+
*/
|
|
141
|
+
showEmptied(): void;
|
|
142
|
+
/**
|
|
143
|
+
* @internal Word's default placeholder entry for this control's kind (CR-002 section 63.22; docx4j CR-063's D8): the
|
|
144
|
+
* text kinds', the date picker's, the lists', a building block gallery's, a repeating section item's. Undefined for a
|
|
145
|
+
* kind Word gives none.
|
|
146
|
+
*/
|
|
147
|
+
get defaultPlaceholderEntry(): DefaultEntry | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* @internal Whether an empty control shows a placeholder in Word's form (D8; docx4j CR-063's D3 and D8): a kind Word
|
|
150
|
+
* gives a default entry, or one naming an entry the glossary holds.
|
|
151
|
+
*/
|
|
152
|
+
get showsWordsFormPlaceholder(): boolean;
|
|
153
|
+
/**
|
|
154
|
+
* @internal Takes the control whole (D3): a Replace or delete over a control showing its placeholder, as Word takes one
|
|
155
|
+
* (check 63 cases 12, 18 to 20, 26, 38, 44 to 46 and 52). Untracked it goes, a block control leaving its paragraph,
|
|
156
|
+
* emptied, in its place; tracked it is marked deleted in Word's form (`markHolderDeleted`: `w:customXmlDelRange`
|
|
157
|
+
* markers around it and inside its content), its placeholder gone unmarked and the flag cleared (check 63's run 2,
|
|
158
|
+
* cases 38, 44 to 46 and 52). `text` goes where a run-level control stood, before it under tracking, as Word puts a
|
|
159
|
+
* Replace's insertion first.
|
|
160
|
+
*/
|
|
161
|
+
takeWhole(text?: string): Range;
|
|
162
|
+
/** The control marked deleted with Word's markers, its placeholder gone, unmarked, and the flag cleared (`takeWhole`). */
|
|
163
|
+
private markWholeDeleted;
|
|
164
|
+
/**
|
|
165
|
+
* Shows the control's placeholder (CR-002 section 63, D8; section 63.18): a copy of the content of the entry its
|
|
166
|
+
* `w:placeholder` names, as the glossary holds it, the control's own run properties not over it, as Word shows it
|
|
167
|
+
* (check 68, section 63.21), with `w:showingPlcHdr`. A control naming no entry, or one the glossary lacks, is made to
|
|
168
|
+
* name Word's default entry for its kind (section 63.22: a date picker's is "Click or tap to enter a date.", a list's
|
|
169
|
+
* "Choose an item."), which is written into the glossary on save where it lacks it (D9), as docx4j's CR-063 has it:
|
|
170
|
+
* Word's save drops a reference no entry holds (check 65). A kind Word gives no default entry (a picture, a check box)
|
|
171
|
+
* keeps the name it has, and naming none shows docx4j's run, with no reference; any control keeps its name until the
|
|
172
|
+
* glossary is read (`getBody`, `Word.run`), showing its kind's default text. An extension.
|
|
173
|
+
*/
|
|
174
|
+
showPlaceholder(): void;
|
|
75
175
|
private insertTextInto;
|
|
76
176
|
/** A paragraph at the start or end of a block control; before or after the paragraph of a run control. */
|
|
77
177
|
insertParagraph(text: string, location: 'Start' | 'End' | 'Before' | 'After'): Paragraph;
|
|
78
178
|
/** Matches within the control. */
|
|
79
179
|
search(text: string, options?: SearchOptions): Range[];
|
|
80
180
|
/**
|
|
81
|
-
* The control's range. For a run-level control, exactly the text it holds; for the other forms,
|
|
82
|
-
* the first
|
|
181
|
+
* The control's range. For a run-level control, exactly the text it holds; for the other forms, its
|
|
182
|
+
* paragraphs: one `Range` from the first one's start to the last one's end (CR-014 phase 1), its 'Whole'
|
|
183
|
+
* ending with the last one's mark, as Office JS's does (check 51: `CCP1\rCCP2\rCCP3\r`, its 'Content'
|
|
184
|
+
* without the last `\r`).
|
|
83
185
|
*/
|
|
84
186
|
getRange(location?: 'Whole' | 'Start' | 'End' | 'Content'): Range;
|
|
85
|
-
|
|
187
|
+
private rangeOf;
|
|
188
|
+
/**
|
|
189
|
+
* Removes the control; `keepContent` puts what it held in its place, as Office JS. Where the control held the
|
|
190
|
+
* paragraph a table cell ends with, that paragraph stays in its place, emptied, its properties kept, outside
|
|
191
|
+
* any control, as Word keeps a cell's last paragraph (check 52, case 95; CR-002 section 55.6).
|
|
192
|
+
*/
|
|
86
193
|
delete(keepContent?: boolean): void;
|
|
87
194
|
/** The XML of the control (extension). */
|
|
88
195
|
getXml(): Promise<string>;
|
|
@@ -103,14 +210,21 @@ export declare class ContentControl {
|
|
|
103
210
|
/** The control's data binding (Office JS `xmlMapping`), backed by `w:dataBinding`. */
|
|
104
211
|
get xmlMapping(): XmlMapping;
|
|
105
212
|
/**
|
|
106
|
-
* The placeholder Word shows for an empty control: the
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
213
|
+
* The placeholder Word shows for an empty control: the text of the glossary entry the control's `w:placeholder` names,
|
|
214
|
+
* as Office JS reads it (CR-002 section 63, D8; check 65), `null` where the control names none (the bare form) or the
|
|
215
|
+
* glossary lacks the entry. The glossary is read when the body is (`getBody`, `Word.run`). Setting it names Word's
|
|
216
|
+
* default entry for Word's default text, else a new entry holding the text, named as Word names one (32 hex digits),
|
|
217
|
+
* which is written into the glossary on save, the entry named before left there; a control showing its placeholder,
|
|
218
|
+
* or holding nothing, shows the new text. A control's content is left alone. Until section 63 the text was written as
|
|
219
|
+
* the control's content in the bare form, and a control holding content refused it.
|
|
111
220
|
*/
|
|
112
|
-
get placeholderText(): string;
|
|
221
|
+
get placeholderText(): string | null;
|
|
113
222
|
set placeholderText(text: string);
|
|
223
|
+
/**
|
|
224
|
+
* Blocks taken out of the control's content: the relationships only they used (a picture's image) and the comments
|
|
225
|
+
* whose references they held go when the package is saved, as a deletion's do.
|
|
226
|
+
*/
|
|
227
|
+
private removeBlocks;
|
|
114
228
|
/** Office JS `appearance`: how Word draws the control (`w15:appearance`). */
|
|
115
229
|
get appearance(): ContentControlAppearance;
|
|
116
230
|
set appearance(value: ContentControlAppearance);
|
|
@@ -152,6 +266,8 @@ export declare class ContentControl {
|
|
|
152
266
|
get runProperties(): wml.RPr | undefined;
|
|
153
267
|
/** Whether a plain-text control accepts several lines (`w:text/@w:multiLine`). */
|
|
154
268
|
get isMultiLine(): boolean;
|
|
269
|
+
/** Office JS's name for `isShowingPlaceholder` (`showingPlaceholderText`, WordApiDesktop 1.3, read-only there). */
|
|
270
|
+
get showingPlaceholderText(): boolean;
|
|
155
271
|
/** Whether the control is showing its placeholder rather than a value (`w:showingPlcHdr`). */
|
|
156
272
|
get isShowingPlaceholder(): boolean;
|
|
157
273
|
set isShowingPlaceholder(value: boolean);
|
|
@@ -166,18 +282,81 @@ export declare class ContentControl {
|
|
|
166
282
|
/** A copy of this control right after it, as Word's repeating-section + button does (extension). */
|
|
167
283
|
insertCopyAfter(): ContentControl;
|
|
168
284
|
/**
|
|
169
|
-
* Writes the control's text into the node it is bound to, when there is one and the XPath engine
|
|
170
|
-
* is warm. Silent when it is not: reading a custom XML part is `pkg.customXmlParts.load()`'s job,
|
|
285
|
+
* @internal Writes the control's text into the node it is bound to, when there is one and the XPath engine
|
|
286
|
+
* is warm (CR-002 section 63, D7: every text write into a bound control). Silent when it is not: reading a custom XML part is `pkg.customXmlParts.load()`'s job,
|
|
171
287
|
* and `updateFromContentControls()` is the explicit form of this write.
|
|
172
288
|
*/
|
|
173
|
-
|
|
174
|
-
private firstRunOfContent;
|
|
289
|
+
syncBoundNode(): void;
|
|
175
290
|
private lockValue;
|
|
176
291
|
private setLock;
|
|
292
|
+
/**
|
|
293
|
+
* True for a control in the selected branch of a kept `mc:AlternateContent`, at any level, which the
|
|
294
|
+
* collectors list as Word reads it (CR-013 phase 2). Such a view is read-only (D4).
|
|
295
|
+
*/
|
|
296
|
+
get inBranch(): boolean;
|
|
297
|
+
/** Refuses a write to a control in a branch (CR-013 D4). Internal: the control's mutators, and its kinds', call it first. */
|
|
298
|
+
assertWritable(): void;
|
|
177
299
|
/** The table a row-level or cell-level control belongs to. */
|
|
178
300
|
private ancestorTable;
|
|
179
301
|
}
|
|
180
|
-
/**
|
|
181
|
-
|
|
302
|
+
/**
|
|
303
|
+
* Every content control under a list of block-level items, in document order, nested ones included. In a
|
|
304
|
+
* kept `mc:AlternateContent` a reader's (`'read'`, the default) takes the selected branch's controls (CR-013
|
|
305
|
+
* phase 2), the binding passes (`'every'`) every branch's, each other branch's where the element stands
|
|
306
|
+
* (phase 3).
|
|
307
|
+
*/
|
|
308
|
+
export declare function collectControls(items: Element[], body: Body, out: ContentControl[], mode?: BranchMode): void;
|
|
182
309
|
/** The run-level controls in a paragraph (or any run holder), in order, nested ones included. */
|
|
183
|
-
export declare function collectRunControls(holder: object, body: Body, out: ContentControl[]): void;
|
|
310
|
+
export declare function collectRunControls(holder: object, body: Body, out: ContentControl[], mode?: BranchMode): void;
|
|
311
|
+
/**
|
|
312
|
+
* A view of the content control whose `w:sdt` value this is, found in its owner's list (a paragraph's runs, a body's
|
|
313
|
+
* blocks, a holder's items).
|
|
314
|
+
*/
|
|
315
|
+
export declare function controlViewOf(sdt: object, body: Body): ContentControl;
|
|
316
|
+
/**
|
|
317
|
+
* A block-level control bound by `w:dataBinding`, untyped, `w:text` or `w:richText`, whose node doesn't hold flat OPC
|
|
318
|
+
* (CR-002 section 61 H1): Word holds its content to one paragraph, and can't open a file where it holds more (check 56,
|
|
319
|
+
* docx4j-python's file 3). A node not resolved (the custom XML parts not loaded) counts as not flat OPC. `w15:dataBinding`
|
|
320
|
+
* is Word's rich-text binding, and isn't this.
|
|
321
|
+
*/
|
|
322
|
+
export declare function isBoundBlockControl(control: ContentControl): boolean;
|
|
323
|
+
/**
|
|
324
|
+
* How a control holds lines, as Word reads it: `multi` or `single` for a plain-text control (`w:text` and its
|
|
325
|
+
* `w:multiLine`), `single` for a bound block control Word reads as plain text (section 61 H4); undefined for any other.
|
|
326
|
+
*/
|
|
327
|
+
export declare function plainTextLinesOf(control: ContentControl): 'multi' | 'single' | undefined;
|
|
328
|
+
/**
|
|
329
|
+
* Text for a run-level control: a line feed or carriage return there is refused before anything changes (CR-002
|
|
330
|
+
* section 60 F4: Word, given one, moved a bound plain-text control to block level), and a plain-text control's breaks
|
|
331
|
+
* go as its kind takes them (F3: dropped in a single-line one).
|
|
332
|
+
*/
|
|
333
|
+
export declare function textForRunControl(control: ContentControl, text: string): string;
|
|
334
|
+
/** Word's error for a block write into a bound block control, where measured (CR-002 section 61 H3; check 56). */
|
|
335
|
+
export type BlockRefusal = 'InvalidArgument' | 'GeneralException';
|
|
336
|
+
/**
|
|
337
|
+
* Refuses, before anything changes, putting blocks into a block-level control bound by `w:dataBinding` (untyped,
|
|
338
|
+
* `w:text` or `w:richText`, its node not flat OPC) that would leave it holding anything but one paragraph: Word can't
|
|
339
|
+
* open such a file, and its repair loses the extra blocks (CR-002 section 61, check 56). Word's own error where
|
|
340
|
+
* measured (`insertTable` `InvalidArgument`, `insertOoxml` `GeneralException`), else `NotSupportedError` (H3).
|
|
341
|
+
*/
|
|
342
|
+
export declare function assertControlHolds(body: Body, holder: object, container: Element[], elements: readonly Element[], refusal?: BlockRefusal, member?: [string, string]): void;
|
|
343
|
+
/** Office JS `Word.ContentControlOptions`: the types `getContentControls` lists. */
|
|
344
|
+
export interface ContentControlOptions {
|
|
345
|
+
/** `ContentControlType` values; Office JS takes the enum's strings. */
|
|
346
|
+
types?: readonly string[];
|
|
347
|
+
}
|
|
348
|
+
/** The controls of `options.types`, or all of them. */
|
|
349
|
+
export declare function controlsOfTypes(controls: ContentControl[], options?: ContentControlOptions): ContentControl[];
|
|
350
|
+
/**
|
|
351
|
+
* Whether a control of this kind made on an empty range shows its default placeholder, as Word's does (CR-002 section
|
|
352
|
+
* 63, D8; check 64; Jason's `placeholders.docx`, section 63.22): a text control, a date picker, a drop-down list or a
|
|
353
|
+
* combo box. The building block and repeating section kinds are made as before.
|
|
354
|
+
*/
|
|
355
|
+
export declare function showsPlaceholderWhenMade(kind: ContentControlType | undefined): boolean;
|
|
356
|
+
/** A stand-in for a block-level control about to be made, for `assertControlHolds` before `sdtOf` takes its content. */
|
|
357
|
+
export declare const BLOCK_CONTROL: Element;
|
|
358
|
+
/**
|
|
359
|
+
* Whether a block-level control holds one paragraph and nothing else at block level, or nothing yet: what a bound
|
|
360
|
+
* block control may hold (CR-002 section 61).
|
|
361
|
+
*/
|
|
362
|
+
export declare function holdsOneParagraph(control: ContentControl): boolean;
|