@docx4j/core-ts 0.1.0 → 0.1.2
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/README.md +410 -10
- package/dist/model/content/Body.d.mts +109 -4
- package/dist/model/content/Body.mjs +300 -29
- package/dist/model/content/Comment.d.mts +78 -0
- package/dist/model/content/Comment.mjs +429 -0
- package/dist/model/content/ContentControl.d.mts +173 -0
- package/dist/model/content/ContentControl.mjs +638 -0
- package/dist/model/content/Font.d.mts +48 -8
- package/dist/model/content/Font.mjs +55 -13
- package/dist/model/content/InlinePicture.d.mts +103 -0
- package/dist/model/content/InlinePicture.mjs +361 -0
- package/dist/model/content/List.d.mts +253 -0
- package/dist/model/content/List.mjs +778 -0
- package/dist/model/content/Paragraph.d.mts +213 -16
- package/dist/model/content/Paragraph.mjs +611 -57
- package/dist/model/content/Range.d.mts +48 -4
- package/dist/model/content/Range.mjs +161 -4
- package/dist/model/content/Table.d.mts +130 -0
- package/dist/model/content/Table.mjs +429 -0
- package/dist/model/content/TrackedChange.d.mts +96 -0
- package/dist/model/content/TrackedChange.mjs +352 -0
- package/dist/model/content/comments.d.mts +122 -0
- package/dist/model/content/comments.mjs +248 -0
- package/dist/model/content/index.d.mts +13 -3
- package/dist/model/content/index.mjs +15 -3
- package/dist/model/content/ooxml.d.mts +17 -0
- package/dist/model/content/ooxml.mjs +214 -0
- package/dist/model/content/styles.d.mts +21 -0
- package/dist/model/content/styles.mjs +86 -0
- package/dist/model/content/tracking.d.mts +104 -0
- package/dist/model/content/tracking.mjs +313 -0
- package/dist/model/content/tree.d.mts +56 -9
- package/dist/model/content/tree.mjs +104 -31
- package/dist/model/customxml/CustomXmlPart.d.mts +158 -0
- package/dist/model/customxml/CustomXmlPart.mjs +415 -0
- package/dist/model/customxml/CustomXmlPartCollection.d.mts +68 -0
- package/dist/model/customxml/CustomXmlPartCollection.mjs +183 -0
- package/dist/model/customxml/XmlMapping.d.mts +46 -0
- package/dist/model/customxml/XmlMapping.mjs +98 -0
- package/dist/model/customxml/bindings.d.mts +41 -0
- package/dist/model/customxml/bindings.mjs +230 -0
- package/dist/model/customxml/index.d.mts +7 -0
- package/dist/model/customxml/index.mjs +9 -0
- package/dist/model/customxml/insert.d.mts +20 -0
- package/dist/model/customxml/insert.mjs +22 -0
- package/dist/model/customxml/kinds.d.mts +103 -0
- package/dist/model/customxml/kinds.mjs +267 -0
- package/dist/model/customxml/xpath.d.mts +52 -0
- package/dist/model/customxml/xpath.mjs +205 -0
- package/dist/model/fonts/CJKToEnglish.d.mts +2 -0
- package/dist/model/fonts/CJKToEnglish.mjs +16 -0
- package/dist/model/fonts/FontFallback.d.mts +58 -0
- package/dist/model/fonts/FontFallback.mjs +219 -0
- package/dist/model/fonts/IdentityPlusMapper.d.mts +7 -0
- package/dist/model/fonts/IdentityPlusMapper.mjs +19 -0
- package/dist/model/fonts/LanguageTagToScriptMapping.d.mts +7 -0
- package/dist/model/fonts/LanguageTagToScriptMapping.mjs +67 -0
- package/dist/model/fonts/Mapper.d.mts +190 -0
- package/dist/model/fonts/Mapper.mjs +481 -0
- package/dist/model/fonts/PhysicalFont.d.mts +34 -0
- package/dist/model/fonts/PhysicalFont.mjs +62 -0
- package/dist/model/fonts/RunFontSelector.d.mts +194 -0
- package/dist/model/fonts/RunFontSelector.mjs +441 -0
- package/dist/model/fonts/ThemeFonts.d.mts +17 -0
- package/dist/model/fonts/ThemeFonts.mjs +76 -0
- package/dist/model/fonts/defaultTheme.d.mts +37 -0
- package/dist/model/fonts/defaultTheme.mjs +57 -0
- package/dist/model/fonts/families.generated.d.mts +11 -0
- package/dist/model/fonts/families.generated.mjs +17 -0
- package/dist/model/fonts/fontsInUse.d.mts +39 -0
- package/dist/model/fonts/fontsInUse.mjs +183 -0
- package/dist/model/fonts/index.d.mts +14 -0
- package/dist/model/fonts/index.mjs +29 -0
- package/dist/model/fonts/lookup.d.mts +5 -0
- package/dist/model/fonts/lookup.mjs +12 -0
- package/dist/model/fonts/registry.d.mts +31 -0
- package/dist/model/fonts/registry.mjs +103 -0
- package/dist/model/fonts/scripts.d.mts +2 -0
- package/dist/model/fonts/scripts.mjs +78 -0
- package/dist/model/fonts/substitutions.generated.d.mts +30 -0
- package/dist/model/fonts/substitutions.generated.mjs +12 -0
- package/dist/model/fonts/themes.generated.d.mts +6 -0
- package/dist/model/fonts/themes.generated.mjs +11 -0
- package/dist/model/index.d.mts +5 -0
- package/dist/model/index.mjs +13 -1
- package/dist/model/listnumbering/Emulator.d.mts +187 -0
- package/dist/model/listnumbering/Emulator.mjs +332 -0
- package/dist/model/listnumbering/definitions.d.mts +251 -0
- package/dist/model/listnumbering/definitions.mjs +571 -0
- package/dist/model/listnumbering/formats.d.mts +25 -0
- package/dist/model/listnumbering/formats.mjs +320 -0
- package/dist/model/listnumbering/index.d.mts +4 -0
- package/dist/model/listnumbering/index.mjs +15 -0
- package/dist/model/listnumbering/state.d.mts +97 -0
- package/dist/model/listnumbering/state.mjs +179 -0
- package/dist/model/properties/PropertyResolver.d.mts +216 -0
- package/dist/model/properties/PropertyResolver.mjs +524 -0
- package/dist/model/properties/catalogue.d.mts +179 -0
- package/dist/model/properties/catalogue.mjs +860 -0
- package/dist/model/properties/index.d.mts +4 -0
- package/dist/model/properties/index.mjs +9 -0
- package/dist/model/properties/log.d.mts +7 -0
- package/dist/model/properties/log.mjs +25 -0
- package/dist/model/properties/styleUtil.d.mts +112 -0
- package/dist/model/properties/styleUtil.mjs +359 -0
- package/dist/node/index.d.mts +1 -0
- package/dist/node/index.mjs +12 -0
- package/dist/office-js/document.d.mts +111 -0
- package/dist/office-js/document.mjs +267 -0
- package/dist/office-js/enums.d.mts +187 -0
- package/dist/office-js/enums.mjs +176 -0
- package/dist/office-js/errors.d.mts +29 -0
- package/dist/office-js/errors.mjs +39 -0
- package/dist/office-js/extras.d.mts +5 -0
- package/dist/office-js/extras.mjs +29 -0
- package/dist/office-js/fragment.d.mts +10 -0
- package/dist/office-js/fragment.mjs +23 -0
- package/dist/office-js/index.d.mts +183 -0
- package/dist/office-js/index.mjs +54 -0
- package/dist/office-js/proxy.d.mts +72 -0
- package/dist/office-js/proxy.mjs +279 -0
- package/dist/office-js/run.d.mts +32 -0
- package/dist/office-js/run.mjs +66 -0
- package/dist/office-js/supported.d.mts +7 -0
- package/dist/office-js/supported.generated.d.mts +1 -0
- package/dist/office-js/supported.generated.mjs +235 -0
- package/dist/office-js/supported.mjs +53 -0
- package/dist/office-js/toApiScript.d.mts +25 -0
- package/dist/office-js/toApiScript.mjs +394 -0
- package/dist/opc/ContentTypes.d.mts +11 -0
- package/dist/opc/ContentTypes.mjs +14 -0
- package/dist/opc/DirectoryPartStore.d.mts +47 -0
- package/dist/opc/DirectoryPartStore.mjs +123 -0
- package/dist/opc/exceptions.d.mts +30 -0
- package/dist/opc/exceptions.mjs +38 -0
- package/dist/opc/index.d.mts +1 -1
- package/dist/opc/index.mjs +1 -1
- package/dist/packages/OpcPackage.d.mts +19 -1
- package/dist/packages/OpcPackage.mjs +29 -0
- package/dist/packages/PresentationMLPackage.d.mts +71 -1
- package/dist/packages/PresentationMLPackage.mjs +179 -0
- package/dist/packages/SpreadsheetMLPackage.d.mts +30 -1
- package/dist/packages/SpreadsheetMLPackage.mjs +78 -0
- package/dist/packages/WordprocessingMLPackage.d.mts +124 -2
- package/dist/packages/WordprocessingMLPackage.mjs +309 -2
- package/dist/packages/index.d.mts +1 -1
- package/dist/packages/index.mjs +1 -1
- package/dist/parts/DefaultXmlPart.d.mts +18 -0
- package/dist/parts/DefaultXmlPart.mjs +34 -5
- package/dist/parts/Namespaces.d.mts +18 -0
- package/dist/parts/Namespaces.mjs +20 -0
- package/dist/parts/Part.d.mts +6 -0
- package/dist/parts/Part.mjs +13 -0
- package/dist/parts/PartRegistry.mjs +13 -1
- package/dist/parts/XmlPart.d.mts +33 -0
- package/dist/parts/XmlPart.mjs +105 -2
- package/dist/parts/pml/defaults.d.mts +6 -0
- package/dist/parts/pml/defaults.mjs +53 -0
- package/dist/parts/pml/index.d.mts +66 -3
- package/dist/parts/pml/index.mjs +206 -7
- package/dist/parts/pml/placeholders.d.mts +71 -0
- package/dist/parts/pml/placeholders.mjs +141 -0
- package/dist/parts/sml/index.d.mts +80 -1
- package/dist/parts/sml/index.mjs +154 -1
- package/dist/parts/wml/comments.d.mts +1 -0
- package/dist/parts/wml/comments.mjs +179 -0
- package/dist/parts/wml/defaultNumbering.d.mts +1 -0
- package/dist/parts/wml/defaultNumbering.mjs +216 -0
- package/dist/parts/wml/index.d.mts +121 -0
- package/dist/parts/wml/index.mjs +291 -0
- package/dist/xml/dom.mjs +1 -2
- package/package.json +25 -4
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import type * as wml from '@docx4j/generated-objects-ts/modules/org_docx4j_wml';
|
|
2
|
+
import type { ListDefinition, LevelDefinition } from '../listnumbering/definitions.mjs';
|
|
3
|
+
import type { Emulator } from '../listnumbering/Emulator.mjs';
|
|
4
|
+
import { Font } from './Font.mjs';
|
|
5
|
+
import type { Body } from './Body.mjs';
|
|
6
|
+
import type { Paragraph } from './Paragraph.mjs';
|
|
7
|
+
import type { AlignmentOrUnknown } from './Paragraph.mjs';
|
|
8
|
+
/** Office JS `Word.ListLevelType`: what a level paints in front of its paragraphs. */
|
|
9
|
+
export type ListLevelType = 'Bullet' | 'Number' | 'Picture';
|
|
10
|
+
/** Office JS `Word.ListNumbering`: the number formats `setLevelNumbering` takes. */
|
|
11
|
+
export type ListNumbering = 'None' | 'Arabic' | 'UpperRoman' | 'LowerRoman' | 'UpperLetter' | 'LowerLetter';
|
|
12
|
+
/** Office JS `Word.ListBullet`: the bullets `setLevelBullet` takes. */
|
|
13
|
+
export type ListBullet = 'Custom' | 'Solid' | 'Hollow' | 'Square' | 'Diamonds' | 'Arrow' | 'Checkmark';
|
|
14
|
+
/** What `Paragraph.startNewList()` builds (extension: Office JS's takes no options). */
|
|
15
|
+
export interface StartListOptions {
|
|
16
|
+
/** docx4j's default **bullet** set rather than its decimal set (`w:abstractNum` 0, not 1). */
|
|
17
|
+
bullet?: boolean;
|
|
18
|
+
/** The level to put this paragraph at; 0 by default. */
|
|
19
|
+
level?: number;
|
|
20
|
+
}
|
|
21
|
+
/** One paragraph's place in its list, as one walk of the story answers it (`Body.listLabels`). */
|
|
22
|
+
export interface ListLabel {
|
|
23
|
+
/** The label Word paints: the level's `w:lvlText` with the counters filled in, or the bullet. */
|
|
24
|
+
listString: string;
|
|
25
|
+
/** The `w:ilvl` the paragraph counts at, style-contributed levels included. */
|
|
26
|
+
level: number;
|
|
27
|
+
/** The `w:numId` it counts in. */
|
|
28
|
+
numId: string;
|
|
29
|
+
/** Its 0-based index among the items of this list and level since the level last restarted. */
|
|
30
|
+
siblingIndex: number;
|
|
31
|
+
/** Whether the level's `w:numFmt` is `bullet`. */
|
|
32
|
+
isBullet: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The package's numbering emulator, or undefined where the document has no lists (or nothing
|
|
36
|
+
* has read the numbering part: `await pkg.getBody()` builds the resolver, which reads it).
|
|
37
|
+
*/
|
|
38
|
+
export declare function numberingEmulatorOf(body: Body): Emulator | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Every numbered paragraph of this body's **story**, with the label and the counters, in one
|
|
41
|
+
* walk. A header or footer that has not been unmarshalled contributes nothing to the count,
|
|
42
|
+
* since it cannot be read synchronously: `await part.getBody()` on each first where a footer's
|
|
43
|
+
* numbers must continue the headers' (the story rule).
|
|
44
|
+
*/
|
|
45
|
+
export declare function listLabelsOf(body: Body): Map<wml.P, ListLabel>;
|
|
46
|
+
/**
|
|
47
|
+
* Nothing matched, as Office JS's `ItemNotFound` says it: the same `code` as the shim's
|
|
48
|
+
* `ItemNotFoundError`, so add-in code branching on `error.code` behaves the same.
|
|
49
|
+
*/
|
|
50
|
+
declare class ItemNotFound extends Error {
|
|
51
|
+
readonly code = "ItemNotFound";
|
|
52
|
+
constructor(message: string);
|
|
53
|
+
}
|
|
54
|
+
export { ItemNotFound as ListItemNotFoundError };
|
|
55
|
+
/**
|
|
56
|
+
* A subset of Office JS `Word.List` over one `w:num` and the `w:abstractNum` it names. A light
|
|
57
|
+
* view: it holds the `w:numId` and the body it was found through, and resolves both elements
|
|
58
|
+
* through the numbering part's definitions on every call.
|
|
59
|
+
*
|
|
60
|
+
* Every `setLevel*` method writes on the **abstract** definition, copying it first where
|
|
61
|
+
* another `w:num` shares it ({@link separate}), so that the change stays local to this list;
|
|
62
|
+
* each then refreshes the package's resolver, which rebuilds the numbering definitions.
|
|
63
|
+
*/
|
|
64
|
+
export declare class List {
|
|
65
|
+
/** `w:numId`, as a string (docx4j's key; {@link id} is Office JS's number). */
|
|
66
|
+
readonly numId: string;
|
|
67
|
+
/** The body this list was found through: where {@link paragraphs} looks. */
|
|
68
|
+
readonly body: Body;
|
|
69
|
+
constructor(
|
|
70
|
+
/** `w:numId`, as a string (docx4j's key; {@link id} is Office JS's number). */
|
|
71
|
+
numId: string,
|
|
72
|
+
/** The body this list was found through: where {@link paragraphs} looks. */
|
|
73
|
+
body: Body);
|
|
74
|
+
/** Office JS `list.id`: the `w:numId`. */
|
|
75
|
+
get id(): number;
|
|
76
|
+
/** The definitions this list is read from; throws where the numbering part has not been read. */
|
|
77
|
+
private get definitions();
|
|
78
|
+
/** The `w:num`'s definition (docx4j `ListNumberingDefinition`). */
|
|
79
|
+
get definition(): ListDefinition;
|
|
80
|
+
/** The `w:num` (extension: the tree). */
|
|
81
|
+
get element(): wml.Numbering.Num;
|
|
82
|
+
/** The `w:abstractNum` this list resolves to (extension: the tree). */
|
|
83
|
+
get abstractElement(): wml.Numbering.AbstractNum | undefined;
|
|
84
|
+
/** The level definition (the abstract level with this `w:num`'s override over it), or undefined. */
|
|
85
|
+
level(level: number): LevelDefinition | undefined;
|
|
86
|
+
/** Office JS `list.levelExistences`: whether each of the nine levels is defined. */
|
|
87
|
+
get levelExistences(): boolean[];
|
|
88
|
+
/** Whether the level is defined (extension; Office JS has {@link levelExistences}). */
|
|
89
|
+
levelExists(level: number): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Office JS `list.levelTypes`: `Bullet`, `Number` or `Picture` for each of the nine levels,
|
|
92
|
+
* from the level's `w:numFmt` and its `w:lvlPicBulletId`. A level that is not defined reads
|
|
93
|
+
* `Number`, as Office JS reports for a level with no format of its own.
|
|
94
|
+
*/
|
|
95
|
+
get levelTypes(): ListLevelType[];
|
|
96
|
+
/** Office JS `list.getLevelString(level)`: the level's `w:lvlText` ('%1.', '(%2)', a bullet). */
|
|
97
|
+
getLevelString(level: number): string;
|
|
98
|
+
/**
|
|
99
|
+
* Office JS `list.getLevelFont(level)`: the `Font` the level's label is drawn with, over the
|
|
100
|
+
* level's `w:rPr`.
|
|
101
|
+
*
|
|
102
|
+
* **It is a writable view**, and Office JS pairs it with `resetLevelFont`, so it
|
|
103
|
+
* {@link separate}s first: the numbering part becomes live and a shared abstract definition
|
|
104
|
+
* is copied, exactly as the `setLevel*` methods do. A read that must not cost the part its
|
|
105
|
+
* byte-for-byte round trip is `list.level(n).labelRPr` (CR-002 section 17).
|
|
106
|
+
*/
|
|
107
|
+
getLevelFont(level: number): Font;
|
|
108
|
+
/** Office JS `list.getLevelParagraphs(level)`: this body's paragraphs at that level of this list. */
|
|
109
|
+
getLevelParagraphs(level: number): Paragraph[];
|
|
110
|
+
/**
|
|
111
|
+
* Office JS `list.paragraphs`: every paragraph of this body whose effective `w:numPr` names
|
|
112
|
+
* this list, in document order (a style-contributed `w:numPr` counts).
|
|
113
|
+
*/
|
|
114
|
+
get paragraphs(): Paragraph[];
|
|
115
|
+
/**
|
|
116
|
+
* Office JS `list.insertParagraph(text, location)`: a new paragraph of this list before its
|
|
117
|
+
* first item or after its last, at that item's level.
|
|
118
|
+
*/
|
|
119
|
+
insertParagraph(text: string, location: 'Start' | 'End'): Paragraph;
|
|
120
|
+
/**
|
|
121
|
+
* Office JS `list.setLevelNumbering(level, listNumbering, formatString)`: the level's
|
|
122
|
+
* `w:numFmt` and, from `formatString`, its `w:lvlText` - each number in the array is a
|
|
123
|
+
* 0-based level whose counter goes there (`[0, '.', 1]` is `'%1.%2'`), each string a literal.
|
|
124
|
+
* Without one the level numbers itself and takes a trailing full stop (`'%<n>.'`).
|
|
125
|
+
*/
|
|
126
|
+
setLevelNumbering(level: number, listNumbering: ListNumbering, formatString?: (string | number)[]): void;
|
|
127
|
+
/**
|
|
128
|
+
* Office JS `list.setLevelBullet(level, listBullet, charCode, fontName)`: the level's
|
|
129
|
+
* `w:numFmt` becomes `bullet` and its `w:lvlText` the bullet character, with the font in the
|
|
130
|
+
* level's `w:rPr/w:rFonts`. `Custom` takes `charCode` and `fontName`; the other six are the
|
|
131
|
+
* characters and faces Word's bullet library uses.
|
|
132
|
+
*/
|
|
133
|
+
setLevelBullet(level: number, listBullet: ListBullet, charCode?: number, fontName?: string): void;
|
|
134
|
+
/**
|
|
135
|
+
* Office JS `list.setLevelIndents(level, textIndent, bulletNumberPictureIndent)`, both in
|
|
136
|
+
* points: the level's `w:ind/@w:left` is where the text sits and the label's position is the
|
|
137
|
+
* hanging indent from it (or `w:firstLine` where the label sits to the right of the text).
|
|
138
|
+
*/
|
|
139
|
+
setLevelIndents(level: number, textIndent: number, bulletNumberPictureIndent: number): void;
|
|
140
|
+
/** Office JS `list.setLevelAlignment(level, alignment)`: the level's `w:lvlJc`. */
|
|
141
|
+
setLevelAlignment(level: number, alignment: AlignmentOrUnknown): void;
|
|
142
|
+
/**
|
|
143
|
+
* Office JS `list.setLevelStartingNumber(level, startingNumber)`: the level's `w:start`. A
|
|
144
|
+
* `w:startOverride` this `w:num` carries for the level would still win the first use, so it
|
|
145
|
+
* is removed with it.
|
|
146
|
+
*/
|
|
147
|
+
setLevelStartingNumber(level: number, startingNumber: number): void;
|
|
148
|
+
/**
|
|
149
|
+
* A new `w:num` over this list's `w:abstractNum` with a `w:startOverride` on level 0, which
|
|
150
|
+
* is how Word restarts a list: the counters are shared by abstract definition, and the
|
|
151
|
+
* override is spent on the new `w:num`'s first use in a story (CR-001 section 15.2). Attach
|
|
152
|
+
* the paragraphs that are to start again to the list it returns.
|
|
153
|
+
*
|
|
154
|
+
* Extension name (Office JS has no restart verb); `Paragraph.restartList()` is the sugar.
|
|
155
|
+
*/
|
|
156
|
+
restart(): List;
|
|
157
|
+
/**
|
|
158
|
+
* Gives this list a `w:abstractNum` of its own where another `w:num` shares the one it names
|
|
159
|
+
* (CR-002 section 3.9), so that a change to its levels stays local to it. The numbering part
|
|
160
|
+
* becomes live either way; the `setLevel*` methods call it for you.
|
|
161
|
+
*/
|
|
162
|
+
separate(): void;
|
|
163
|
+
/** The numbering part's live tree; the first write promotes the tree the definitions hold. */
|
|
164
|
+
private live;
|
|
165
|
+
/**
|
|
166
|
+
* The `w:lvl` a write goes to: this list's own abstract definition's, created where the
|
|
167
|
+
* definition has no level for it. A `w:lvlOverride/w:lvl` this `w:num` carries for the level
|
|
168
|
+
* would mask the abstract one, so it goes (the `w:startOverride` beside it stays).
|
|
169
|
+
*/
|
|
170
|
+
private writableLvl;
|
|
171
|
+
/** The numbering tree changed: the resolver (and with it the definitions) is rebuilt. */
|
|
172
|
+
private written;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* A subset of Office JS `Word.ListItem` over one paragraph's place in its list. A view: the
|
|
176
|
+
* paragraph is the state.
|
|
177
|
+
*/
|
|
178
|
+
export declare class ListItem {
|
|
179
|
+
/** The paragraph this is the list item of (Office JS: `paragraph.listItem`). */
|
|
180
|
+
readonly paragraph: Paragraph;
|
|
181
|
+
constructor(
|
|
182
|
+
/** The paragraph this is the list item of (Office JS: `paragraph.listItem`). */
|
|
183
|
+
paragraph: Paragraph);
|
|
184
|
+
/** Where this paragraph's numbering resolves to; throws when it is not a list item any more. */
|
|
185
|
+
private get ref();
|
|
186
|
+
/** The list this item is in. */
|
|
187
|
+
get list(): List;
|
|
188
|
+
/**
|
|
189
|
+
* Office JS `listItem.level`: the `w:ilvl` the paragraph counts at, a style-contributed level
|
|
190
|
+
* included. Setting it writes the paragraph's own `w:numPr/w:ilvl` (with the `w:numId` beside
|
|
191
|
+
* it where the list came from the style), through the accessor that records `w:pPrChange`
|
|
192
|
+
* while the package tracks changes.
|
|
193
|
+
*/
|
|
194
|
+
get level(): number;
|
|
195
|
+
set level(value: number);
|
|
196
|
+
/**
|
|
197
|
+
* Office JS `listItem.listString`: the label Word paints in front of the paragraph.
|
|
198
|
+
*
|
|
199
|
+
* It is counted by walking the paragraph's **story** from its start in document order
|
|
200
|
+
* (CR-001 section 15.2), so it costs one walk of the story per read; `Body.listLabels()`
|
|
201
|
+
* answers for every paragraph of the story in one walk.
|
|
202
|
+
*/
|
|
203
|
+
get listString(): string;
|
|
204
|
+
/**
|
|
205
|
+
* Office JS `listItem.siblingIndex`: the 0-based index of this item among the items of the
|
|
206
|
+
* same list and level, counted from where the level last restarted. The same walk as
|
|
207
|
+
* {@link listString}.
|
|
208
|
+
*/
|
|
209
|
+
get siblingIndex(): number;
|
|
210
|
+
/**
|
|
211
|
+
* Office JS `listItem.getAncestor(parentOnly)`: the nearest preceding paragraph of this list
|
|
212
|
+
* at a shallower level - the parent when `parentOnly` is true, which throws when the nearest
|
|
213
|
+
* one is not exactly one level up. Throws `ItemNotFound` when there is no ancestor.
|
|
214
|
+
*/
|
|
215
|
+
getAncestor(parentOnly?: boolean): Paragraph;
|
|
216
|
+
/**
|
|
217
|
+
* Office JS `listItem.getDescendants(directChildrenOnly)`: the paragraphs of this list which
|
|
218
|
+
* follow this one at a deeper level, up to the next one at this level or shallower; only the
|
|
219
|
+
* ones one level down when `directChildrenOnly` is true.
|
|
220
|
+
*/
|
|
221
|
+
getDescendants(directChildrenOnly?: boolean): Paragraph[];
|
|
222
|
+
}
|
|
223
|
+
/** The effective `w:ilvl` of a paragraph, or undefined when it is not a list item. */
|
|
224
|
+
export declare function levelOf(paragraph: Paragraph): number | undefined;
|
|
225
|
+
/** Office JS `paragraph.isListItem`: docx4j's `Emulator.numRefFor` answers it. */
|
|
226
|
+
export declare function isListItem(paragraph: Paragraph): boolean;
|
|
227
|
+
/** Office JS `paragraph.listItem`; throws `ItemNotFound` when the paragraph is not one. */
|
|
228
|
+
export declare function listItemOf(paragraph: Paragraph): ListItem;
|
|
229
|
+
/** Office JS `paragraph.listItemOrNullObject`. */
|
|
230
|
+
export declare function listItemOrNullObjectOf(paragraph: Paragraph): ListItem;
|
|
231
|
+
/** Office JS `paragraph.list`; throws `ItemNotFound` when the paragraph is not a list item. */
|
|
232
|
+
export declare function listOf(paragraph: Paragraph): List;
|
|
233
|
+
/** Office JS `paragraph.listOrNullObject`. */
|
|
234
|
+
export declare function listOrNullObjectOf(paragraph: Paragraph): List;
|
|
235
|
+
/** Office JS `body.lists`: every `w:num` a paragraph of this body names, in order of first use. */
|
|
236
|
+
export declare function listsOf(body: Body): List[];
|
|
237
|
+
/** Office JS `paragraph.attachToList(listId, level)`: the paragraph's own `w:numPr`. */
|
|
238
|
+
export declare function attachToList(paragraph: Paragraph, listId: number | string, level?: number): List;
|
|
239
|
+
/**
|
|
240
|
+
* Office JS `paragraph.detachFromList()`: the paragraph's own `w:numPr` goes. Where its style
|
|
241
|
+
* still numbers it, a `w:numPr` with `w:numId` 0 takes its place, which is how Word switches an
|
|
242
|
+
* inherited list off (ECMA-376 17.9.18, and what `Emulator.resolve` reads).
|
|
243
|
+
*/
|
|
244
|
+
export declare function detachFromList(paragraph: Paragraph): void;
|
|
245
|
+
/**
|
|
246
|
+
* Office JS `paragraph.startNewList()`: a `w:abstractNum` copied from docx4j's default
|
|
247
|
+
* definitions (its `numbering.xml` resource: `w:abstractNum` 1 is Word's decimal set and 0 its
|
|
248
|
+
* bullet set), a `w:num` for it, and the paragraph attached to that list.
|
|
249
|
+
*
|
|
250
|
+
* Asynchronous where Office JS's is synchronous: the default definitions are XML which has to
|
|
251
|
+
* be unmarshalled, and a document with no numbering part gets one here (CR-002 section 17).
|
|
252
|
+
*/
|
|
253
|
+
export declare function startNewList(paragraph: Paragraph, options?: StartListOptions): Promise<List>;
|