reamkit 1.16.0 → 1.18.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/dist/esm/core/bidi/segments.js +1 -2
- package/dist/esm/core/converter/project.js +5 -1
- package/dist/esm/core/document-model/index.d.ts +1 -1
- package/dist/esm/core/document-model/types.d.ts +526 -8
- package/dist/esm/core/drawingml/chart-geometry.d.ts +8 -12
- package/dist/esm/core/drawingml/chart-geometry.js +58 -9
- package/dist/esm/core/drawingml/chart-parser.js +44 -5
- package/dist/esm/core/drawingml/colors.d.ts +1 -1
- package/dist/esm/core/drawingml/colors.js +27 -1
- package/dist/esm/core/drawingml/preset-geometry.js +233 -0
- package/dist/esm/core/drawingml/shape-render.d.ts +12 -0
- package/dist/esm/core/drawingml/shape-render.js +116 -3
- package/dist/esm/core/drawingml/theme-parser.d.ts +10 -0
- package/dist/esm/core/drawingml/theme-parser.js +19 -1
- package/dist/esm/core/font/measure.d.ts +5 -0
- package/dist/esm/core/font/measure.js +21 -1
- package/dist/esm/core/images.d.ts +2 -2
- package/dist/esm/core/images.js +219 -0
- package/dist/esm/core/ir/flow.d.ts +23 -1
- package/dist/esm/core/lzw.d.ts +17 -0
- package/dist/esm/core/lzw.js +83 -0
- package/dist/esm/core/metafile/emf.d.ts +16 -0
- package/dist/esm/core/metafile/emf.js +635 -0
- package/dist/esm/core/metafile/picture.d.ts +106 -0
- package/dist/esm/core/metafile/picture.js +55 -0
- package/dist/esm/core/metafile/wmf.d.ts +9 -0
- package/dist/esm/core/metafile/wmf.js +371 -0
- package/dist/esm/core/numbering/apply.d.ts +5 -3
- package/dist/esm/core/numbering/apply.js +42 -11
- package/dist/esm/core/numbering/index.js +2 -0
- package/dist/esm/core/numbering/state.d.ts +13 -1
- package/dist/esm/core/numbering/state.js +256 -15
- package/dist/esm/core/po-helpers.js +16 -1
- package/dist/esm/core/style-cascade/resolver.js +66 -11
- package/dist/esm/core/style-cascade/table.js +35 -11
- package/dist/esm/core/style-cascade/types.d.ts +42 -1
- package/dist/esm/core/style-cascade/types.js +4 -0
- package/dist/esm/core/tiff.d.ts +20 -0
- package/dist/esm/core/tiff.js +339 -0
- package/dist/esm/core/vector.d.ts +22 -0
- package/dist/esm/excel/print-model.js +4 -2
- package/dist/esm/excel/sheet-to-flow.js +10 -8
- package/dist/esm/excel/worksheet-parser.js +1 -1
- package/dist/esm/html/html-writer.js +20 -5
- package/dist/esm/layout/page-doc.d.ts +107 -4
- package/dist/esm/layout/styled-layout.d.ts +44 -2
- package/dist/esm/layout/styled-layout.js +2330 -283
- package/dist/esm/pdf/shading.js +76 -6
- package/dist/esm/pdf/styled-page-emitter.js +294 -45
- package/dist/esm/pdf/vector-graphics.d.ts +29 -2
- package/dist/esm/pdf/vector-graphics.js +96 -12
- package/dist/esm/pdf-reader/image-decode.js +7 -75
- package/dist/esm/pptx/pptx-reader.js +1 -0
- package/dist/esm/pptx/slide-parser.d.ts +21 -4
- package/dist/esm/pptx/slide-parser.js +86 -23
- package/dist/esm/svg/svg-writer.js +2 -2
- package/dist/esm/word/document-parser.d.ts +96 -7
- package/dist/esm/word/document-parser.js +540 -116
- package/dist/esm/word/docx-reader.js +135 -43
- package/dist/esm/word/docx-writer.js +6 -1
- package/dist/esm/word/drawing-parser.d.ts +58 -5
- package/dist/esm/word/drawing-parser.js +1632 -63
- package/dist/esm/word/index.d.ts +4 -4
- package/dist/esm/word/numbering-parser.d.ts +2 -1
- package/dist/esm/word/numbering-parser.js +107 -21
- package/dist/esm/word/paragraph-properties.d.ts +11 -1
- package/dist/esm/word/paragraph-properties.js +219 -10
- package/dist/esm/word/run-properties.js +45 -1
- package/dist/esm/word/settings-parser.d.ts +24 -0
- package/dist/esm/word/settings-parser.js +31 -5
- package/dist/esm/word/shading.d.ts +11 -0
- package/dist/esm/word/shading.js +64 -0
- package/dist/esm/word/styles-parser.js +8 -2
- package/dist/esm/word/table-parser.d.ts +9 -1
- package/dist/esm/word/table-parser.js +182 -30
- package/package.json +1 -1
|
@@ -29,7 +29,16 @@ export interface RunProperties {
|
|
|
29
29
|
readonly bold?: boolean;
|
|
30
30
|
readonly italic?: boolean;
|
|
31
31
|
readonly underline?: UnderlineStyle;
|
|
32
|
+
/** §17.3.2.40 `w:u @w:color` — the underline's own colour, when it has one. */
|
|
33
|
+
readonly underlineColorHex?: string;
|
|
32
34
|
readonly strike?: boolean;
|
|
35
|
+
/** §17.3.2.5 `w:caps` — the run is DISPLAYED in capitals, whatever it stores. */
|
|
36
|
+
readonly caps?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* §17.3.2.33 `w:smallCaps` — displayed in capitals, with the letters that
|
|
39
|
+
* were lower case set smaller.
|
|
40
|
+
*/
|
|
41
|
+
readonly smallCaps?: boolean;
|
|
33
42
|
readonly fontSizePt?: Pt;
|
|
34
43
|
readonly colorHex?: string;
|
|
35
44
|
readonly fontFamily?: FontFamilyMap;
|
|
@@ -44,6 +53,16 @@ export interface RunProperties {
|
|
|
44
53
|
* the tagged-PDF per-element `/Lang`; does not affect visual layout.
|
|
45
54
|
*/
|
|
46
55
|
readonly lang?: string;
|
|
56
|
+
/**
|
|
57
|
+
* §17.3.2.32 `w:rPr/w:shd` — the background painted behind the run's own
|
|
58
|
+
* glyphs, already blended from the pattern, its colour and the fill.
|
|
59
|
+
*/
|
|
60
|
+
readonly shadingColorHex?: string;
|
|
61
|
+
/**
|
|
62
|
+
* §17.3.2.35 `w:rPr/w:spacing` — extra space between the run's characters
|
|
63
|
+
* (negative tightens). Word states it in twentieths of a point.
|
|
64
|
+
*/
|
|
65
|
+
readonly letterSpacingPt?: Pt;
|
|
47
66
|
}
|
|
48
67
|
/**
|
|
49
68
|
* ECMA-376 Part 1 §17.3.1 — Paragraph Properties (`pPr`). All lengths in
|
|
@@ -55,19 +74,136 @@ export interface RunProperties {
|
|
|
55
74
|
* indent of 360 twips becomes `indentFirstLine = -18pt` — the first line ends up
|
|
56
75
|
* 360 twips to the left of `indentLeft`).
|
|
57
76
|
*/
|
|
77
|
+
/**
|
|
78
|
+
* §17.3.1.38 `w:tab` — one stop in a paragraph's tab list: where the text after
|
|
79
|
+
* a tab character goes, how it sits against that position, and what fills the
|
|
80
|
+
* gap on the way there.
|
|
81
|
+
*/
|
|
82
|
+
export interface TabStop {
|
|
83
|
+
/**
|
|
84
|
+
* Distance from the text margin, in points (`w:pos`, twips). Ignored when
|
|
85
|
+
* {@link relativeTo} names an edge — a §17.3.3.15 `w:ptab` positions against
|
|
86
|
+
* the column itself, whose width only the layout knows.
|
|
87
|
+
*/
|
|
88
|
+
readonly positionPt: Pt;
|
|
89
|
+
/**
|
|
90
|
+
* §17.3.3.15 `w:ptab` — an ABSOLUTE position tab, which goes to the middle
|
|
91
|
+
* or the far side of the text column rather than to a stated distance.
|
|
92
|
+
*/
|
|
93
|
+
readonly relativeTo?: 'center' | 'right';
|
|
94
|
+
/** §17.18.90 ST_TabJc — how the text after the tab sits against the stop. */
|
|
95
|
+
readonly alignment: 'left' | 'center' | 'right' | 'decimal';
|
|
96
|
+
/** §17.18.89 ST_TabTlc — the character drawn across the gap. */
|
|
97
|
+
readonly leader?: 'dot' | 'hyphen' | 'underscore' | 'middleDot';
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* §17.3.1.11 `w:framePr` — the paragraph is a floating TEXT FRAME: it leaves
|
|
101
|
+
* the flow, takes the box this describes, and the body text wraps around it.
|
|
102
|
+
* Consecutive paragraphs carrying the same frame are one frame together.
|
|
103
|
+
*/
|
|
104
|
+
export interface FrameProperties {
|
|
105
|
+
/** `w:w` — the frame's width. Absent ⇒ as wide as the text needs. */
|
|
106
|
+
readonly widthPt?: Pt;
|
|
107
|
+
/** `w:h` with `w:hRule` — `exact` pins the height, anything else fits the text. */
|
|
108
|
+
readonly heightPt?: Pt;
|
|
109
|
+
readonly heightRule?: 'auto' | 'exact' | 'atLeast';
|
|
110
|
+
/** `w:x`/`w:y` — the offset from whatever `hAnchor`/`vAnchor` names. */
|
|
111
|
+
readonly xPt?: Pt;
|
|
112
|
+
readonly yPt?: Pt;
|
|
113
|
+
/** `w:xAlign`/`w:yAlign` — an alignment instead of an offset. */
|
|
114
|
+
readonly xAlign?: 'left' | 'center' | 'right' | 'inside' | 'outside';
|
|
115
|
+
readonly yAlign?: 'top' | 'center' | 'bottom' | 'inside' | 'outside';
|
|
116
|
+
readonly hAnchor?: 'text' | 'margin' | 'page';
|
|
117
|
+
readonly vAnchor?: 'text' | 'margin' | 'page';
|
|
118
|
+
/** §17.18.104 ST_Wrap — how the body text runs past the frame. */
|
|
119
|
+
readonly wrap?: 'auto' | 'around' | 'none' | 'notBeside' | 'tight' | 'through';
|
|
120
|
+
readonly hSpacePt?: Pt;
|
|
121
|
+
readonly vSpacePt?: Pt;
|
|
122
|
+
}
|
|
58
123
|
export interface ParagraphProperties {
|
|
59
124
|
readonly styleId?: string;
|
|
125
|
+
/**
|
|
126
|
+
* §17.7.2 — the `w:pPr` of the TABLE STYLE the paragraph's cell is formatted
|
|
127
|
+
* by. It is not the paragraph's own formatting: the cascade puts it under the
|
|
128
|
+
* paragraph's style (docDefaults < table style < numbering < paragraph style
|
|
129
|
+
* < character style < direct), so it is carried apart from the direct
|
|
130
|
+
* properties rather than merged into them.
|
|
131
|
+
*/
|
|
132
|
+
readonly tableStyle?: ParagraphProperties;
|
|
133
|
+
/**
|
|
134
|
+
* §17.7.2 — a run layer that ranks BELOW the paragraph's own style and below
|
|
135
|
+
* the character style a run names: the `w:rPr` of the table style the cell is
|
|
136
|
+
* formatted by, or the `a:fontRef` colour a gallery-drawn shape lends the
|
|
137
|
+
* text inside it (§20.1.4.2.14). Carried on the paragraph because every run
|
|
138
|
+
* of it — and its MARK — reads the same layer.
|
|
139
|
+
*/
|
|
140
|
+
readonly inheritedRun?: RunProperties;
|
|
141
|
+
/**
|
|
142
|
+
* §17.6.17 — the paragraph's mark carries a `w:sectPr`: it is the last
|
|
143
|
+
* paragraph of its section, and the mark IS the section break. One with no
|
|
144
|
+
* content of its own therefore prints nothing, not an empty line.
|
|
145
|
+
*/
|
|
146
|
+
readonly sectionBreak?: boolean;
|
|
147
|
+
/** §17.3.1.11 — the paragraph floats as a text frame. */
|
|
148
|
+
readonly frame?: FrameProperties;
|
|
149
|
+
/**
|
|
150
|
+
* §17.3.1.41 `w:textDirection` — which way the paragraph's lines run.
|
|
151
|
+
* `btLr` reads bottom-to-top, `tbRl` top-to-bottom; `lrTb` is the default
|
|
152
|
+
* and is not recorded.
|
|
153
|
+
*/
|
|
154
|
+
readonly textDirection?: 'btLr' | 'tbRl';
|
|
155
|
+
/**
|
|
156
|
+
* §17.3.1.32 `w:snapToGrid` — whether the paragraph's lines stand on the
|
|
157
|
+
* section's document grid (§17.6.5). Absent ⇒ they do; Word's header and
|
|
158
|
+
* footer styles are what usually says otherwise.
|
|
159
|
+
*/
|
|
160
|
+
readonly snapToGrid?: boolean;
|
|
60
161
|
readonly alignment?: Alignment;
|
|
61
162
|
readonly spacingBefore?: Pt;
|
|
62
163
|
readonly spacingAfter?: Pt;
|
|
63
164
|
readonly spacingLine?: Pt;
|
|
64
165
|
readonly spacingLineRule?: 'auto' | 'exact' | 'atLeast';
|
|
166
|
+
/**
|
|
167
|
+
* ECMA-376 Part 1 §17.3.1.9 — `w:contextualSpacing`. The space before and
|
|
168
|
+
* after is dropped where the neighbour is a paragraph of the SAME style: a
|
|
169
|
+
* list is written this way, so its items sit together while the list as a
|
|
170
|
+
* whole keeps its space from the text around it.
|
|
171
|
+
*/
|
|
172
|
+
readonly contextualSpacing?: boolean;
|
|
173
|
+
/** ECMA-376 Part 1 §17.3.1.37 — the paragraph's own `w:tabs` stops. */
|
|
174
|
+
readonly tabs?: ReadonlyArray<TabStop>;
|
|
175
|
+
/**
|
|
176
|
+
* §17.3.1.24 `w:pBdr` — rules drawn around the paragraph. `w:space` is the
|
|
177
|
+
* gap each keeps from the text, carried on the {@link Border} as `spacePt`.
|
|
178
|
+
*/
|
|
179
|
+
readonly borders?: CellBorders;
|
|
180
|
+
/** §17.3.1.31 `w:pPr/w:shd` — the paragraph's own background fill. */
|
|
181
|
+
readonly shading?: CellShading;
|
|
65
182
|
readonly indentLeft?: Pt;
|
|
66
183
|
readonly indentRight?: Pt;
|
|
67
184
|
readonly indentFirstLine?: Pt;
|
|
68
185
|
/** The implicit default run properties for runs in this paragraph (`w:pPr/w:rPr`). */
|
|
69
186
|
readonly runProperties?: RunProperties;
|
|
187
|
+
/**
|
|
188
|
+
* §17.3.1.3/§17.3.1.1 — the gap `w:beforeAutospacing`/`w:afterAutospacing`
|
|
189
|
+
* asks the consumer for, already resolved to a length by the reader (it
|
|
190
|
+
* depends on the document's compatibility mode). Present only when the
|
|
191
|
+
* autospacing flag is ON, and it beats the `w:before`/`w:after` beside it.
|
|
192
|
+
* A separate property because style inheritance is per ATTRIBUTE: a style
|
|
193
|
+
* based on one that says `beforeAutospacing` inherits the flag even when it
|
|
194
|
+
* states a `w:before` of its own — which is how tdf104354_firstParaInSection
|
|
195
|
+
* gets its 75pt before, and taking that literally spread one page over four.
|
|
196
|
+
*/
|
|
197
|
+
readonly spacingBeforeAuto?: Pt;
|
|
198
|
+
readonly spacingAfterAuto?: Pt;
|
|
70
199
|
readonly numbering?: NumberingReference;
|
|
200
|
+
/**
|
|
201
|
+
* §17.9.4 — a `w:numPr` that names a LEVEL and no `w:numId`: the instance is
|
|
202
|
+
* whatever the style this one is based on refers to. Word's own Heading 2
|
|
203
|
+
* says exactly this, and dropped it numbered num-parent-style.docx's headings
|
|
204
|
+
* 1, 2, 3, 4 where its own text says they should read 1, 1.1, 2, 2.1.
|
|
205
|
+
*/
|
|
206
|
+
readonly numberingLevel?: number;
|
|
71
207
|
/**
|
|
72
208
|
* ECMA-376 Part 1 §17.3.1.21 — `w:pageBreakBefore`. When true, the paragraph
|
|
73
209
|
* starts on a fresh page even if there is room on the current one.
|
|
@@ -89,14 +225,58 @@ export interface ParagraphProperties {
|
|
|
89
225
|
* {@link Run} alongside (or instead of) `text` so layout can position the image
|
|
90
226
|
* as if it were a glyph in the line box.
|
|
91
227
|
*/
|
|
228
|
+
/**
|
|
229
|
+
* §20.1.2.2.24 `a:ln` on a `pic:spPr` (VML: `@stroked`/`v:stroke`) — the frame
|
|
230
|
+
* a picture is drawn with. Word's "Picture Border": a rule around the picture
|
|
231
|
+
* box, not part of the image itself.
|
|
232
|
+
*/
|
|
233
|
+
export interface PictureOutline {
|
|
234
|
+
readonly colorHex: string;
|
|
235
|
+
readonly widthPt: Pt;
|
|
236
|
+
}
|
|
92
237
|
export interface InlineImage {
|
|
93
238
|
/**
|
|
94
239
|
* Content-addressed bytes in the document's `ResourceStore`; absent when the
|
|
95
240
|
* source relationship did not resolve (the layout box still reserves space).
|
|
96
241
|
*/
|
|
97
242
|
readonly resource?: ResourceId;
|
|
243
|
+
/** The picture's own frame, when it has one (see {@link PictureOutline}). */
|
|
244
|
+
readonly outline?: PictureOutline;
|
|
245
|
+
/**
|
|
246
|
+
* §20.1.8.40 `a:outerShdw` — the drop shadow under the picture. Word writes
|
|
247
|
+
* one on every screenshot pasted with a style; drawn nowhere, imgshadow.docx's
|
|
248
|
+
* six stood flat on the page where both references lift them off it.
|
|
249
|
+
*/
|
|
250
|
+
readonly shadow?: ShapeShadow;
|
|
251
|
+
/**
|
|
252
|
+
* §14.1.2.10 `@gain`/`@blacklevel` — the contrast and brightness the picture
|
|
253
|
+
* is drawn through, about mid grey: `out = (in - 0.5) * gain + 0.5 + black`.
|
|
254
|
+
* Word washes a watermark out this way.
|
|
255
|
+
*/
|
|
256
|
+
readonly wash?: {
|
|
257
|
+
readonly gain: number;
|
|
258
|
+
readonly black: number;
|
|
259
|
+
};
|
|
98
260
|
readonly width: Pt;
|
|
99
261
|
readonly height: Pt;
|
|
262
|
+
/** §20.1.8.55 `a:srcRect` — the part of the source the frame shows. */
|
|
263
|
+
readonly crop?: ImageCrop;
|
|
264
|
+
/** §20.1.7.6 `a:xfrm @rot` — the picture's own rotation (1/60000°, clockwise). */
|
|
265
|
+
readonly rotation60k?: number;
|
|
266
|
+
/** §20.1.7.6 `a:xfrm @flipH/@flipV` — the picture drawn mirrored. */
|
|
267
|
+
readonly flipH?: boolean;
|
|
268
|
+
readonly flipV?: boolean;
|
|
269
|
+
/**
|
|
270
|
+
* §20.4.2.6 `wp:effectExtent` — space the drawing needs BEYOND its extent,
|
|
271
|
+
* for what a rotation or an effect throws outside the frame. The line box
|
|
272
|
+
* reserves it; the picture itself is drawn inset by it.
|
|
273
|
+
*/
|
|
274
|
+
readonly effectExtent?: {
|
|
275
|
+
readonly leftPt: Pt;
|
|
276
|
+
readonly topPt: Pt;
|
|
277
|
+
readonly rightPt: Pt;
|
|
278
|
+
readonly bottomPt: Pt;
|
|
279
|
+
};
|
|
100
280
|
}
|
|
101
281
|
/**
|
|
102
282
|
* ECMA-376 Part 1 §22 — OfficeMathML (OMML). A recursive math element tree.
|
|
@@ -263,6 +443,11 @@ export interface Run {
|
|
|
263
443
|
* paragraph's following content starts on a new page.
|
|
264
444
|
*/
|
|
265
445
|
readonly pageBreak?: boolean;
|
|
446
|
+
/**
|
|
447
|
+
* §17.3.3.1 `w:br w:type="column"` — the text after this run continues in the
|
|
448
|
+
* NEXT column of the section (or, past the last, on the next page).
|
|
449
|
+
*/
|
|
450
|
+
readonly columnBreak?: boolean;
|
|
266
451
|
}
|
|
267
452
|
/** ECMA-376 Part 1 §17.3.1 — a paragraph: its {@link ParagraphProperties} and runs. */
|
|
268
453
|
export interface Paragraph {
|
|
@@ -302,7 +487,23 @@ export interface Comment {
|
|
|
302
487
|
readonly done?: boolean;
|
|
303
488
|
}
|
|
304
489
|
/** ECMA-376 Part 1 §17.9 — `w:numFmt` list marker format. */
|
|
305
|
-
export type NumberingFormat = 'decimal' | '
|
|
490
|
+
export type NumberingFormat = 'decimal' | 'decimalZero' | 'decimalFullWidth' | 'ordinal' | 'lowerLetter' | 'upperLetter' | 'lowerRoman' | 'upperRoman'
|
|
491
|
+
/** §17.18.59 — the ten heavenly stems 甲乙丙…, then plain digits. */
|
|
492
|
+
| 'ideographTraditional'
|
|
493
|
+
/** The twelve earthly branches 子丑寅…, then plain digits. */
|
|
494
|
+
| 'ideographZodiac'
|
|
495
|
+
/** The formal (anti-fraud) numerals 壹貳參…, composed with 拾佰仟. */
|
|
496
|
+
| 'ideographLegalTraditional'
|
|
497
|
+
/** Digit-by-digit ideographs: 10 is 一零, not 十. */
|
|
498
|
+
| 'ideographDigital' | 'koreanDigital2'
|
|
499
|
+
/** Counting ideographs: 10 is 十, 11 is 十一, 21 is 二十一. */
|
|
500
|
+
| 'chineseCounting' | 'chineseCountingThousand' | 'japaneseCounting' | 'koreanCounting' | 'taiwaneseCounting' | 'taiwaneseCountingThousand'
|
|
501
|
+
/** §17.18.59 — Hebrew numerals (gematria): א, ב, … ט״ו, ט״ז, י״ז … */
|
|
502
|
+
| 'hebrew1'
|
|
503
|
+
/** The Hebrew alphabet as a plain sequence, cycling past ת. */
|
|
504
|
+
| 'hebrew2'
|
|
505
|
+
/** ①②③… up to twenty, then plain digits. */
|
|
506
|
+
| 'decimalEnclosedCircle' | 'chicago' | 'bullet' | 'none';
|
|
306
507
|
/** A paragraph's list reference (`w:numPr`): the numbering instance id + level. */
|
|
307
508
|
export interface NumberingReference {
|
|
308
509
|
readonly numId: string;
|
|
@@ -315,9 +516,28 @@ export interface NumberingLevel {
|
|
|
315
516
|
readonly format: NumberingFormat;
|
|
316
517
|
/** §17.9.11 `w:lvlText` — the marker template (e.g. `"%1."`). */
|
|
317
518
|
readonly lvlText: string;
|
|
519
|
+
/**
|
|
520
|
+
* §17.9.9 `w:lvlPicBulletId` → §17.9.21 `w:numPicBullet` — the level's bullet
|
|
521
|
+
* is a PICTURE, not a character, and the `w:lvlText` is only the fallback
|
|
522
|
+
* glyph Word writes beside it.
|
|
523
|
+
*/
|
|
524
|
+
readonly picBullet?: PictureBullet;
|
|
525
|
+
/**
|
|
526
|
+
* §17.9.10 `w:isLgl` — every level of this level's marker is printed in
|
|
527
|
+
* DECIMAL, whatever format the level it names asks for. Word calls it legal
|
|
528
|
+
* numbering: "Sect I.01" becomes "Sect 1.01".
|
|
529
|
+
*/
|
|
530
|
+
readonly isLegal?: boolean;
|
|
318
531
|
readonly paragraphProperties: ParagraphProperties;
|
|
319
532
|
readonly runProperties: RunProperties;
|
|
320
533
|
}
|
|
534
|
+
/** §17.9.21 `w:numPicBullet` — the image a level uses in place of a bullet. */
|
|
535
|
+
export interface PictureBullet {
|
|
536
|
+
/** Content-addressed bytes. A bullet whose picture does not resolve is not one. */
|
|
537
|
+
readonly resource: ResourceId;
|
|
538
|
+
readonly widthPt: Pt;
|
|
539
|
+
readonly heightPt: Pt;
|
|
540
|
+
}
|
|
321
541
|
/** §17.9.1 `w:abstractNum` — a reusable list definition keyed by level. */
|
|
322
542
|
export interface AbstractNumbering {
|
|
323
543
|
readonly id: string;
|
|
@@ -327,6 +547,18 @@ export interface AbstractNumbering {
|
|
|
327
547
|
export interface NumberingInstance {
|
|
328
548
|
readonly numId: string;
|
|
329
549
|
readonly abstractNumId: string;
|
|
550
|
+
/**
|
|
551
|
+
* §17.9.27/§17.9.28 `w:lvlOverride/w:startOverride` — where THIS instance
|
|
552
|
+
* starts a level, by `w:ilvl`, whatever the abstract definition says. Absent
|
|
553
|
+
* when the instance takes the abstract starts unchanged.
|
|
554
|
+
*/
|
|
555
|
+
readonly startOverrides?: ReadonlyMap<number, number>;
|
|
556
|
+
/**
|
|
557
|
+
* §17.9.27 `w:lvlOverride/w:lvl` — a level this instance REDEFINES whole,
|
|
558
|
+
* shadowing the abstract definition's. NumberingWOverrides.docx rewrites all
|
|
559
|
+
* nine levels of one instance this way.
|
|
560
|
+
*/
|
|
561
|
+
readonly levelOverrides?: ReadonlyMap<number, NumberingLevel>;
|
|
330
562
|
}
|
|
331
563
|
/** The parsed `word/numbering.xml`: abstract definitions + their instances. */
|
|
332
564
|
export interface Numbering {
|
|
@@ -344,6 +576,8 @@ export type StyleType = 'paragraph' | 'character' | 'table' | 'numbering';
|
|
|
344
576
|
export interface TableStyleLayer {
|
|
345
577
|
readonly borders?: CellBorders;
|
|
346
578
|
readonly cellMargins?: CellMargins;
|
|
579
|
+
/** §17.4.65 `w:tblInd` — the table indent a whole-table layer declares. */
|
|
580
|
+
readonly indentPt?: Pt;
|
|
347
581
|
readonly shading?: CellShading;
|
|
348
582
|
readonly runProperties?: RunProperties;
|
|
349
583
|
readonly paragraphProperties?: ParagraphProperties;
|
|
@@ -385,12 +619,14 @@ export interface StyleSheet {
|
|
|
385
619
|
readonly styles: ReadonlyMap<string, Style>;
|
|
386
620
|
}
|
|
387
621
|
/** §17.18.2 ST_Border — a cell-border line style (the subset Ream renders). */
|
|
388
|
-
export type BorderStyle = 'none' | 'single' | 'double' | 'thick' | 'dotted' | 'dashed' | 'dashDot' | 'dashDotDot';
|
|
622
|
+
export type BorderStyle = 'none' | 'single' | 'double' | 'thick' | 'dotted' | 'dashed' | 'dashSmallGap' | 'dashDot' | 'dashDotDot';
|
|
389
623
|
/** One border edge: its line style plus optional width and colour. */
|
|
390
624
|
export interface Border {
|
|
391
625
|
readonly style: BorderStyle;
|
|
392
626
|
readonly width?: Pt;
|
|
393
627
|
readonly colorHex?: string;
|
|
628
|
+
/** §17.3.1.24 `w:space` — how far a paragraph rule stands off its text. */
|
|
629
|
+
readonly spacePt?: Pt;
|
|
394
630
|
}
|
|
395
631
|
/** §17.4.39 `w:tcBorders` — the per-edge borders of a cell (or table). */
|
|
396
632
|
export interface CellBorders {
|
|
@@ -480,6 +716,14 @@ export type CellMerge = 'start' | 'middle' | 'end';
|
|
|
480
716
|
/** §17.4.30 `w:tcPr` — a cell's properties: span/merge, chrome, and CF overlays. */
|
|
481
717
|
export interface CellProperties {
|
|
482
718
|
readonly width?: Pt;
|
|
719
|
+
/**
|
|
720
|
+
* §17.4.72 `w:tcW w:type="pct"` — the cell's preferred width as a share of
|
|
721
|
+
* the table (`w`/5000). Held apart from {@link width} because a percentage
|
|
722
|
+
* cannot be resolved until the table's own width is known.
|
|
723
|
+
*/
|
|
724
|
+
readonly widthFraction?: number;
|
|
725
|
+
/** §17.18.90 ST_TblWidth — which of the two above the cell actually declared. */
|
|
726
|
+
readonly widthType?: 'auto' | 'dxa' | 'pct' | 'nil';
|
|
483
727
|
readonly colSpan?: number;
|
|
484
728
|
readonly merge?: CellMerge;
|
|
485
729
|
readonly borders?: CellBorders;
|
|
@@ -512,6 +756,11 @@ export interface CellProperties {
|
|
|
512
756
|
* to clip against and lets the browser decide.
|
|
513
757
|
*/
|
|
514
758
|
readonly noWrap?: boolean;
|
|
759
|
+
/**
|
|
760
|
+
* §17.4.20 `w:hideMark` — the cell's end-of-cell mark is not counted when the
|
|
761
|
+
* row's height is measured, so an EMPTY cell that says so adds nothing at all.
|
|
762
|
+
*/
|
|
763
|
+
readonly hideMark?: boolean;
|
|
515
764
|
/**
|
|
516
765
|
* The cell holds a NUMBER under a format of its own, so it may not be shown
|
|
517
766
|
* truncated: a date cut to "4/30/201" is not a shorter date, it is the wrong
|
|
@@ -534,11 +783,27 @@ export interface RowProperties {
|
|
|
534
783
|
readonly heightRule?: 'auto' | 'atLeast' | 'exact';
|
|
535
784
|
readonly cantSplit?: boolean;
|
|
536
785
|
readonly isHeader?: boolean;
|
|
786
|
+
/**
|
|
787
|
+
* §17.4.14 `w:gridBefore` — how many grid columns the row leaves empty
|
|
788
|
+
* before its first cell, which is how a row starts part-way across a table.
|
|
789
|
+
*/
|
|
790
|
+
readonly gridBefore?: number;
|
|
537
791
|
/**
|
|
538
792
|
* Force this row to begin a new page (xlsx manual `<rowBreaks>`). The renderer
|
|
539
793
|
* flushes the page before the row, then repeats any leading header rows.
|
|
540
794
|
*/
|
|
541
795
|
readonly pageBreakBefore?: boolean;
|
|
796
|
+
/**
|
|
797
|
+
* §17.4.7 `w:cnfStyle` — the conditional formats of the table style this row
|
|
798
|
+
* takes, whatever its position says. Word's calendar templates give a SECOND
|
|
799
|
+
* header row `w:firstRow="1"` so it is painted like the first.
|
|
800
|
+
*/
|
|
801
|
+
readonly conditional?: RowConditionalFormat;
|
|
802
|
+
}
|
|
803
|
+
/** §17.4.7 — the row-level conditional-format flags a `w:cnfStyle` declares. */
|
|
804
|
+
export interface RowConditionalFormat {
|
|
805
|
+
readonly firstRow?: boolean;
|
|
806
|
+
readonly lastRow?: boolean;
|
|
542
807
|
}
|
|
543
808
|
/**
|
|
544
809
|
* §17.4.62 `w:tblLook` — which of the table style's conditional formats apply.
|
|
@@ -572,6 +837,18 @@ export interface TableProperties {
|
|
|
572
837
|
* Centers or right-aligns a table narrower than the content width; absent ⇒ left.
|
|
573
838
|
*/
|
|
574
839
|
readonly alignment?: 'left' | 'center' | 'right';
|
|
840
|
+
/**
|
|
841
|
+
* §17.4.65 `w:tblInd` — how far the table's leading edge stands in from the
|
|
842
|
+
* text margin. Distinct from {@link alignment}, which shares out the slack a
|
|
843
|
+
* narrow table leaves.
|
|
844
|
+
*/
|
|
845
|
+
readonly indentPt?: Pt;
|
|
846
|
+
/**
|
|
847
|
+
* §17.4.58 `w:tblpPr` — the table FLOATS: it is placed at an anchor of its
|
|
848
|
+
* own and the text runs past it, exactly as an anchored drawing does. Read
|
|
849
|
+
* into the same {@link FloatAnchor} the drawings use.
|
|
850
|
+
*/
|
|
851
|
+
readonly float?: FloatAnchor;
|
|
575
852
|
/**
|
|
576
853
|
* A sticky-pane hint from a frozen worksheet view (E-SHEET SE3): the first
|
|
577
854
|
* `rows` rows / `cols` columns stay pinned while the rest scrolls. Consumed
|
|
@@ -606,12 +883,51 @@ export interface Table {
|
|
|
606
883
|
* ECMA-376 Part 1 §20.4.2.8 — a block-level image (`wp:inline` picture extent).
|
|
607
884
|
* EMU = English Metric Units: 914400 per inch (1 pt = 12700 EMU).
|
|
608
885
|
*/
|
|
886
|
+
/**
|
|
887
|
+
* §20.1.8.55 `a:srcRect` — how much of each edge of the source picture is cut
|
|
888
|
+
* away before it is fitted to its frame, as a fraction of the source (so 0.25
|
|
889
|
+
* on `left` drops its left quarter). Absent edges are zero.
|
|
890
|
+
*/
|
|
891
|
+
export interface ImageCrop {
|
|
892
|
+
readonly left: number;
|
|
893
|
+
readonly top: number;
|
|
894
|
+
readonly right: number;
|
|
895
|
+
readonly bottom: number;
|
|
896
|
+
}
|
|
609
897
|
export interface ImageBlock {
|
|
610
898
|
/** §20.4.2.3 — present when the drawing is anchored (floating). */
|
|
611
899
|
readonly float?: FloatAnchor;
|
|
612
900
|
readonly resource?: ResourceId;
|
|
901
|
+
/** The picture's own frame, when it has one (see {@link PictureOutline}). */
|
|
902
|
+
readonly outline?: PictureOutline;
|
|
903
|
+
/**
|
|
904
|
+
* §20.1.8.40 `a:outerShdw` — the drop shadow under the picture. Word writes
|
|
905
|
+
* one on every screenshot pasted with a style; drawn nowhere, imgshadow.docx's
|
|
906
|
+
* six stood flat on the page where both references lift them off it.
|
|
907
|
+
*/
|
|
908
|
+
readonly shadow?: ShapeShadow;
|
|
909
|
+
/**
|
|
910
|
+
* §14.1.2.10 `@gain`/`@blacklevel` — the contrast and brightness the picture
|
|
911
|
+
* is drawn through, about mid grey: `out = (in - 0.5) * gain + 0.5 + black`.
|
|
912
|
+
* Word washes a watermark out this way.
|
|
913
|
+
*/
|
|
914
|
+
readonly wash?: {
|
|
915
|
+
readonly gain: number;
|
|
916
|
+
readonly black: number;
|
|
917
|
+
};
|
|
613
918
|
readonly width: Pt;
|
|
614
919
|
readonly height: Pt;
|
|
920
|
+
/** §20.1.8.55 `a:srcRect` — the part of the source the frame shows. */
|
|
921
|
+
readonly crop?: ImageCrop;
|
|
922
|
+
/** §20.1.7.6 `a:xfrm @rot` — the picture's own rotation (1/60000°, clockwise). */
|
|
923
|
+
readonly rotation60k?: number;
|
|
924
|
+
/** §20.1.7.6 `a:xfrm @flipH/@flipV` — the picture drawn mirrored. */
|
|
925
|
+
readonly flipH?: boolean;
|
|
926
|
+
readonly flipV?: boolean;
|
|
927
|
+
/** `wp14:sizeRelH/V` — a size stated as a share of the page or margins. */
|
|
928
|
+
readonly relativeSize?: RelativeSize;
|
|
929
|
+
/** §20.4.2.6 `wp:effectExtent` — space reserved around the picture (see {@link InlineImage}). */
|
|
930
|
+
readonly effectExtent?: InlineImage['effectExtent'];
|
|
615
931
|
readonly paragraphProperties: ParagraphProperties;
|
|
616
932
|
/** `wp:docPr @descr/@title` — alternate text for the tagged-PDF Figure (`/Alt`). */
|
|
617
933
|
readonly altText?: string;
|
|
@@ -669,13 +985,30 @@ export interface ShapeGeometry {
|
|
|
669
985
|
readonly adjust?: ReadonlyMap<string, number>;
|
|
670
986
|
readonly custom?: CustomGeometry;
|
|
671
987
|
}
|
|
672
|
-
/** A shape's fill mode (`a:noFill`/`a:solidFill`/`a:gradFill`). */
|
|
673
|
-
export type ShapeFillKind = 'none' | 'solid' | 'gradient';
|
|
674
|
-
/** A shape's fill: none, a solid colour,
|
|
988
|
+
/** A shape's fill mode (`a:noFill`/`a:solidFill`/`a:gradFill`/`a:blipFill`). */
|
|
989
|
+
export type ShapeFillKind = 'none' | 'solid' | 'gradient' | 'picture';
|
|
990
|
+
/** A shape's fill: none, a solid colour, a {@link ShapeGradient}, or a picture. */
|
|
675
991
|
export interface ShapeFill {
|
|
676
992
|
readonly kind: ShapeFillKind;
|
|
677
993
|
readonly colorHex?: string;
|
|
678
994
|
readonly gradient?: ShapeGradient;
|
|
995
|
+
/**
|
|
996
|
+
* §20.1.8.14 `a:blipFill` — the picture painted across the shape's box. A
|
|
997
|
+
* DrawingML picture IS a shape with one of these, which is how a `pic:pic`
|
|
998
|
+
* inside a group reaches the page.
|
|
999
|
+
*/
|
|
1000
|
+
readonly imageResource?: ResourceId;
|
|
1001
|
+
/**
|
|
1002
|
+
* §20.1.8.30 `a:stretch/a:fillRect` (or an `a:srcRect` beside it) — the part
|
|
1003
|
+
* of the picture the box shows, as the fractions cut from each side.
|
|
1004
|
+
*/
|
|
1005
|
+
readonly imageCrop?: ImageCrop;
|
|
1006
|
+
/**
|
|
1007
|
+
* §20.1.2.3.1 `a:alpha` / §14.1.2.5 `@opacity` — how opaque the fill is,
|
|
1008
|
+
* `0..1`. Absent is opaque. The colour above is the fill's own, NOT composited
|
|
1009
|
+
* over the paper: what is behind the shape shows through it.
|
|
1010
|
+
*/
|
|
1011
|
+
readonly alpha?: number;
|
|
679
1012
|
}
|
|
680
1013
|
/** §20.1.10.49 ST_PresetLineDashVal — a shape outline's preset dash pattern. */
|
|
681
1014
|
export type ShapeDash = 'solid' | 'dot' | 'dash' | 'dashDot' | 'lgDash' | 'lgDashDot' | 'sysDash' | 'sysDot';
|
|
@@ -684,8 +1017,45 @@ export interface ShapeLine {
|
|
|
684
1017
|
readonly width?: Pt;
|
|
685
1018
|
readonly colorHex?: string;
|
|
686
1019
|
readonly dash?: ShapeDash;
|
|
1020
|
+
/**
|
|
1021
|
+
* §20.1.8.21 `a:custDash` — the author's own pattern: dash/space lengths as
|
|
1022
|
+
* MULTIPLES of the line width, in the order they are drawn.
|
|
1023
|
+
*/
|
|
1024
|
+
readonly customDash?: ReadonlyArray<number>;
|
|
687
1025
|
readonly cap?: 'flat' | 'round' | 'square';
|
|
688
1026
|
readonly fill?: 'solid' | 'none';
|
|
1027
|
+
/** §20.1.8.24 `a:headEnd` — the decoration at the line's first point. */
|
|
1028
|
+
readonly headEnd?: LineEnd;
|
|
1029
|
+
/** §20.1.8.42 `a:tailEnd` — the decoration at the line's last point. */
|
|
1030
|
+
readonly tailEnd?: LineEnd;
|
|
1031
|
+
}
|
|
1032
|
+
/**
|
|
1033
|
+
* §20.1.8.24 / §20.1.8.42 — an arrowhead (or other decoration) at one end of a
|
|
1034
|
+
* line: its shape plus the width and length steps `ST_LineEndWidth` /
|
|
1035
|
+
* `ST_LineEndLength` name.
|
|
1036
|
+
*/
|
|
1037
|
+
export interface LineEnd {
|
|
1038
|
+
readonly type: 'triangle' | 'stealth' | 'diamond' | 'oval' | 'arrow';
|
|
1039
|
+
readonly width?: 'sm' | 'med' | 'lg';
|
|
1040
|
+
readonly length?: 'sm' | 'med' | 'lg';
|
|
1041
|
+
}
|
|
1042
|
+
/**
|
|
1043
|
+
* `wp14:sizeRelH` / `wp14:sizeRelV` — the drawing's size as a PERCENTAGE of
|
|
1044
|
+
* the page or the margins rather than the extent beside it. Word 2010 writes
|
|
1045
|
+
* it in the `wp14` namespace, with the extent as the fallback for readers that
|
|
1046
|
+
* do not know it.
|
|
1047
|
+
*/
|
|
1048
|
+
export interface RelativeSize {
|
|
1049
|
+
readonly widthPct?: number;
|
|
1050
|
+
/**
|
|
1051
|
+
* §20.4.3.6 ST_SizeRelFromH — what the percentage is OF. `margin` is the text
|
|
1052
|
+
* area; the rest are the bands around it, and a drawing sized against one is
|
|
1053
|
+
* a fraction of that band alone (tdf123324 asks for 150% of the top margin).
|
|
1054
|
+
*/
|
|
1055
|
+
readonly widthFrom?: 'margin' | 'page' | 'leftMargin' | 'rightMargin';
|
|
1056
|
+
readonly heightPct?: number;
|
|
1057
|
+
/** §20.4.3.7 ST_SizeRelFromV — the vertical twin. */
|
|
1058
|
+
readonly heightFrom?: 'margin' | 'page' | 'topMargin' | 'bottomMargin';
|
|
689
1059
|
}
|
|
690
1060
|
/** §20.1.7.6 `a:xfrm` — a shape's rotation (1/60000°, clockwise) + flips. */
|
|
691
1061
|
export interface ShapeTransform {
|
|
@@ -701,6 +1071,32 @@ export interface ShapeTextBody {
|
|
|
701
1071
|
readonly insetRight?: Pt;
|
|
702
1072
|
readonly insetBottom?: Pt;
|
|
703
1073
|
readonly anchor?: 't' | 'ctr' | 'b';
|
|
1074
|
+
/**
|
|
1075
|
+
* §20.1.10.83 ST_TextVerticalType (`a:bodyPr @vert`) — text set along the
|
|
1076
|
+
* box's long axis rather than across it. `vert` reads top-to-bottom (turned a
|
|
1077
|
+
* quarter clockwise), `vert270` bottom-to-top.
|
|
1078
|
+
*/
|
|
1079
|
+
readonly vertical?: 'vert' | 'vert270';
|
|
1080
|
+
/**
|
|
1081
|
+
* §20.1.10.28 `a:spAutoFit` — the SHAPE follows its text: its height is
|
|
1082
|
+
* whatever the text needs, whatever the stated box says.
|
|
1083
|
+
*/
|
|
1084
|
+
readonly autoFit?: boolean;
|
|
1085
|
+
/**
|
|
1086
|
+
* §14.1.2.22 `v:textpath @fitshape` — the TEXT follows the shape: legacy
|
|
1087
|
+
* WordArt is set at whatever size fills the box it was drawn in.
|
|
1088
|
+
*/
|
|
1089
|
+
readonly fitToBox?: boolean;
|
|
1090
|
+
/**
|
|
1091
|
+
* `wps:txbx @id` / `wps:linkedTxbx @id @seq` — the chain of boxes this one
|
|
1092
|
+
* belongs to. Text that overruns a box continues in the next of its chain;
|
|
1093
|
+
* `seq` 0 is the box that holds the words, and the rest carry none of their
|
|
1094
|
+
* own.
|
|
1095
|
+
*/
|
|
1096
|
+
readonly chain?: {
|
|
1097
|
+
readonly id: string;
|
|
1098
|
+
readonly seq: number;
|
|
1099
|
+
};
|
|
704
1100
|
}
|
|
705
1101
|
/**
|
|
706
1102
|
* A block-level DrawingML shape (§20.1): its size, {@link ShapeGeometry}, fill,
|
|
@@ -723,15 +1119,29 @@ export interface ShapeShadow {
|
|
|
723
1119
|
/** 0..1, from the shadow colour's `a:alpha` (absent ⇒ opaque). */
|
|
724
1120
|
readonly alpha: number;
|
|
725
1121
|
}
|
|
1122
|
+
/**
|
|
1123
|
+
* §20.5.2.17 `wpg:wgp` — one member of a drawing group, and where it sits: the
|
|
1124
|
+
* offsets are from the group's own top-left corner, already mapped out of the
|
|
1125
|
+
* group's child coordinate space.
|
|
1126
|
+
*/
|
|
1127
|
+
export interface ShapeGroupChild {
|
|
1128
|
+
readonly shape: ShapeBlock;
|
|
1129
|
+
readonly xPt: Pt;
|
|
1130
|
+
readonly yPt: Pt;
|
|
1131
|
+
}
|
|
726
1132
|
export interface ShapeBlock {
|
|
727
1133
|
/** §20.4.2.3 — present when the drawing is anchored (floating). */
|
|
728
1134
|
readonly float?: FloatAnchor;
|
|
729
1135
|
readonly width: Pt;
|
|
730
1136
|
readonly height: Pt;
|
|
1137
|
+
/** §20.5.2.17 — the shapes a group holds, drawn inside its own box. */
|
|
1138
|
+
readonly children?: ReadonlyArray<ShapeGroupChild>;
|
|
731
1139
|
readonly geometry: ShapeGeometry;
|
|
732
1140
|
readonly fill: ShapeFill;
|
|
733
1141
|
readonly line?: ShapeLine;
|
|
734
1142
|
readonly transform?: ShapeTransform;
|
|
1143
|
+
/** `wp14:sizeRelH/V` — a size stated as a share of the page or margins. */
|
|
1144
|
+
readonly relativeSize?: RelativeSize;
|
|
735
1145
|
readonly text?: ShapeTextBody;
|
|
736
1146
|
/** §20.1.8.40 — the shape's drop shadow, direct or from its style reference. */
|
|
737
1147
|
readonly shadow?: ShapeShadow;
|
|
@@ -833,6 +1243,8 @@ export interface ChartLineStyle {
|
|
|
833
1243
|
readonly none?: boolean;
|
|
834
1244
|
readonly colorHex?: string;
|
|
835
1245
|
readonly widthPt?: number;
|
|
1246
|
+
/** §20.1.10.49 `a:prstDash` — the rule's dash pattern, when it names one. */
|
|
1247
|
+
readonly dash?: ShapeDash;
|
|
836
1248
|
}
|
|
837
1249
|
/** A parsed chart (§21.2): its type, title, categories, series and rendering options. */
|
|
838
1250
|
export interface Chart {
|
|
@@ -898,6 +1310,16 @@ export interface Chart {
|
|
|
898
1310
|
*/
|
|
899
1311
|
readonly frameFillHex?: string;
|
|
900
1312
|
readonly frameLineHex?: string;
|
|
1313
|
+
/** The frame rule's width and dash, when it states them. */
|
|
1314
|
+
readonly frameLineWidthPt?: number;
|
|
1315
|
+
readonly frameLineDash?: ShapeDash;
|
|
1316
|
+
/**
|
|
1317
|
+
* §21.2.2.145 `c:plotArea/c:spPr` — the plot rectangle's own fill and rule,
|
|
1318
|
+
* which sit inside the frame. Chart_Plot_BorderLine_Style.docx rules its plot
|
|
1319
|
+
* in a heavy orange dash-dot.
|
|
1320
|
+
*/
|
|
1321
|
+
readonly plotFillHex?: string;
|
|
1322
|
+
readonly plotLine?: ChartLineStyle;
|
|
901
1323
|
/**
|
|
902
1324
|
* §21.2.2.121 `c:valAx/c:numFmt@formatCode` — the number format the value
|
|
903
1325
|
* axis's tick labels and the data labels are drawn in, in the same code
|
|
@@ -952,6 +1374,11 @@ export interface PageMargins {
|
|
|
952
1374
|
readonly left: Pt;
|
|
953
1375
|
readonly header?: Pt;
|
|
954
1376
|
readonly footer?: Pt;
|
|
1377
|
+
/**
|
|
1378
|
+
* §17.6.11 `w:gutter` — the binding space, added to the left margin (or to
|
|
1379
|
+
* the top, when `w:settings/w:gutterAtTop` says so).
|
|
1380
|
+
*/
|
|
1381
|
+
readonly gutter?: Pt;
|
|
955
1382
|
}
|
|
956
1383
|
/** §17.10 — which page class a header/footer reference applies to. */
|
|
957
1384
|
export type HeaderFooterType = 'default' | 'first' | 'even';
|
|
@@ -971,6 +1398,22 @@ export interface SectionProperties {
|
|
|
971
1398
|
* of the section uses the `first` header/footer references.
|
|
972
1399
|
*/
|
|
973
1400
|
readonly titlePg?: boolean;
|
|
1401
|
+
/**
|
|
1402
|
+
* §17.6.12 `w:pgNumType w:start` — the number the section's first page is
|
|
1403
|
+
* printed with. Absent ⇒ the count carries on from the section before.
|
|
1404
|
+
*/
|
|
1405
|
+
readonly pageNumberStart?: number;
|
|
1406
|
+
/** §17.6.8 `w:lnNumType` — line numbers printed in the margin beside the text. */
|
|
1407
|
+
readonly lineNumbering?: {
|
|
1408
|
+
/** Print every `countBy`-th line (default 1). */
|
|
1409
|
+
readonly countBy: number;
|
|
1410
|
+
/** The number the count starts at (default 1). */
|
|
1411
|
+
readonly start: number;
|
|
1412
|
+
/** How far the number stands off the text (`w:distance`); absent ⇒ Word's quarter inch. */
|
|
1413
|
+
readonly distancePt?: Pt;
|
|
1414
|
+
/** §17.18.55 — where the count restarts. */
|
|
1415
|
+
readonly restart: 'newPage' | 'newSection' | 'continuous';
|
|
1416
|
+
};
|
|
974
1417
|
/**
|
|
975
1418
|
* ECMA-376 §17.15.1.36 — `w:evenAndOddHeaders` toggle in `word/settings.xml`
|
|
976
1419
|
* (document-wide, not per-section). When true even-numbered pages use the
|
|
@@ -979,6 +1422,28 @@ export interface SectionProperties {
|
|
|
979
1422
|
readonly evenAndOddHeaders?: boolean;
|
|
980
1423
|
/** §17.6.4 `w:cols` — multi-column section layout. */
|
|
981
1424
|
readonly columns?: SectionColumns;
|
|
1425
|
+
/**
|
|
1426
|
+
* §17.6.10 `w:pgBorders` — the rules drawn around the page. `offsetFrom`
|
|
1427
|
+
* says what each edge's `spacePt` is measured from: the paper's edge, or the
|
|
1428
|
+
* text margin it stands outside of.
|
|
1429
|
+
*/
|
|
1430
|
+
readonly pageBorders?: {
|
|
1431
|
+
readonly borders: CellBorders;
|
|
1432
|
+
readonly offsetFrom: 'page' | 'text';
|
|
1433
|
+
};
|
|
1434
|
+
/**
|
|
1435
|
+
* §17.6.22 `w:type` — where the section starts. `continuous` starts it on the
|
|
1436
|
+
* page already in hand rather than a fresh one; everything else (nextPage,
|
|
1437
|
+
* and the odd/even/column variants we do not distinguish) starts a page.
|
|
1438
|
+
*/
|
|
1439
|
+
readonly sectionStart?: 'continuous' | 'nextPage';
|
|
1440
|
+
/**
|
|
1441
|
+
* §17.6.5 `w:docGrid` — the line grid a `lines`/`linesAndChars` section rules
|
|
1442
|
+
* its text onto, as the pitch in points. Every line of the section's text is
|
|
1443
|
+
* as tall as a whole number of these, however tall its own font makes it.
|
|
1444
|
+
* Absent ⇒ no grid (`w:type="default"`, or none stated).
|
|
1445
|
+
*/
|
|
1446
|
+
readonly gridLinePitchPt?: Pt;
|
|
982
1447
|
}
|
|
983
1448
|
/**
|
|
984
1449
|
* §20.4.2.3 `wp:anchor` — a floating drawing's placement. v1 honours
|
|
@@ -986,16 +1451,67 @@ export interface SectionProperties {
|
|
|
986
1451
|
* modes (square/tight/through) and `topAndBottom` stay in flow as blocks.
|
|
987
1452
|
*/
|
|
988
1453
|
export interface FloatAnchor {
|
|
989
|
-
|
|
1454
|
+
/**
|
|
1455
|
+
* §20.4.2.3 / §17.18.104 — how body text runs past the drawing. `notBeside`
|
|
1456
|
+
* is the FRAME's own mode: the drawing keeps the place its anchor names, but
|
|
1457
|
+
* no text may stand beside it, so its band spans the whole column.
|
|
1458
|
+
*/
|
|
1459
|
+
readonly wrap: 'none' | 'square' | 'tight' | 'through' | 'topAndBottom' | 'notBeside';
|
|
990
1460
|
readonly behind?: boolean;
|
|
1461
|
+
/**
|
|
1462
|
+
* §20.4.2.3 `wp:anchor @relativeHeight` — the z-order among the floats on the
|
|
1463
|
+
* page: the higher number is drawn over the lower, whatever their order in
|
|
1464
|
+
* the document.
|
|
1465
|
+
*/
|
|
1466
|
+
readonly zOrder?: number;
|
|
991
1467
|
readonly posH?: {
|
|
992
|
-
|
|
1468
|
+
/**
|
|
1469
|
+
* §20.4.3.3 ST_RelFromH. `leftMargin`/`rightMargin` are the margin BANDS
|
|
1470
|
+
* beside the text area, which is where a marginal note is placed:
|
|
1471
|
+
* tdf103573.docx centres one box in each, and read as plain `margin` they
|
|
1472
|
+
* both landed in the middle of the text and printed over each other.
|
|
1473
|
+
*/
|
|
1474
|
+
readonly relativeFrom: 'margin' | 'page' | 'column' | 'leftMargin' | 'rightMargin';
|
|
993
1475
|
readonly offsetPt?: Pt;
|
|
994
1476
|
readonly align?: 'left' | 'center' | 'right';
|
|
995
1477
|
};
|
|
996
1478
|
readonly posV?: {
|
|
997
|
-
|
|
1479
|
+
/**
|
|
1480
|
+
* §20.4.3.4 ST_RelFromV. `topMargin`/`bottomMargin` measure from the top
|
|
1481
|
+
* edge of the margin BAND they name — page-content-bottom.docx hangs a
|
|
1482
|
+
* square 312pt above the bottom margin, and read as plain `margin` it went
|
|
1483
|
+
* off the top of the page.
|
|
1484
|
+
*/
|
|
1485
|
+
readonly relativeFrom: 'margin' | 'page' | 'paragraph' | 'line' | 'topMargin' | 'bottomMargin';
|
|
998
1486
|
readonly offsetPt?: Pt;
|
|
1487
|
+
/**
|
|
1488
|
+
* §20.4.3.1 `wp:align` (VML: `mso-position-vertical`) — a KEYWORD rather
|
|
1489
|
+
* than an offset, which is how Word centres a watermark in its page.
|
|
1490
|
+
*/
|
|
1491
|
+
readonly align?: 'top' | 'center' | 'bottom';
|
|
1492
|
+
};
|
|
1493
|
+
/**
|
|
1494
|
+
* §20.4.2.3 `@wrapText` on the wrap element — which side(s) of the drawing
|
|
1495
|
+
* text may stand on. `bothSides` is the default and the only value that
|
|
1496
|
+
* fills BOTH gaps; `left`/`right` name one, `largest` the wider.
|
|
1497
|
+
*/
|
|
1498
|
+
readonly wrapSide?: 'bothSides' | 'left' | 'right' | 'largest';
|
|
1499
|
+
/**
|
|
1500
|
+
* §20.4.2.3 `wp:anchor @layoutInCell` (VML `o:allowincell`) — present and
|
|
1501
|
+
* false when a drawing anchored inside a TABLE CELL is placed against the
|
|
1502
|
+
* page rather than against the cell. Absent means the default: the cell is
|
|
1503
|
+
* the frame every `relativeFrom` is measured in.
|
|
1504
|
+
*/
|
|
1505
|
+
readonly inCell?: boolean;
|
|
1506
|
+
/**
|
|
1507
|
+
* §20.4.2.3 `wp:anchor @distT/@distB/@distL/@distR` — how far the wrapped
|
|
1508
|
+
* text stands off each edge of the drawing. Absent sides are 0.
|
|
1509
|
+
*/
|
|
1510
|
+
readonly wrapDist?: {
|
|
1511
|
+
readonly topPt: Pt;
|
|
1512
|
+
readonly bottomPt: Pt;
|
|
1513
|
+
readonly leftPt: Pt;
|
|
1514
|
+
readonly rightPt: Pt;
|
|
999
1515
|
};
|
|
1000
1516
|
}
|
|
1001
1517
|
/**
|
|
@@ -1009,6 +1525,8 @@ export interface SectionColumns {
|
|
|
1009
1525
|
readonly widthPt: number;
|
|
1010
1526
|
readonly spacePt: number;
|
|
1011
1527
|
}>;
|
|
1528
|
+
/** §17.6.4 `w:sep` — a vertical rule drawn down the middle of every gutter. */
|
|
1529
|
+
readonly separator?: boolean;
|
|
1012
1530
|
}
|
|
1013
1531
|
/**
|
|
1014
1532
|
* One section descriptor for a multi-section document (ECMA-376 §17.6.17). Each
|