@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
|
@@ -3,15 +3,26 @@ import { Font } from './Font.mjs';
|
|
|
3
3
|
import type { Paragraph, FormattingOptions } from './Paragraph.mjs';
|
|
4
4
|
import type { BlockElement } from './Body.mjs';
|
|
5
5
|
import { type Element, type TextViewOptions } from './tree.mjs';
|
|
6
|
-
import { ContentControl, type ContentControlType } from './ContentControl.mjs';
|
|
6
|
+
import { ContentControl, type ContentControlType, type ContentControlOptions } from './ContentControl.mjs';
|
|
7
7
|
import { type SearchOptions } from './search.mjs';
|
|
8
8
|
import { type CommentContent, type CommentOptions } from './comments.mjs';
|
|
9
9
|
import type { Comment } from './Comment.mjs';
|
|
10
10
|
import type { TrackedChange } from './TrackedChange.mjs';
|
|
11
|
+
import type { Table } from './Table.mjs';
|
|
12
|
+
import type { TableCell } from './Table.mjs';
|
|
11
13
|
/**
|
|
12
|
-
* A subset of Office JS `Word.Range`: a span of text
|
|
13
|
-
* paragraph
|
|
14
|
-
*
|
|
14
|
+
* A subset of Office JS `Word.Range`: a span of text from an offset in one paragraph to an offset in the same
|
|
15
|
+
* paragraph or a later one of the same story, [start, end), `start` in `paragraph`'s text and `end` in
|
|
16
|
+
* `endParagraph`'s. Positions are recomputed from the tree on every use, so a range stays valid across edits
|
|
17
|
+
* made through it; edits made elsewhere may shift it.
|
|
18
|
+
*
|
|
19
|
+
* A range within one paragraph is what it has been since CR-002: `endParagraph` is `paragraph`. A range across
|
|
20
|
+
* paragraphs (CR-014 phase 1) reads as Office JS's does (check 52): its `text` in `body.text`'s form between
|
|
21
|
+
* its ends, `paragraphs` every paragraph it touches (a table's cells' among them), `font` `null` where the runs
|
|
22
|
+
* differ, `search`, the tracked changes and the comments over all of it. Its writes (phase 2) are Word's too:
|
|
23
|
+
* `delete` and `insertText('Replace')` join the paragraphs in the last one's properties, `font` formats every
|
|
24
|
+
* run and mark in it, `insertText` goes at its ends, and `insertParagraph` splits the paragraph at its start or
|
|
25
|
+
* end; the rest of its writes throw `NotSupportedError`.
|
|
15
26
|
*
|
|
16
27
|
* A picture has a place in the text and no text of its own, so a picture at the range's start or
|
|
17
28
|
* end offset may be inside it or outside it. `whole` says: a range from `Paragraph.getRange('Whole')`
|
|
@@ -20,22 +31,150 @@ import type { TrackedChange } from './TrackedChange.mjs';
|
|
|
20
31
|
* hit replaced does not take the picture beside it (CR-002 section 48).
|
|
21
32
|
*/
|
|
22
33
|
export declare class Range {
|
|
23
|
-
readonly paragraph: Paragraph;
|
|
24
34
|
start: number;
|
|
25
35
|
end: number;
|
|
26
|
-
|
|
27
|
-
|
|
36
|
+
private startParagraph;
|
|
37
|
+
private lastParagraph;
|
|
38
|
+
private holdsWhole;
|
|
39
|
+
private holdsMark;
|
|
40
|
+
private lastMarkText;
|
|
41
|
+
constructor(paragraph: Paragraph, start: number, end: number, whole?: boolean,
|
|
42
|
+
/**
|
|
43
|
+
* A paragraph's 'Whole' range: its text ends with the paragraph's mark, as Office JS's does (check 48:
|
|
44
|
+
* `\r`, and `\t` for a cell's last paragraph, the cell's end), where 'Content' ends with its text.
|
|
45
|
+
* The mark is no offset: every edit and search works on the text before it.
|
|
46
|
+
*/
|
|
47
|
+
mark?: boolean,
|
|
48
|
+
/** The paragraph holding `end`, where it isn't `paragraph` (CR-014 phase 1). */
|
|
49
|
+
endParagraph?: Paragraph,
|
|
50
|
+
/**
|
|
51
|
+
* What the range's text ends with in place of `endParagraph`'s mark, where `mark` is set: a table's
|
|
52
|
+
* 'Whole' range ends with its last row's end, `\r\n` (check 52).
|
|
53
|
+
*/
|
|
54
|
+
endMark?: string);
|
|
55
|
+
/** @internal Which of a paragraph's own ranges this is, where its writes at the end are the paragraph's End's (D12). */
|
|
56
|
+
private endOf?;
|
|
57
|
+
/** @internal Marks this range as its paragraph's End or Content range (`Paragraph.getRange`); returns it. */
|
|
58
|
+
atEndOf(kind: 'End' | 'Content'): this;
|
|
59
|
+
/** Whether text put at `location` is written at the paragraph's End: its End range's, at any location; its Content range's End and After. */
|
|
60
|
+
private writesAtParagraphEnd;
|
|
61
|
+
/**
|
|
62
|
+
* @internal The content control whose 'Content' or 'Whole' range this is (CR-002 section 63, D4): a run-level
|
|
63
|
+
* control holding no text, or showing its placeholder, has no width, so its own range is where its writes go in,
|
|
64
|
+
* not its offset, which the text either side of it shares.
|
|
65
|
+
*/
|
|
66
|
+
ofControl: {
|
|
67
|
+
control: ContentControl;
|
|
68
|
+
part: 'Content' | 'Whole';
|
|
69
|
+
} | undefined;
|
|
70
|
+
/** The paragraph holding `start`. */
|
|
71
|
+
get paragraph(): Paragraph;
|
|
72
|
+
/** The paragraph holding `end`: `paragraph` for a range within one paragraph (CR-014 phase 1). */
|
|
73
|
+
get endParagraph(): Paragraph;
|
|
74
|
+
/** The range holds its paragraphs' whole content, the pictures at its edges too (CR-002 section 48). */
|
|
75
|
+
get whole(): boolean;
|
|
76
|
+
/** The range's text ends with its last paragraph's mark: a 'Whole' range. */
|
|
77
|
+
get mark(): boolean;
|
|
78
|
+
/** What the text ends with in place of the last paragraph's mark: a table's 'Whole' range's `\r\n`. */
|
|
79
|
+
get endMark(): string | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* True where the range holds its last paragraph's mark (a 'Whole' range ending at the paragraph's end), or a
|
|
82
|
+
* table's end in its place: what `delete` takes and `Replace` keeps (check 52, W1 and W2). An extension.
|
|
83
|
+
*/
|
|
84
|
+
get holdsEndMark(): boolean;
|
|
85
|
+
/** The range collapsed where an edit through it closed it up, or over what the edit put there. */
|
|
86
|
+
/**
|
|
87
|
+
* This range moved onto another's span: its paragraphs and offsets (a replacement's, CR-002 section 60); `fresh`, it
|
|
88
|
+
* no longer holds a mark or a paragraph's whole content either, as `landAt` leaves one.
|
|
89
|
+
*/
|
|
90
|
+
private cover;
|
|
91
|
+
private landAt;
|
|
92
|
+
/** True for a range across paragraphs: its ends are in two (extension; CR-014). */
|
|
93
|
+
get spansParagraphs(): boolean;
|
|
28
94
|
/** The edges `Paragraph.splice` is given: both for a whole range. */
|
|
29
95
|
private get edges();
|
|
96
|
+
/** The story's layout, and where this range's two paragraphs are in it. */
|
|
97
|
+
private located;
|
|
98
|
+
/** The view of a paragraph of this range's story: this range's own where it is one of its two. */
|
|
99
|
+
private viewOf;
|
|
100
|
+
/**
|
|
101
|
+
* The range as one range per paragraph it touches: its part of the first, the whole of each between, its
|
|
102
|
+
* part of the last. A range within one paragraph is itself.
|
|
103
|
+
*/
|
|
104
|
+
private pieces;
|
|
105
|
+
/**
|
|
106
|
+
* Refuses a hyperlink set on a range across paragraphs. Word wrote a HYPERLINK field from the first paragraph into
|
|
107
|
+
* the last (check 54 case 34), where this package's links are `w:hyperlink` elements, one paragraph's each, which
|
|
108
|
+
* its getter reads (CR-014 section 12).
|
|
109
|
+
*/
|
|
110
|
+
private assertOneParagraph;
|
|
111
|
+
/** Refuses, before anything changes, a write over a paragraph of the range that is read-only (a text box's, a branch's). */
|
|
112
|
+
private assertWritableSpan;
|
|
113
|
+
/** Every paragraph the range touches, in document order, a table's cells' among them (check 52). */
|
|
30
114
|
get paragraphs(): Paragraph[];
|
|
115
|
+
/**
|
|
116
|
+
* The range's text, in `body.text`'s form across paragraphs (check 52): a mark `\r` between paragraphs, a
|
|
117
|
+
* table's cells a `\t` apart and each row ended `\r\n`; with the last paragraph's mark where the range
|
|
118
|
+
* holds it (a 'Whole' range).
|
|
119
|
+
*/
|
|
31
120
|
get text(): string;
|
|
32
121
|
set text(value: string);
|
|
33
|
-
/**
|
|
122
|
+
/** True when the range holds no text (Office JS `isEmpty`). */
|
|
123
|
+
get isEmpty(): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* The paragraph's style id (extension, as on Paragraph); a range across paragraphs gives the first one's. Set
|
|
126
|
+
* across paragraphs, each paragraph's (check 54 cases 32 and 33: Word gave both Heading 2).
|
|
127
|
+
*/
|
|
34
128
|
get styleId(): string;
|
|
35
129
|
set styleId(id: string);
|
|
36
|
-
/**
|
|
130
|
+
/**
|
|
131
|
+
* The range's style name, as Office JS reads it (checks 52 and 53). A range holding its paragraphs whole reads
|
|
132
|
+
* their paragraph style, where they share one, else `Normal`. Any other range reads its runs' character style
|
|
133
|
+
* where they share one (`Emphasis`), `''` where their character styles differ (some runs styled, some not: a
|
|
134
|
+
* footnote reference among plain text), and the paragraph style where none has one. Setting it sets the
|
|
135
|
+
* paragraph's style.
|
|
136
|
+
*/
|
|
37
137
|
get style(): string;
|
|
38
138
|
set style(id: string);
|
|
139
|
+
/** The built-in name of `style` (Office JS `styleBuiltIn`): `Other` where it is `''`, `Normal` where paragraphs across it differ. */
|
|
140
|
+
get styleBuiltIn(): string;
|
|
141
|
+
/** Sets each paragraph's style by its built-in name, as `style` does. */
|
|
142
|
+
set styleBuiltIn(value: string);
|
|
143
|
+
/**
|
|
144
|
+
* The paragraphs a style set on the range goes to: its own, or each across paragraphs (check 54 cases 32 and 33:
|
|
145
|
+
* Word gave a body paragraph and a list item Heading 2). Word also took away the body paragraph's centring and
|
|
146
|
+
* italic and the list item's numbering, which `Paragraph.style` doesn't (CR-014 section 12).
|
|
147
|
+
*/
|
|
148
|
+
private styledParagraphs;
|
|
149
|
+
/**
|
|
150
|
+
* What `style` reads: the runs' shared character style id, `''` where their character styles differ, or
|
|
151
|
+
* undefined where the paragraph style applies, with how to read that.
|
|
152
|
+
*/
|
|
153
|
+
private styleRead;
|
|
154
|
+
/** The table cell holding the range's start, if it is in one (Office JS `parentTableCell`, which throws instead). */
|
|
155
|
+
get parentTableCell(): TableCell | undefined;
|
|
156
|
+
/** The table holding the range's start, if it is in one (Office JS `parentTable`, which throws instead). */
|
|
157
|
+
get parentTable(): Table | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* The tables in the range (Office JS `Range.tables`): a table the range covers some of, unless the range is
|
|
160
|
+
* inside one of its cells, where that cell's tables are looked at instead (check 52: a range across a table,
|
|
161
|
+
* or into or out of one, lists it; a cell's whole range lists none).
|
|
162
|
+
*/
|
|
163
|
+
get tables(): Table[];
|
|
164
|
+
/**
|
|
165
|
+
* The content controls in the range (Office JS `Range.contentControls`): each control the range overlaps,
|
|
166
|
+
* except one holding the whole range, in document order (check 53: a range from a paragraph into a control
|
|
167
|
+
* lists it, one inside a control, its content whole, doesn't, one over an inline control lists it).
|
|
168
|
+
*/
|
|
169
|
+
get contentControls(): ContentControl[];
|
|
170
|
+
/**
|
|
171
|
+
* Office JS `getContentControls` (WordApi 1.5): the content controls `contentControls` lists, those of `options.types`
|
|
172
|
+
* where given. Word's `contentControls` lists rich-text controls only; this package's lists every kind, a recorded
|
|
173
|
+
* departure (CR-002 section 60 G1, check 55b), so this is how add-in code that asks for plain-text controls finds them.
|
|
174
|
+
*/
|
|
175
|
+
getContentControls(options?: ContentControlOptions): ContentControl[];
|
|
176
|
+
/** A body over this range's story, for its tables and controls. */
|
|
177
|
+
private storyBody;
|
|
39
178
|
/**
|
|
40
179
|
* The text in one of the two views (extension; `text` is the accepted one). `{ view: 'original' }`
|
|
41
180
|
* is offered on `Paragraph` and `Body`; on a `Range` it is the accepted-view span only, since a
|
|
@@ -52,18 +191,76 @@ export declare class Range {
|
|
|
52
191
|
getFont(options?: FormattingOptions): Font;
|
|
53
192
|
/** The runs the span covers (a run partly inside counts). */
|
|
54
193
|
get runs(): Element<wml.R>[];
|
|
194
|
+
/**
|
|
195
|
+
* Text put at the range's start ('Start', 'Before'), at its end ('End', 'After'), or in its place ('Replace').
|
|
196
|
+
* Across paragraphs (CR-014 phase 2, check 52) the start is in the first paragraph and the end in the last,
|
|
197
|
+
* before a last mark the range holds, and a replacement is `delete()` keeping a last mark, then the text where the
|
|
198
|
+
* paragraphs joined: untracked, in the first replaced character's look (`lookOf`); tracked, a `w:ins` before the
|
|
199
|
+
* deletion, as Word writes it. A range holding its paragraph's mark is replaced so too under tracking.
|
|
200
|
+
*/
|
|
55
201
|
insertText(text: string, location: 'Before' | 'After' | 'Start' | 'End' | 'Replace'): Range;
|
|
202
|
+
/**
|
|
203
|
+
* A new paragraph of the text where the range starts ('Before') or ends ('After'), splitting the paragraph there,
|
|
204
|
+
* as Word does (`insertParagraphAt`): across paragraphs (check 52) and within one (check 54 cases 1 to 3; until
|
|
205
|
+
* then a range within one paragraph put it before or after the whole paragraph). At a paragraph's start or end,
|
|
206
|
+
* or after a range holding its mark, it goes before or after the paragraph. This range keeps covering its text.
|
|
207
|
+
*/
|
|
56
208
|
insertParagraph(text: string, location: 'Before' | 'After'): Paragraph;
|
|
57
209
|
/**
|
|
58
210
|
* Word's `insertOoxml` at range level: a flat OPC `pkg:package` (or a bare fragment). One
|
|
59
211
|
* incoming paragraph's runs go at the start or the end of the span, or in its place; anything
|
|
60
212
|
* else is inserted as blocks before or after the paragraph. Returns what was inserted, as
|
|
61
|
-
* `insertXml` does.
|
|
213
|
+
* `insertXml` does. Across paragraphs (check 54 case 35) one paragraph's runs replace the range as
|
|
214
|
+
* `insertText('Replace')` replaces it, where the paragraphs joined; the start is the first paragraph's,
|
|
215
|
+
* the end the last's; several blocks go before the first paragraph or after the last, and replacing a
|
|
216
|
+
* range across paragraphs with several blocks is refused, as unmeasured.
|
|
62
217
|
*/
|
|
63
218
|
insertOoxml(ooxml: string, location: 'Before' | 'After' | 'Replace'): Promise<(Paragraph | BlockElement)[]>;
|
|
64
|
-
/**
|
|
219
|
+
/**
|
|
220
|
+
* The range's content removed as a replacement removes it, keeping a last mark the range holds (check 52):
|
|
221
|
+
* `delete()`'s join across paragraphs, else the paragraph's splice. Where the paragraphs closed up.
|
|
222
|
+
*/
|
|
223
|
+
private removeKeepingMark;
|
|
224
|
+
/**
|
|
225
|
+
* The extent of a range a replacement may take: refused where it ends with a whole table, as Word refused it
|
|
226
|
+
* (`GeneralException`, check 54 case 7), and where it starts with a whole table or control (unmeasured).
|
|
227
|
+
*/
|
|
228
|
+
private replaceableExtent;
|
|
229
|
+
/**
|
|
230
|
+
* Removes the span's text, and the pictures in it (CR-002 section 48). Across paragraphs, or holding its
|
|
231
|
+
* paragraph's mark, it is Word's (CR-014 phase 2, check 52; `deleteSpan`): the paragraphs join in the last one's
|
|
232
|
+
* properties, the blocks between go, a last mark the range holds goes with it, joining the paragraph after; a
|
|
233
|
+
* footnote whose reference goes goes on save. Tracked, the text is deleted and every mark in the range marked
|
|
234
|
+
* deleted. A range starting or ending inside a table is refused with `GeneralException`, as Office JS refuses it.
|
|
235
|
+
*/
|
|
65
236
|
delete(): void;
|
|
237
|
+
/** `delete()`'s own work. */
|
|
238
|
+
private deleteSpan;
|
|
239
|
+
/** `insertText(text, 'Replace')` across paragraphs, and any under tracking (CR-014 phases 2 and 3). */
|
|
240
|
+
private replaceAcross;
|
|
241
|
+
/**
|
|
242
|
+
* The hits of a query in the range, as Office JS's `search` gives them. A plain query holding `^p`, Word's
|
|
243
|
+
* paragraph mark, matches across paragraphs (`searchMarks`); any other matches a paragraph at a time.
|
|
244
|
+
*/
|
|
66
245
|
search(text: string, options?: SearchOptions): Range[];
|
|
246
|
+
/**
|
|
247
|
+
* A query's hits where it holds `^p`, Word's paragraph mark, as Word finds them (check 52 case 2; CR-014 phase
|
|
248
|
+
* 3): `pieces` is the query split at its marks. A hit starts in one paragraph with the first piece matching to
|
|
249
|
+
* its end, takes each middle piece as a whole paragraph's text, and ends with the last piece matching from the
|
|
250
|
+
* next paragraph's start; a query ending with `^p` ends with that paragraph's mark, which the hit holds. A mark
|
|
251
|
+
* matches only a paragraph's own mark the range holds: never a cell's or a row's end, and never across the edge
|
|
252
|
+
* of a table, so every paragraph of a hit is in the same cell or in none (`^p` between a list item and the first
|
|
253
|
+
* cell after it found nothing). `^p^p` matches an empty paragraph's mark after another mark. Plain queries only:
|
|
254
|
+
* Word's wildcards write the mark another way.
|
|
255
|
+
*/
|
|
256
|
+
private searchMarks;
|
|
257
|
+
/**
|
|
258
|
+
* A wildcard query's hits across the paragraphs' marks, as Word's wildcards match them (check 59; CR-002 section 32,
|
|
259
|
+
* K7): where `^p` matches one (`searchMarks`), a paragraph's own mark the range holds, never a cell's or a row's end,
|
|
260
|
+
* and never across a table's edge, so the paragraphs a hit spans are in one cell or in none. `?`, `*` and a class cross
|
|
261
|
+
* such a mark and `^13` is one; a hit ending with one holds it.
|
|
262
|
+
*/
|
|
263
|
+
private searchWildcards;
|
|
67
264
|
/**
|
|
68
265
|
* Replaces every match in this span, last first so the offsets stay valid; returns the count
|
|
69
266
|
* (CR-002 section 3.7). The replacement's `$1` or Word's `\1` expands as it does on a paragraph
|
|
@@ -72,7 +269,17 @@ export declare class Range {
|
|
|
72
269
|
replaceText(find: string, replace: string, options?: SearchOptions): number;
|
|
73
270
|
/** The tracked changes this span covers, in document order (CR-002 phase F). */
|
|
74
271
|
getTrackedChanges(): TrackedChange[];
|
|
75
|
-
|
|
272
|
+
/**
|
|
273
|
+
* A range of this one, as Office JS's `getRange` (check 52): 'Whole' is the range itself, 'Content' the same
|
|
274
|
+
* without a last mark, 'Start' and 'End' collapsed at its ends, and 'After' collapsed just after it - at the
|
|
275
|
+
* start of the next paragraph where the range holds its last paragraph's mark.
|
|
276
|
+
*/
|
|
277
|
+
getRange(location?: 'Whole' | 'Start' | 'End' | 'Content' | 'After'): Range;
|
|
278
|
+
/**
|
|
279
|
+
* A range from this range's start or `range`'s, whichever comes first, to the end that comes last (Office JS
|
|
280
|
+
* `expandTo`; which is first doesn't matter, check 52). Both must be in one story.
|
|
281
|
+
*/
|
|
282
|
+
expandTo(range: Range): Range;
|
|
76
283
|
/** The span's text as it stands (extension; Office JS getOoxml wraps it in a package). */
|
|
77
284
|
toString(): string;
|
|
78
285
|
/** The comments this span touches, replies nested under their parent. */
|
|
@@ -89,6 +296,14 @@ export declare class Range {
|
|
|
89
296
|
* span gets an empty control at its position. Returns the control.
|
|
90
297
|
*/
|
|
91
298
|
insertContentControl(kind?: ContentControlType): ContentControl;
|
|
299
|
+
/**
|
|
300
|
+
* A block content control around the paragraphs of a range across paragraphs, as Word puts one (check 54 cases
|
|
301
|
+
* 38 and 43, untracked and tracked): only a range holding its paragraphs whole, from the first's start to the
|
|
302
|
+
* last's end, its mark or not. Any other, starting or ending inside a paragraph or a table, is refused with
|
|
303
|
+
* `GeneralException`, as Word refused it (cases 36, 37 and 39 to 42). Tracked, the control is an insertion, as a
|
|
304
|
+
* paragraph's control is (check 30's markers).
|
|
305
|
+
*/
|
|
306
|
+
private wrapParagraphs;
|
|
92
307
|
/**
|
|
93
308
|
* Office JS `Range.hyperlink`: the address of the first hyperlink in this range, or a new
|
|
94
309
|
* hyperlink over it. `address#location` separates the address from an optional location within
|