docxmlater 0.31.0 → 1.1.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/README.md +277 -193
- package/dist/core/Document.d.ts +29 -0
- package/dist/core/Document.d.ts.map +1 -1
- package/dist/core/Document.js +123 -2
- package/dist/core/Document.js.map +1 -1
- package/dist/core/DocumentGenerator.d.ts +3 -2
- package/dist/core/DocumentGenerator.d.ts.map +1 -1
- package/dist/core/DocumentGenerator.js +264 -199
- package/dist/core/DocumentGenerator.js.map +1 -1
- package/dist/core/DocumentParser.d.ts +18 -0
- package/dist/core/DocumentParser.d.ts.map +1 -1
- package/dist/core/DocumentParser.js +1311 -26
- package/dist/core/DocumentParser.js.map +1 -1
- package/dist/elements/Field.d.ts +7 -1
- package/dist/elements/Field.d.ts.map +1 -1
- package/dist/elements/Field.js +74 -0
- package/dist/elements/Field.js.map +1 -1
- package/dist/elements/Hyperlink.d.ts +0 -1
- package/dist/elements/Hyperlink.d.ts.map +1 -1
- package/dist/elements/Hyperlink.js +0 -32
- package/dist/elements/Hyperlink.js.map +1 -1
- package/dist/elements/Image.d.ts +94 -0
- package/dist/elements/Image.d.ts.map +1 -1
- package/dist/elements/Image.js +311 -25
- package/dist/elements/Image.js.map +1 -1
- package/dist/elements/Paragraph.d.ts +109 -31
- package/dist/elements/Paragraph.d.ts.map +1 -1
- package/dist/elements/Paragraph.js +274 -0
- package/dist/elements/Paragraph.js.map +1 -1
- package/dist/elements/Run.d.ts +68 -0
- package/dist/elements/Run.d.ts.map +1 -1
- package/dist/elements/Run.js +243 -39
- package/dist/elements/Run.js.map +1 -1
- package/dist/elements/Section.d.ts +16 -0
- package/dist/elements/Section.d.ts.map +1 -1
- package/dist/elements/Section.js +61 -1
- package/dist/elements/Section.js.map +1 -1
- package/dist/elements/Shape.d.ts +86 -0
- package/dist/elements/Shape.d.ts.map +1 -0
- package/dist/elements/Shape.js +461 -0
- package/dist/elements/Shape.js.map +1 -0
- package/dist/elements/StructuredDocumentTag.d.ts +61 -0
- package/dist/elements/StructuredDocumentTag.d.ts.map +1 -1
- package/dist/elements/StructuredDocumentTag.js +235 -0
- package/dist/elements/StructuredDocumentTag.js.map +1 -1
- package/dist/elements/Table.d.ts +33 -0
- package/dist/elements/Table.d.ts.map +1 -1
- package/dist/elements/Table.js +82 -8
- package/dist/elements/Table.js.map +1 -1
- package/dist/elements/TableCell.d.ts +17 -1
- package/dist/elements/TableCell.d.ts.map +1 -1
- package/dist/elements/TableCell.js +61 -8
- package/dist/elements/TableCell.js.map +1 -1
- package/dist/elements/TableRow.d.ts +29 -0
- package/dist/elements/TableRow.d.ts.map +1 -1
- package/dist/elements/TableRow.js +106 -0
- package/dist/elements/TableRow.js.map +1 -1
- package/dist/elements/TextBox.d.ts +77 -0
- package/dist/elements/TextBox.d.ts.map +1 -0
- package/dist/elements/TextBox.js +440 -0
- package/dist/elements/TextBox.js.map +1 -0
- package/dist/formatting/Style.d.ts +100 -0
- package/dist/formatting/Style.d.ts.map +1 -1
- package/dist/formatting/Style.js +396 -1
- package/dist/formatting/Style.js.map +1 -1
- package/dist/formatting/StylesManager.d.ts +6 -0
- package/dist/formatting/StylesManager.d.ts.map +1 -1
- package/dist/formatting/StylesManager.js +50 -0
- package/dist/formatting/StylesManager.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/managers/DrawingManager.d.ts +42 -0
- package/dist/managers/DrawingManager.d.ts.map +1 -0
- package/dist/managers/DrawingManager.js +160 -0
- package/dist/managers/DrawingManager.js.map +1 -0
- package/dist/xml/XMLBuilder.d.ts +2 -0
- package/dist/xml/XMLBuilder.d.ts.map +1 -1
- package/dist/xml/XMLBuilder.js +14 -0
- package/dist/xml/XMLBuilder.js.map +1 -1
- package/dist/xml/XMLParser.d.ts.map +1 -1
- package/dist/xml/XMLParser.js +7 -1
- package/dist/xml/XMLParser.js.map +1 -1
- package/package.json +2 -2
|
@@ -4,8 +4,51 @@ import { Hyperlink } from './Hyperlink';
|
|
|
4
4
|
import { Bookmark } from './Bookmark';
|
|
5
5
|
import { Revision } from './Revision';
|
|
6
6
|
import { Comment } from './Comment';
|
|
7
|
+
import { Shape } from './Shape';
|
|
8
|
+
import { TextBox } from './TextBox';
|
|
7
9
|
import { XMLElement } from '../xml/XMLBuilder';
|
|
8
10
|
export type ParagraphAlignment = 'left' | 'center' | 'right' | 'justify' | 'both';
|
|
11
|
+
export type BorderStyle = 'single' | 'double' | 'dashed' | 'dotted' | 'thick' | 'none';
|
|
12
|
+
export type ShadingPattern = 'clear' | 'solid' | 'horzStripe' | 'vertStripe' | 'reverseDiagStripe' | 'diagStripe' | 'horzCross' | 'diagCross';
|
|
13
|
+
export type TabAlignment = 'clear' | 'left' | 'center' | 'right' | 'decimal' | 'bar' | 'num';
|
|
14
|
+
export type TabLeader = 'none' | 'dot' | 'hyphen' | 'underscore' | 'heavy' | 'middleDot';
|
|
15
|
+
export type TextDirection = 'lrTb' | 'tbRl' | 'btLr' | 'lrTbV' | 'tbRlV' | 'tbLrV';
|
|
16
|
+
export type TextAlignment = 'top' | 'center' | 'baseline' | 'bottom' | 'auto';
|
|
17
|
+
export type TextboxTightWrap = 'none' | 'allLines' | 'firstAndLastLine' | 'firstLineOnly' | 'lastLineOnly';
|
|
18
|
+
export interface ParagraphPropertiesChange {
|
|
19
|
+
author?: string;
|
|
20
|
+
date?: string;
|
|
21
|
+
id?: string;
|
|
22
|
+
previousProperties?: Partial<ParagraphFormatting>;
|
|
23
|
+
}
|
|
24
|
+
export interface FrameProperties {
|
|
25
|
+
w?: number;
|
|
26
|
+
h?: number;
|
|
27
|
+
hRule?: 'auto' | 'atLeast' | 'exact';
|
|
28
|
+
x?: number;
|
|
29
|
+
y?: number;
|
|
30
|
+
xAlign?: 'left' | 'center' | 'right' | 'inside' | 'outside';
|
|
31
|
+
yAlign?: 'top' | 'center' | 'bottom' | 'inside' | 'outside';
|
|
32
|
+
hAnchor?: 'page' | 'margin' | 'text';
|
|
33
|
+
vAnchor?: 'page' | 'margin' | 'text';
|
|
34
|
+
hSpace?: number;
|
|
35
|
+
vSpace?: number;
|
|
36
|
+
wrap?: 'around' | 'notBeside' | 'none' | 'tight';
|
|
37
|
+
dropCap?: 'none' | 'drop' | 'margin';
|
|
38
|
+
lines?: number;
|
|
39
|
+
anchorLock?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface BorderDefinition {
|
|
42
|
+
style?: BorderStyle;
|
|
43
|
+
size?: number;
|
|
44
|
+
color?: string;
|
|
45
|
+
space?: number;
|
|
46
|
+
}
|
|
47
|
+
export interface TabStop {
|
|
48
|
+
position: number;
|
|
49
|
+
val?: TabAlignment;
|
|
50
|
+
leader?: TabLeader;
|
|
51
|
+
}
|
|
9
52
|
export interface ParagraphFormatting {
|
|
10
53
|
alignment?: ParagraphAlignment;
|
|
11
54
|
indentation?: {
|
|
@@ -30,8 +73,39 @@ export interface ParagraphFormatting {
|
|
|
30
73
|
};
|
|
31
74
|
contextualSpacing?: boolean;
|
|
32
75
|
paraId?: string;
|
|
76
|
+
borders?: {
|
|
77
|
+
top?: BorderDefinition;
|
|
78
|
+
bottom?: BorderDefinition;
|
|
79
|
+
left?: BorderDefinition;
|
|
80
|
+
right?: BorderDefinition;
|
|
81
|
+
between?: BorderDefinition;
|
|
82
|
+
bar?: BorderDefinition;
|
|
83
|
+
};
|
|
84
|
+
shading?: {
|
|
85
|
+
fill?: string;
|
|
86
|
+
color?: string;
|
|
87
|
+
val?: ShadingPattern;
|
|
88
|
+
};
|
|
89
|
+
tabs?: TabStop[];
|
|
90
|
+
widowControl?: boolean;
|
|
91
|
+
outlineLevel?: number;
|
|
92
|
+
suppressLineNumbers?: boolean;
|
|
93
|
+
bidi?: boolean;
|
|
94
|
+
textDirection?: TextDirection;
|
|
95
|
+
textAlignment?: TextAlignment;
|
|
96
|
+
mirrorIndents?: boolean;
|
|
97
|
+
adjustRightInd?: boolean;
|
|
98
|
+
framePr?: FrameProperties;
|
|
99
|
+
suppressAutoHyphens?: boolean;
|
|
100
|
+
suppressOverlap?: boolean;
|
|
101
|
+
textboxTightWrap?: TextboxTightWrap;
|
|
102
|
+
divId?: number;
|
|
103
|
+
cnfStyle?: string;
|
|
104
|
+
sectPr?: any;
|
|
105
|
+
pPrChange?: ParagraphPropertiesChange;
|
|
106
|
+
paragraphMarkRunProperties?: RunFormatting;
|
|
33
107
|
}
|
|
34
|
-
type ParagraphContent = Run | Field | Hyperlink | Revision;
|
|
108
|
+
type ParagraphContent = Run | Field | Hyperlink | Revision | Shape | TextBox;
|
|
35
109
|
export declare class Paragraph {
|
|
36
110
|
private content;
|
|
37
111
|
formatting: ParagraphFormatting;
|
|
@@ -48,6 +122,8 @@ export declare class Paragraph {
|
|
|
48
122
|
addField(field: Field): this;
|
|
49
123
|
addHyperlink(hyperlink: Hyperlink): this;
|
|
50
124
|
addRevision(revision: Revision): this;
|
|
125
|
+
addShape(shape: Shape): this;
|
|
126
|
+
addTextBox(textbox: TextBox): this;
|
|
51
127
|
addBookmarkStart(bookmark: Bookmark): this;
|
|
52
128
|
addBookmarkEnd(bookmark: Bookmark): this;
|
|
53
129
|
addBookmark(bookmark: Bookmark): this;
|
|
@@ -58,6 +134,13 @@ export declare class Paragraph {
|
|
|
58
134
|
addComment(comment: Comment): this;
|
|
59
135
|
getCommentsStart(): Comment[];
|
|
60
136
|
getCommentsEnd(): Comment[];
|
|
137
|
+
addPageNumber(formatting?: RunFormatting): this;
|
|
138
|
+
addTotalPages(formatting?: RunFormatting): this;
|
|
139
|
+
addDate(format?: string, formatting?: RunFormatting): this;
|
|
140
|
+
addTime(format?: string, formatting?: RunFormatting): this;
|
|
141
|
+
addFilename(includePath?: boolean, formatting?: RunFormatting): this;
|
|
142
|
+
addAuthor(formatting?: RunFormatting): this;
|
|
143
|
+
addTitle(formatting?: RunFormatting): this;
|
|
61
144
|
addText(text: string, formatting?: RunFormatting): this;
|
|
62
145
|
setText(text: string, formatting?: RunFormatting): this;
|
|
63
146
|
getRuns(): Run[];
|
|
@@ -83,46 +166,41 @@ export declare class Paragraph {
|
|
|
83
166
|
numId: number;
|
|
84
167
|
level: number;
|
|
85
168
|
} | undefined;
|
|
169
|
+
setWidowControl(enable?: boolean): this;
|
|
170
|
+
setOutlineLevel(level: number): this;
|
|
171
|
+
setSuppressLineNumbers(suppress?: boolean): this;
|
|
172
|
+
setBidi(enable?: boolean): this;
|
|
173
|
+
setTextDirection(direction: TextDirection): this;
|
|
174
|
+
setTextAlignment(alignment: TextAlignment): this;
|
|
175
|
+
setMirrorIndents(enable?: boolean): this;
|
|
176
|
+
setAdjustRightInd(enable?: boolean): this;
|
|
177
|
+
setFrameProperties(props: FrameProperties): this;
|
|
178
|
+
setSuppressAutoHyphens(suppress?: boolean): this;
|
|
179
|
+
setSuppressOverlap(suppress?: boolean): this;
|
|
180
|
+
setTextboxTightWrap(wrap: TextboxTightWrap): this;
|
|
181
|
+
setDivId(id: number): this;
|
|
182
|
+
setConditionalFormatting(bitmask: string): this;
|
|
183
|
+
setSectionProperties(properties: any): this;
|
|
184
|
+
setParagraphPropertiesChange(change: ParagraphPropertiesChange): this;
|
|
185
|
+
setParagraphMarkFormatting(properties: RunFormatting): this;
|
|
86
186
|
toXML(): XMLElement;
|
|
87
187
|
getWordCount(): number;
|
|
88
188
|
getLength(includeSpaces?: boolean): number;
|
|
89
189
|
clone(): Paragraph;
|
|
90
190
|
setBorder(borders: {
|
|
91
|
-
top?:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
bottom?: {
|
|
98
|
-
style?: string;
|
|
99
|
-
size?: number;
|
|
100
|
-
color?: string;
|
|
101
|
-
space?: number;
|
|
102
|
-
};
|
|
103
|
-
left?: {
|
|
104
|
-
style?: string;
|
|
105
|
-
size?: number;
|
|
106
|
-
color?: string;
|
|
107
|
-
space?: number;
|
|
108
|
-
};
|
|
109
|
-
right?: {
|
|
110
|
-
style?: string;
|
|
111
|
-
size?: number;
|
|
112
|
-
color?: string;
|
|
113
|
-
space?: number;
|
|
114
|
-
};
|
|
191
|
+
top?: BorderDefinition;
|
|
192
|
+
bottom?: BorderDefinition;
|
|
193
|
+
left?: BorderDefinition;
|
|
194
|
+
right?: BorderDefinition;
|
|
195
|
+
between?: BorderDefinition;
|
|
196
|
+
bar?: BorderDefinition;
|
|
115
197
|
}): this;
|
|
116
198
|
setShading(shading: {
|
|
117
199
|
fill?: string;
|
|
118
200
|
color?: string;
|
|
119
|
-
val?:
|
|
201
|
+
val?: ShadingPattern;
|
|
120
202
|
}): this;
|
|
121
|
-
setTabs(tabs:
|
|
122
|
-
position: number;
|
|
123
|
-
val?: 'clear' | 'left' | 'center' | 'right' | 'decimal' | 'bar' | 'num';
|
|
124
|
-
leader?: 'none' | 'dot' | 'hyphen' | 'underscore' | 'heavy' | 'middleDot';
|
|
125
|
-
}>): this;
|
|
203
|
+
setTabs(tabs: TabStop[]): this;
|
|
126
204
|
insertRunAt(index: number, run: Run): this;
|
|
127
205
|
removeRunAt(index: number): boolean;
|
|
128
206
|
replaceRunAt(index: number, run: Run): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Paragraph.d.ts","sourceRoot":"","sources":["../../src/elements/Paragraph.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAc,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAK3D,MAAM,MAAM,kBAAkB,GAAG,M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CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,GAAG,CAAC,EAAE,cAAc,CAAC;KACtB,GAAG,IAAI;IAuBR,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAsB9B,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,IAAI;IAiB1C,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAsBnC,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO;IAsB9C,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,MAAM,EAAE;IA0C5F,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,MAAM;IAsD9G,SAAS,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IA8CrC,wBAAwB,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI;IAgErD,4BAA4B,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI;CAYhF"}
|
|
@@ -5,6 +5,8 @@ const Run_1 = require("./Run");
|
|
|
5
5
|
const Field_1 = require("./Field");
|
|
6
6
|
const Hyperlink_1 = require("./Hyperlink");
|
|
7
7
|
const Revision_1 = require("./Revision");
|
|
8
|
+
const Shape_1 = require("./Shape");
|
|
9
|
+
const TextBox_1 = require("./TextBox");
|
|
8
10
|
const XMLBuilder_1 = require("../xml/XMLBuilder");
|
|
9
11
|
class Paragraph {
|
|
10
12
|
content = [];
|
|
@@ -55,6 +57,14 @@ class Paragraph {
|
|
|
55
57
|
this.content.push(revision);
|
|
56
58
|
return this;
|
|
57
59
|
}
|
|
60
|
+
addShape(shape) {
|
|
61
|
+
this.content.push(shape);
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
64
|
+
addTextBox(textbox) {
|
|
65
|
+
this.content.push(textbox);
|
|
66
|
+
return this;
|
|
67
|
+
}
|
|
58
68
|
addBookmarkStart(bookmark) {
|
|
59
69
|
this.bookmarksStart.push(bookmark);
|
|
60
70
|
return this;
|
|
@@ -93,6 +103,27 @@ class Paragraph {
|
|
|
93
103
|
getCommentsEnd() {
|
|
94
104
|
return [...this.commentsEnd];
|
|
95
105
|
}
|
|
106
|
+
addPageNumber(formatting) {
|
|
107
|
+
return this.addField(Field_1.Field.createPageNumber(formatting));
|
|
108
|
+
}
|
|
109
|
+
addTotalPages(formatting) {
|
|
110
|
+
return this.addField(Field_1.Field.createTotalPages(formatting));
|
|
111
|
+
}
|
|
112
|
+
addDate(format, formatting) {
|
|
113
|
+
return this.addField(Field_1.Field.createDate(format, formatting));
|
|
114
|
+
}
|
|
115
|
+
addTime(format, formatting) {
|
|
116
|
+
return this.addField(Field_1.Field.createTime(format, formatting));
|
|
117
|
+
}
|
|
118
|
+
addFilename(includePath = false, formatting) {
|
|
119
|
+
return this.addField(Field_1.Field.createFilename(includePath, formatting));
|
|
120
|
+
}
|
|
121
|
+
addAuthor(formatting) {
|
|
122
|
+
return this.addField(Field_1.Field.createAuthor(formatting));
|
|
123
|
+
}
|
|
124
|
+
addTitle(formatting) {
|
|
125
|
+
return this.addField(Field_1.Field.createTitle(formatting));
|
|
126
|
+
}
|
|
96
127
|
addText(text, formatting) {
|
|
97
128
|
this.content.push(new Run_1.Run(text, formatting));
|
|
98
129
|
return this;
|
|
@@ -209,11 +240,88 @@ class Paragraph {
|
|
|
209
240
|
getNumbering() {
|
|
210
241
|
return this.formatting.numbering ? { ...this.formatting.numbering } : undefined;
|
|
211
242
|
}
|
|
243
|
+
setWidowControl(enable = true) {
|
|
244
|
+
this.formatting.widowControl = enable;
|
|
245
|
+
return this;
|
|
246
|
+
}
|
|
247
|
+
setOutlineLevel(level) {
|
|
248
|
+
if (level < 0 || level > 9) {
|
|
249
|
+
throw new Error('Outline level must be between 0 and 9');
|
|
250
|
+
}
|
|
251
|
+
this.formatting.outlineLevel = level;
|
|
252
|
+
return this;
|
|
253
|
+
}
|
|
254
|
+
setSuppressLineNumbers(suppress = true) {
|
|
255
|
+
this.formatting.suppressLineNumbers = suppress;
|
|
256
|
+
return this;
|
|
257
|
+
}
|
|
258
|
+
setBidi(enable = true) {
|
|
259
|
+
this.formatting.bidi = enable;
|
|
260
|
+
return this;
|
|
261
|
+
}
|
|
262
|
+
setTextDirection(direction) {
|
|
263
|
+
this.formatting.textDirection = direction;
|
|
264
|
+
return this;
|
|
265
|
+
}
|
|
266
|
+
setTextAlignment(alignment) {
|
|
267
|
+
this.formatting.textAlignment = alignment;
|
|
268
|
+
return this;
|
|
269
|
+
}
|
|
270
|
+
setMirrorIndents(enable = true) {
|
|
271
|
+
this.formatting.mirrorIndents = enable;
|
|
272
|
+
return this;
|
|
273
|
+
}
|
|
274
|
+
setAdjustRightInd(enable = true) {
|
|
275
|
+
this.formatting.adjustRightInd = enable;
|
|
276
|
+
return this;
|
|
277
|
+
}
|
|
278
|
+
setFrameProperties(props) {
|
|
279
|
+
this.formatting.framePr = props;
|
|
280
|
+
return this;
|
|
281
|
+
}
|
|
282
|
+
setSuppressAutoHyphens(suppress = true) {
|
|
283
|
+
this.formatting.suppressAutoHyphens = suppress;
|
|
284
|
+
return this;
|
|
285
|
+
}
|
|
286
|
+
setSuppressOverlap(suppress = true) {
|
|
287
|
+
this.formatting.suppressOverlap = suppress;
|
|
288
|
+
return this;
|
|
289
|
+
}
|
|
290
|
+
setTextboxTightWrap(wrap) {
|
|
291
|
+
this.formatting.textboxTightWrap = wrap;
|
|
292
|
+
return this;
|
|
293
|
+
}
|
|
294
|
+
setDivId(id) {
|
|
295
|
+
this.formatting.divId = id;
|
|
296
|
+
return this;
|
|
297
|
+
}
|
|
298
|
+
setConditionalFormatting(bitmask) {
|
|
299
|
+
this.formatting.cnfStyle = bitmask;
|
|
300
|
+
return this;
|
|
301
|
+
}
|
|
302
|
+
setSectionProperties(properties) {
|
|
303
|
+
this.formatting.sectPr = properties;
|
|
304
|
+
return this;
|
|
305
|
+
}
|
|
306
|
+
setParagraphPropertiesChange(change) {
|
|
307
|
+
this.formatting.pPrChange = change;
|
|
308
|
+
return this;
|
|
309
|
+
}
|
|
310
|
+
setParagraphMarkFormatting(properties) {
|
|
311
|
+
this.formatting.paragraphMarkRunProperties = properties;
|
|
312
|
+
return this;
|
|
313
|
+
}
|
|
212
314
|
toXML() {
|
|
213
315
|
const pPrChildren = [];
|
|
214
316
|
if (this.formatting.style) {
|
|
215
317
|
pPrChildren.push(XMLBuilder_1.XMLBuilder.wSelf('pStyle', { 'w:val': this.formatting.style }));
|
|
216
318
|
}
|
|
319
|
+
if (this.formatting.paragraphMarkRunProperties) {
|
|
320
|
+
const rPr = Run_1.Run.generateRunPropertiesXML(this.formatting.paragraphMarkRunProperties);
|
|
321
|
+
if (rPr) {
|
|
322
|
+
pPrChildren.push(rPr);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
217
325
|
if (this.formatting.keepNext) {
|
|
218
326
|
pPrChildren.push(XMLBuilder_1.XMLBuilder.wSelf('keepNext'));
|
|
219
327
|
}
|
|
@@ -223,6 +331,9 @@ class Paragraph {
|
|
|
223
331
|
if (this.formatting.pageBreakBefore) {
|
|
224
332
|
pPrChildren.push(XMLBuilder_1.XMLBuilder.wSelf('pageBreakBefore'));
|
|
225
333
|
}
|
|
334
|
+
if (this.formatting.widowControl !== undefined) {
|
|
335
|
+
pPrChildren.push(XMLBuilder_1.XMLBuilder.wSelf('widowControl', { 'w:val': this.formatting.widowControl ? '1' : '0' }));
|
|
336
|
+
}
|
|
226
337
|
if (this.formatting.numbering) {
|
|
227
338
|
const numPr = XMLBuilder_1.XMLBuilder.w('numPr', undefined, [
|
|
228
339
|
XMLBuilder_1.XMLBuilder.wSelf('ilvl', { 'w:val': this.formatting.numbering.level.toString() }),
|
|
@@ -230,6 +341,12 @@ class Paragraph {
|
|
|
230
341
|
]);
|
|
231
342
|
pPrChildren.push(numPr);
|
|
232
343
|
}
|
|
344
|
+
if (this.formatting.suppressLineNumbers) {
|
|
345
|
+
pPrChildren.push(XMLBuilder_1.XMLBuilder.wSelf('suppressLineNumbers'));
|
|
346
|
+
}
|
|
347
|
+
if (this.formatting.suppressAutoHyphens) {
|
|
348
|
+
pPrChildren.push(XMLBuilder_1.XMLBuilder.wSelf('suppressAutoHyphens'));
|
|
349
|
+
}
|
|
233
350
|
if (this.formatting.spacing) {
|
|
234
351
|
const spc = this.formatting.spacing;
|
|
235
352
|
const attributes = {};
|
|
@@ -263,10 +380,161 @@ class Paragraph {
|
|
|
263
380
|
pPrChildren.push(XMLBuilder_1.XMLBuilder.wSelf('ind', attributes));
|
|
264
381
|
}
|
|
265
382
|
}
|
|
383
|
+
if (this.formatting.mirrorIndents) {
|
|
384
|
+
pPrChildren.push(XMLBuilder_1.XMLBuilder.wSelf('mirrorIndents'));
|
|
385
|
+
}
|
|
386
|
+
if (this.formatting.borders) {
|
|
387
|
+
const borderChildren = [];
|
|
388
|
+
const borders = this.formatting.borders;
|
|
389
|
+
const createBorder = (borderType, border) => {
|
|
390
|
+
if (!border)
|
|
391
|
+
return null;
|
|
392
|
+
const attributes = {};
|
|
393
|
+
if (border.style)
|
|
394
|
+
attributes['w:val'] = border.style;
|
|
395
|
+
if (border.size !== undefined)
|
|
396
|
+
attributes['w:sz'] = border.size;
|
|
397
|
+
if (border.color)
|
|
398
|
+
attributes['w:color'] = border.color;
|
|
399
|
+
if (border.space !== undefined)
|
|
400
|
+
attributes['w:space'] = border.space;
|
|
401
|
+
if (Object.keys(attributes).length > 0) {
|
|
402
|
+
return XMLBuilder_1.XMLBuilder.wSelf(borderType, attributes);
|
|
403
|
+
}
|
|
404
|
+
return null;
|
|
405
|
+
};
|
|
406
|
+
const topBorder = createBorder('top', borders.top);
|
|
407
|
+
if (topBorder)
|
|
408
|
+
borderChildren.push(topBorder);
|
|
409
|
+
const leftBorder = createBorder('left', borders.left);
|
|
410
|
+
if (leftBorder)
|
|
411
|
+
borderChildren.push(leftBorder);
|
|
412
|
+
const bottomBorder = createBorder('bottom', borders.bottom);
|
|
413
|
+
if (bottomBorder)
|
|
414
|
+
borderChildren.push(bottomBorder);
|
|
415
|
+
const rightBorder = createBorder('right', borders.right);
|
|
416
|
+
if (rightBorder)
|
|
417
|
+
borderChildren.push(rightBorder);
|
|
418
|
+
const betweenBorder = createBorder('between', borders.between);
|
|
419
|
+
if (betweenBorder)
|
|
420
|
+
borderChildren.push(betweenBorder);
|
|
421
|
+
const barBorder = createBorder('bar', borders.bar);
|
|
422
|
+
if (barBorder)
|
|
423
|
+
borderChildren.push(barBorder);
|
|
424
|
+
if (borderChildren.length > 0) {
|
|
425
|
+
pPrChildren.push(XMLBuilder_1.XMLBuilder.w('pBdr', undefined, borderChildren));
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
if (this.formatting.shading) {
|
|
429
|
+
const shd = this.formatting.shading;
|
|
430
|
+
const attributes = {};
|
|
431
|
+
if (shd.fill)
|
|
432
|
+
attributes['w:fill'] = shd.fill;
|
|
433
|
+
if (shd.color)
|
|
434
|
+
attributes['w:color'] = shd.color;
|
|
435
|
+
if (shd.val)
|
|
436
|
+
attributes['w:val'] = shd.val;
|
|
437
|
+
if (Object.keys(attributes).length > 0) {
|
|
438
|
+
pPrChildren.push(XMLBuilder_1.XMLBuilder.wSelf('shd', attributes));
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
if (this.formatting.tabs && this.formatting.tabs.length > 0) {
|
|
442
|
+
const tabChildren = [];
|
|
443
|
+
for (const tab of this.formatting.tabs) {
|
|
444
|
+
const attributes = {};
|
|
445
|
+
attributes['w:pos'] = tab.position;
|
|
446
|
+
if (tab.val)
|
|
447
|
+
attributes['w:val'] = tab.val;
|
|
448
|
+
if (tab.leader)
|
|
449
|
+
attributes['w:leader'] = tab.leader;
|
|
450
|
+
tabChildren.push(XMLBuilder_1.XMLBuilder.wSelf('tab', attributes));
|
|
451
|
+
}
|
|
452
|
+
if (tabChildren.length > 0) {
|
|
453
|
+
pPrChildren.push(XMLBuilder_1.XMLBuilder.w('tabs', undefined, tabChildren));
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
if (this.formatting.framePr) {
|
|
457
|
+
const attrs = {};
|
|
458
|
+
const f = this.formatting.framePr;
|
|
459
|
+
if (f.w !== undefined)
|
|
460
|
+
attrs['w:w'] = f.w.toString();
|
|
461
|
+
if (f.h !== undefined)
|
|
462
|
+
attrs['w:h'] = f.h.toString();
|
|
463
|
+
if (f.hRule)
|
|
464
|
+
attrs['w:hRule'] = f.hRule;
|
|
465
|
+
if (f.x !== undefined)
|
|
466
|
+
attrs['w:x'] = f.x.toString();
|
|
467
|
+
if (f.y !== undefined)
|
|
468
|
+
attrs['w:y'] = f.y.toString();
|
|
469
|
+
if (f.xAlign)
|
|
470
|
+
attrs['w:xAlign'] = f.xAlign;
|
|
471
|
+
if (f.yAlign)
|
|
472
|
+
attrs['w:yAlign'] = f.yAlign;
|
|
473
|
+
if (f.hAnchor)
|
|
474
|
+
attrs['w:hAnchor'] = f.hAnchor;
|
|
475
|
+
if (f.vAnchor)
|
|
476
|
+
attrs['w:vAnchor'] = f.vAnchor;
|
|
477
|
+
if (f.hSpace !== undefined)
|
|
478
|
+
attrs['w:hSpace'] = f.hSpace.toString();
|
|
479
|
+
if (f.vSpace !== undefined)
|
|
480
|
+
attrs['w:vSpace'] = f.vSpace.toString();
|
|
481
|
+
if (f.wrap)
|
|
482
|
+
attrs['w:wrap'] = f.wrap;
|
|
483
|
+
if (f.dropCap)
|
|
484
|
+
attrs['w:dropCap'] = f.dropCap;
|
|
485
|
+
if (f.lines !== undefined)
|
|
486
|
+
attrs['w:lines'] = f.lines.toString();
|
|
487
|
+
if (f.anchorLock !== undefined)
|
|
488
|
+
attrs['w:anchorLock'] = f.anchorLock ? '1' : '0';
|
|
489
|
+
if (Object.keys(attrs).length > 0) {
|
|
490
|
+
pPrChildren.push(XMLBuilder_1.XMLBuilder.wSelf('framePr', attrs));
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
if (this.formatting.suppressOverlap) {
|
|
494
|
+
pPrChildren.push(XMLBuilder_1.XMLBuilder.wSelf('suppressOverlap'));
|
|
495
|
+
}
|
|
496
|
+
if (this.formatting.bidi !== undefined) {
|
|
497
|
+
pPrChildren.push(XMLBuilder_1.XMLBuilder.wSelf('bidi', { 'w:val': this.formatting.bidi ? '1' : '0' }));
|
|
498
|
+
}
|
|
499
|
+
if (this.formatting.adjustRightInd !== undefined) {
|
|
500
|
+
pPrChildren.push(XMLBuilder_1.XMLBuilder.wSelf('adjustRightInd', { 'w:val': this.formatting.adjustRightInd ? '1' : '0' }));
|
|
501
|
+
}
|
|
502
|
+
if (this.formatting.textboxTightWrap) {
|
|
503
|
+
pPrChildren.push(XMLBuilder_1.XMLBuilder.wSelf('textboxTightWrap', { 'w:val': this.formatting.textboxTightWrap }));
|
|
504
|
+
}
|
|
266
505
|
if (this.formatting.alignment) {
|
|
267
506
|
const alignmentValue = this.formatting.alignment === 'justify' ? 'both' : this.formatting.alignment;
|
|
268
507
|
pPrChildren.push(XMLBuilder_1.XMLBuilder.wSelf('jc', { 'w:val': alignmentValue }));
|
|
269
508
|
}
|
|
509
|
+
if (this.formatting.textAlignment) {
|
|
510
|
+
pPrChildren.push(XMLBuilder_1.XMLBuilder.wSelf('textAlignment', { 'w:val': this.formatting.textAlignment }));
|
|
511
|
+
}
|
|
512
|
+
if (this.formatting.textDirection) {
|
|
513
|
+
pPrChildren.push(XMLBuilder_1.XMLBuilder.wSelf('textDirection', { 'w:val': this.formatting.textDirection }));
|
|
514
|
+
}
|
|
515
|
+
if (this.formatting.outlineLevel !== undefined) {
|
|
516
|
+
pPrChildren.push(XMLBuilder_1.XMLBuilder.wSelf('outlineLvl', { 'w:val': this.formatting.outlineLevel.toString() }));
|
|
517
|
+
}
|
|
518
|
+
if (this.formatting.divId !== undefined) {
|
|
519
|
+
pPrChildren.push(XMLBuilder_1.XMLBuilder.wSelf('divId', { 'w:val': this.formatting.divId.toString() }));
|
|
520
|
+
}
|
|
521
|
+
if (this.formatting.cnfStyle) {
|
|
522
|
+
pPrChildren.push(XMLBuilder_1.XMLBuilder.wSelf('cnfStyle', { 'w:val': this.formatting.cnfStyle }));
|
|
523
|
+
}
|
|
524
|
+
if (this.formatting.pPrChange) {
|
|
525
|
+
const change = this.formatting.pPrChange;
|
|
526
|
+
const attrs = {};
|
|
527
|
+
if (change.author)
|
|
528
|
+
attrs['w:author'] = change.author;
|
|
529
|
+
if (change.date)
|
|
530
|
+
attrs['w:date'] = change.date;
|
|
531
|
+
if (change.id)
|
|
532
|
+
attrs['w:id'] = change.id;
|
|
533
|
+
pPrChildren.push(XMLBuilder_1.XMLBuilder.wSelf('pPrChange', attrs));
|
|
534
|
+
}
|
|
535
|
+
if (this.formatting.sectPr) {
|
|
536
|
+
pPrChildren.push(XMLBuilder_1.XMLBuilder.wSelf('sectPr', this.formatting.sectPr));
|
|
537
|
+
}
|
|
270
538
|
const paragraphChildren = [];
|
|
271
539
|
if (pPrChildren.length > 0) {
|
|
272
540
|
paragraphChildren.push(XMLBuilder_1.XMLBuilder.w('pPr', undefined, pPrChildren));
|
|
@@ -287,6 +555,12 @@ class Paragraph {
|
|
|
287
555
|
else if (item instanceof Revision_1.Revision) {
|
|
288
556
|
paragraphChildren.push(item.toXML());
|
|
289
557
|
}
|
|
558
|
+
else if (item instanceof Shape_1.Shape) {
|
|
559
|
+
paragraphChildren.push(XMLBuilder_1.XMLBuilder.w('r', undefined, [item.toXML()]));
|
|
560
|
+
}
|
|
561
|
+
else if (item instanceof TextBox_1.TextBox) {
|
|
562
|
+
paragraphChildren.push(XMLBuilder_1.XMLBuilder.w('r', undefined, [item.toXML()]));
|
|
563
|
+
}
|
|
290
564
|
else {
|
|
291
565
|
paragraphChildren.push(item.toXML());
|
|
292
566
|
}
|