@syncfusion/ej2-docx-renderer 0.0.0-stage → 35.2.15
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 +2 -2
- package/base.d.ts +4 -0
- package/base.js +4 -0
- package/dist/ej2-docx-renderer.umd.min.js +2 -0
- package/dist/ej2-docx-renderer.umd.min.js.map +1 -0
- package/dist/es6/ej2-docx-renderer.es2015.js +52432 -0
- package/dist/es6/ej2-docx-renderer.es2015.js.map +1 -0
- package/dist/es6/ej2-docx-renderer.es5.js +54425 -0
- package/dist/es6/ej2-docx-renderer.es5.js.map +1 -0
- package/dist/global/ej2-docx-renderer.min.js +2 -0
- package/dist/global/ej2-docx-renderer.min.js.map +1 -0
- package/dist/global/index.d.ts +5 -0
- package/format.d.ts +4 -0
- package/format.js +4 -0
- package/helper.d.ts +4 -0
- package/helper.js +4 -0
- package/index.d.ts +4 -0
- package/index.js +4 -0
- package/license +10 -0
- package/list.d.ts +4 -0
- package/list.js +4 -0
- package/package.json +26 -4
- package/parser.d.ts +4 -0
- package/parser.js +4 -0
- package/src/base/constants.d.ts +2 -0
- package/src/base/constants.js +2 -0
- package/src/base/dictionary.d.ts +52 -0
- package/src/base/dictionary.js +137 -0
- package/src/base/index.d.ts +9 -0
- package/src/base/index.js +9 -0
- package/src/base/keywords.d.ts +422 -0
- package/src/base/keywords.js +422 -0
- package/src/base/types.d.ts +2590 -0
- package/src/base/types.js +1056 -0
- package/src/base/unique-format.d.ts +87 -0
- package/src/base/unique-format.js +858 -0
- package/src/base/unique-formats.d.ts +32 -0
- package/src/base/unique-formats.js +87 -0
- package/src/document-canvas.d.ts +61 -0
- package/src/document-canvas.js +221 -0
- package/src/docx-renderer.d.ts +941 -0
- package/src/docx-renderer.js +2251 -0
- package/src/format/border.d.ts +53 -0
- package/src/format/border.js +600 -0
- package/src/format/borders.d.ts +44 -0
- package/src/format/borders.js +314 -0
- package/src/format/cell-format.d.ts +42 -0
- package/src/format/cell-format.js +309 -0
- package/src/format/character-format.d.ts +152 -0
- package/src/format/character-format.js +1224 -0
- package/src/format/index.d.ts +14 -0
- package/src/format/index.js +14 -0
- package/src/format/list-format.d.ts +32 -0
- package/src/format/list-format.js +238 -0
- package/src/format/paragraph-format.d.ts +103 -0
- package/src/format/paragraph-format.js +854 -0
- package/src/format/row-format.d.ts +119 -0
- package/src/format/row-format.js +545 -0
- package/src/format/section-format.d.ts +89 -0
- package/src/format/section-format.js +689 -0
- package/src/format/shading.d.ts +24 -0
- package/src/format/shading.js +137 -0
- package/src/format/style.d.ts +106 -0
- package/src/format/style.js +286 -0
- package/src/format/table-format.d.ts +51 -0
- package/src/format/table-format.js +395 -0
- package/src/global.js +1 -0
- package/src/helper/document-editor-helper.d.ts +515 -0
- package/src/helper/document-editor-helper.js +1302 -0
- package/src/helper/document-editor-settings.d.ts +293 -0
- package/src/helper/document-editor-settings.js +94 -0
- package/src/helper/index.d.ts +5 -0
- package/src/helper/index.js +5 -0
- package/src/helper/layout-helper-methods.d.ts +539 -0
- package/src/helper/layout-helper-methods.js +1065 -0
- package/src/helper/renderer-hooks.d.ts +74 -0
- package/src/helper/renderer-hooks.js +14 -0
- package/src/helper/revision-helper-methods.d.ts +199 -0
- package/src/helper/revision-helper-methods.js +362 -0
- package/src/index.d.ts +18 -0
- package/src/index.js +18 -0
- package/src/layout-helper.d.ts +190 -0
- package/src/layout-helper.js +1368 -0
- package/src/layout.d.ts +779 -0
- package/src/layout.js +17232 -0
- package/src/list/abstract-list.d.ts +25 -0
- package/src/list/abstract-list.js +67 -0
- package/src/list/index.d.ts +7 -0
- package/src/list/index.js +7 -0
- package/src/list/level-override.d.ts +22 -0
- package/src/list/level-override.js +43 -0
- package/src/list/list-level.d.ts +57 -0
- package/src/list/list-level.js +249 -0
- package/src/list/list.d.ts +30 -0
- package/src/list/list.js +100 -0
- package/src/page.d.ts +4155 -0
- package/src/page.js +11342 -0
- package/src/parser/index.d.ts +1 -0
- package/src/parser/index.js +1 -0
- package/src/parser/sfdt-reader.d.ts +254 -0
- package/src/parser/sfdt-reader.js +4569 -0
- package/src/render.d.ts +226 -0
- package/src/render.js +4222 -0
- package/src/text-helper.d.ts +144 -0
- package/src/text-helper.js +1079 -0
- package/src/text-helpers/index.d.ts +2 -0
- package/src/text-helpers/index.js +2 -0
- package/src/text-helpers/optimized.d.ts +45 -0
- package/src/text-helpers/optimized.js +121 -0
- package/src/text-helpers/regular.d.ts +37 -0
- package/src/text-helpers/regular.js +93 -0
- package/src/themes/font-scheme.d.ts +28 -0
- package/src/themes/font-scheme.js +107 -0
- package/src/themes/index.d.ts +6 -0
- package/src/themes/index.js +6 -0
- package/src/themes/major-minor-font-scheme.d.ts +14 -0
- package/src/themes/major-minor-font-scheme.js +45 -0
- package/src/themes/themes.d.ts +11 -0
- package/src/themes/themes.js +31 -0
- package/src/utility/index.d.ts +1 -0
- package/src/utility/index.js +1 -0
- package/src/utility/path-util.d.ts +133 -0
- package/src/utility/path-util.js +639 -0
- package/text-helpers.d.ts +4 -0
- package/text-helpers.js +4 -0
- package/themes.d.ts +4 -0
- package/themes.js +4 -0
- package/utility.d.ts +4 -0
- package/utility.js +4 -0
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import { WBorder } from './border';
|
|
2
|
+
import { isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
3
|
+
import { WParagraphFormat } from './paragraph-format';
|
|
4
|
+
/**
|
|
5
|
+
* @private
|
|
6
|
+
*/
|
|
7
|
+
var WBorders = /** @class */ (function () {
|
|
8
|
+
function WBorders(node) {
|
|
9
|
+
this.leftIn = new WBorder(this);
|
|
10
|
+
this.rightIn = new WBorder(this);
|
|
11
|
+
this.topIn = new WBorder(this);
|
|
12
|
+
this.bottomIn = new WBorder(this);
|
|
13
|
+
this.horizontalIn = new WBorder(this);
|
|
14
|
+
this.verticalIn = new WBorder(this);
|
|
15
|
+
this.diagonalUpIn = new WBorder(this);
|
|
16
|
+
this.diagonalDownIn = new WBorder(this);
|
|
17
|
+
this.isParsing = false;
|
|
18
|
+
this.ownerBase = node;
|
|
19
|
+
}
|
|
20
|
+
Object.defineProperty(WBorders.prototype, "left", {
|
|
21
|
+
get: function () {
|
|
22
|
+
if (this.ownerBase instanceof WParagraphFormat) {
|
|
23
|
+
return this.getPropertyValue('left');
|
|
24
|
+
}
|
|
25
|
+
return this.leftIn;
|
|
26
|
+
},
|
|
27
|
+
set: function (value) {
|
|
28
|
+
this.leftIn = value;
|
|
29
|
+
},
|
|
30
|
+
enumerable: true,
|
|
31
|
+
configurable: true
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(WBorders.prototype, "right", {
|
|
34
|
+
get: function () {
|
|
35
|
+
if (this.ownerBase instanceof WParagraphFormat) {
|
|
36
|
+
return this.getPropertyValue('right');
|
|
37
|
+
}
|
|
38
|
+
return this.rightIn;
|
|
39
|
+
},
|
|
40
|
+
set: function (value) {
|
|
41
|
+
this.rightIn = value;
|
|
42
|
+
},
|
|
43
|
+
enumerable: true,
|
|
44
|
+
configurable: true
|
|
45
|
+
});
|
|
46
|
+
Object.defineProperty(WBorders.prototype, "top", {
|
|
47
|
+
get: function () {
|
|
48
|
+
if (this.ownerBase instanceof WParagraphFormat) {
|
|
49
|
+
return this.getPropertyValue('top');
|
|
50
|
+
}
|
|
51
|
+
return this.topIn;
|
|
52
|
+
},
|
|
53
|
+
set: function (value) {
|
|
54
|
+
this.topIn = value;
|
|
55
|
+
},
|
|
56
|
+
enumerable: true,
|
|
57
|
+
configurable: true
|
|
58
|
+
});
|
|
59
|
+
Object.defineProperty(WBorders.prototype, "bottom", {
|
|
60
|
+
get: function () {
|
|
61
|
+
if (this.ownerBase instanceof WParagraphFormat) {
|
|
62
|
+
return this.getPropertyValue('bottom');
|
|
63
|
+
}
|
|
64
|
+
return this.bottomIn;
|
|
65
|
+
},
|
|
66
|
+
set: function (value) {
|
|
67
|
+
this.bottomIn = value;
|
|
68
|
+
},
|
|
69
|
+
enumerable: true,
|
|
70
|
+
configurable: true
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(WBorders.prototype, "horizontal", {
|
|
73
|
+
get: function () {
|
|
74
|
+
if (this.ownerBase instanceof WParagraphFormat) {
|
|
75
|
+
return this.getPropertyValue('horizontal');
|
|
76
|
+
}
|
|
77
|
+
return this.horizontalIn;
|
|
78
|
+
},
|
|
79
|
+
set: function (value) {
|
|
80
|
+
this.horizontalIn = value;
|
|
81
|
+
},
|
|
82
|
+
enumerable: true,
|
|
83
|
+
configurable: true
|
|
84
|
+
});
|
|
85
|
+
Object.defineProperty(WBorders.prototype, "vertical", {
|
|
86
|
+
get: function () {
|
|
87
|
+
if (this.ownerBase instanceof WParagraphFormat) {
|
|
88
|
+
return this.getPropertyValue('vertical');
|
|
89
|
+
}
|
|
90
|
+
return this.verticalIn;
|
|
91
|
+
},
|
|
92
|
+
set: function (value) {
|
|
93
|
+
this.verticalIn = value;
|
|
94
|
+
},
|
|
95
|
+
enumerable: true,
|
|
96
|
+
configurable: true
|
|
97
|
+
});
|
|
98
|
+
Object.defineProperty(WBorders.prototype, "diagonalUp", {
|
|
99
|
+
get: function () {
|
|
100
|
+
return this.diagonalUpIn;
|
|
101
|
+
},
|
|
102
|
+
set: function (value) {
|
|
103
|
+
this.diagonalUpIn = value;
|
|
104
|
+
},
|
|
105
|
+
enumerable: true,
|
|
106
|
+
configurable: true
|
|
107
|
+
});
|
|
108
|
+
Object.defineProperty(WBorders.prototype, "diagonalDown", {
|
|
109
|
+
get: function () {
|
|
110
|
+
return this.diagonalDownIn;
|
|
111
|
+
},
|
|
112
|
+
set: function (value) {
|
|
113
|
+
this.diagonalDownIn = value;
|
|
114
|
+
},
|
|
115
|
+
enumerable: true,
|
|
116
|
+
configurable: true
|
|
117
|
+
});
|
|
118
|
+
WBorders.prototype.getPropertyValue = function (property) {
|
|
119
|
+
var border = this.getBorder(property);
|
|
120
|
+
if (this.isParsing) {
|
|
121
|
+
return border;
|
|
122
|
+
}
|
|
123
|
+
if (!border.hasValues()) {
|
|
124
|
+
var baseStyle = this.ownerBase.baseStyle;
|
|
125
|
+
if (!isNullOrUndefined(baseStyle)) {
|
|
126
|
+
var currentFormat = this;
|
|
127
|
+
while (!isNullOrUndefined(baseStyle)) {
|
|
128
|
+
var listParaFormat = void 0;
|
|
129
|
+
if (!this.ownerBase.listFormat.hasValue('listId')) {
|
|
130
|
+
listParaFormat = baseStyle.paragraphFormat.getListPargaraphFormat(property);
|
|
131
|
+
}
|
|
132
|
+
if (baseStyle.paragraphFormat.borders.getBorder(property).hasValues()) {
|
|
133
|
+
currentFormat = baseStyle.paragraphFormat.borders;
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
else if (!isNullOrUndefined(listParaFormat) &&
|
|
137
|
+
(listParaFormat.borders.getBorder(property).hasValues())) {
|
|
138
|
+
currentFormat = listParaFormat.borders;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
baseStyle = baseStyle.basedOn;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (!isNullOrUndefined(baseStyle)) {
|
|
146
|
+
return currentFormat.getBorder(property);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
return border;
|
|
152
|
+
}
|
|
153
|
+
return this.getDefaultValue(property);
|
|
154
|
+
};
|
|
155
|
+
WBorders.prototype.getDefaultValue = function (property) {
|
|
156
|
+
var docParagraphFormat = this.documentParagraphFormat();
|
|
157
|
+
var border;
|
|
158
|
+
if (!isNullOrUndefined(docParagraphFormat) && !isNullOrUndefined(docParagraphFormat.borders)) {
|
|
159
|
+
border = docParagraphFormat.borders.getBorder(property);
|
|
160
|
+
}
|
|
161
|
+
return border;
|
|
162
|
+
};
|
|
163
|
+
WBorders.prototype.documentParagraphFormat = function () {
|
|
164
|
+
var docParagraphFormat;
|
|
165
|
+
if (this.ownerBase instanceof WParagraphFormat) {
|
|
166
|
+
docParagraphFormat = this.ownerBase.getDocumentParagraphFormat().docParagraphFormat;
|
|
167
|
+
}
|
|
168
|
+
return docParagraphFormat;
|
|
169
|
+
};
|
|
170
|
+
WBorders.prototype.getBorder = function (property) {
|
|
171
|
+
var value = undefined;
|
|
172
|
+
switch (property) {
|
|
173
|
+
case 'left':
|
|
174
|
+
return this.leftIn;
|
|
175
|
+
case 'right':
|
|
176
|
+
return this.rightIn;
|
|
177
|
+
case 'top':
|
|
178
|
+
return this.topIn;
|
|
179
|
+
case 'bottom':
|
|
180
|
+
return this.bottomIn;
|
|
181
|
+
case 'vertical':
|
|
182
|
+
return this.verticalIn;
|
|
183
|
+
case 'horizontal':
|
|
184
|
+
return this.horizontalIn;
|
|
185
|
+
}
|
|
186
|
+
return value;
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* @private
|
|
190
|
+
* @returns {void}
|
|
191
|
+
*/
|
|
192
|
+
WBorders.prototype.clearFormat = function () {
|
|
193
|
+
if (!isNullOrUndefined(this.leftIn)) {
|
|
194
|
+
this.leftIn.clearFormat();
|
|
195
|
+
}
|
|
196
|
+
if (!isNullOrUndefined(this.topIn)) {
|
|
197
|
+
this.topIn.clearFormat();
|
|
198
|
+
}
|
|
199
|
+
if (!isNullOrUndefined(this.bottomIn)) {
|
|
200
|
+
this.bottomIn.clearFormat();
|
|
201
|
+
}
|
|
202
|
+
if (!isNullOrUndefined(this.rightIn)) {
|
|
203
|
+
this.rightIn.clearFormat();
|
|
204
|
+
}
|
|
205
|
+
if (!isNullOrUndefined(this.horizontalIn)) {
|
|
206
|
+
this.horizontalIn.clearFormat();
|
|
207
|
+
}
|
|
208
|
+
if (!isNullOrUndefined(this.verticalIn)) {
|
|
209
|
+
this.verticalIn.clearFormat();
|
|
210
|
+
}
|
|
211
|
+
if (!isNullOrUndefined(this.diagonalDown)) {
|
|
212
|
+
this.diagonalDown.clearFormat();
|
|
213
|
+
}
|
|
214
|
+
if (!isNullOrUndefined(this.diagonalUp)) {
|
|
215
|
+
this.diagonalUp.clearFormat();
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
/* eslint-enable */
|
|
219
|
+
/**
|
|
220
|
+
* Disposes the internal objects which are maintained.
|
|
221
|
+
*
|
|
222
|
+
* @private
|
|
223
|
+
* @returns {void}
|
|
224
|
+
*/
|
|
225
|
+
WBorders.prototype.destroy = function () {
|
|
226
|
+
if (!isNullOrUndefined(this.leftIn)) {
|
|
227
|
+
this.leftIn.destroy();
|
|
228
|
+
}
|
|
229
|
+
if (!isNullOrUndefined(this.topIn)) {
|
|
230
|
+
this.topIn.destroy();
|
|
231
|
+
}
|
|
232
|
+
if (!isNullOrUndefined(this.bottomIn)) {
|
|
233
|
+
this.bottomIn.destroy();
|
|
234
|
+
}
|
|
235
|
+
if (!isNullOrUndefined(this.rightIn)) {
|
|
236
|
+
this.rightIn.destroy();
|
|
237
|
+
}
|
|
238
|
+
if (!isNullOrUndefined(this.horizontalIn)) {
|
|
239
|
+
this.horizontalIn.destroy();
|
|
240
|
+
}
|
|
241
|
+
if (!isNullOrUndefined(this.verticalIn)) {
|
|
242
|
+
this.verticalIn.destroy();
|
|
243
|
+
}
|
|
244
|
+
if (!isNullOrUndefined(this.diagonalDown)) {
|
|
245
|
+
this.diagonalDown.destroy();
|
|
246
|
+
}
|
|
247
|
+
if (!isNullOrUndefined(this.diagonalUp)) {
|
|
248
|
+
this.diagonalUp.destroy();
|
|
249
|
+
}
|
|
250
|
+
this.topIn = undefined;
|
|
251
|
+
this.bottomIn = undefined;
|
|
252
|
+
this.leftIn = undefined;
|
|
253
|
+
this.rightIn = undefined;
|
|
254
|
+
this.horizontalIn = undefined;
|
|
255
|
+
this.verticalIn = undefined;
|
|
256
|
+
this.diagonalDownIn = undefined;
|
|
257
|
+
this.diagonalUpIn = undefined;
|
|
258
|
+
this.ownerBase = undefined;
|
|
259
|
+
};
|
|
260
|
+
WBorders.prototype.cloneFormat = function () {
|
|
261
|
+
var borders = new WBorders(undefined);
|
|
262
|
+
borders.top = isNullOrUndefined(this.topIn) ? undefined : this.topIn.cloneFormat();
|
|
263
|
+
borders.bottom = isNullOrUndefined(this.bottomIn) ? undefined : this.bottomIn.cloneFormat();
|
|
264
|
+
borders.left = isNullOrUndefined(this.leftIn) ? undefined : this.leftIn.cloneFormat();
|
|
265
|
+
borders.right = isNullOrUndefined(this.rightIn) ? undefined : this.rightIn.cloneFormat();
|
|
266
|
+
borders.horizontal = isNullOrUndefined(this.horizontalIn) ? undefined : this.horizontalIn.cloneFormat();
|
|
267
|
+
borders.vertical = isNullOrUndefined(this.verticalIn) ? undefined : this.verticalIn.cloneFormat();
|
|
268
|
+
borders.diagonalUp = isNullOrUndefined(this.diagonalUp) ? undefined : this.diagonalUp.cloneFormat();
|
|
269
|
+
borders.diagonalDown = isNullOrUndefined(this.diagonalDown) ? undefined : this.diagonalDown.cloneFormat();
|
|
270
|
+
return borders;
|
|
271
|
+
};
|
|
272
|
+
WBorders.prototype.copyFormat = function (borders) {
|
|
273
|
+
if (!isNullOrUndefined(borders.getBorder('left')) && borders.getBorder('left') instanceof WBorder) {
|
|
274
|
+
var left = new WBorder(this);
|
|
275
|
+
left.copyFormat(borders.getBorder('left'));
|
|
276
|
+
this.left = left;
|
|
277
|
+
}
|
|
278
|
+
if (!isNullOrUndefined(borders.getBorder('right')) && borders.getBorder('right') instanceof WBorder) {
|
|
279
|
+
var right = new WBorder(this);
|
|
280
|
+
right.copyFormat(borders.getBorder('right'));
|
|
281
|
+
this.right = right;
|
|
282
|
+
}
|
|
283
|
+
if (!isNullOrUndefined(borders.getBorder('top')) && borders.getBorder('top') instanceof WBorder) {
|
|
284
|
+
var top_1 = new WBorder(this);
|
|
285
|
+
top_1.copyFormat(borders.getBorder('top'));
|
|
286
|
+
this.top = top_1;
|
|
287
|
+
}
|
|
288
|
+
if (!isNullOrUndefined(borders.getBorder('bottom')) && borders.getBorder('bottom') instanceof WBorder) {
|
|
289
|
+
var bottom = new WBorder(this);
|
|
290
|
+
bottom.copyFormat(borders.getBorder('bottom'));
|
|
291
|
+
this.bottom = bottom;
|
|
292
|
+
}
|
|
293
|
+
if (!isNullOrUndefined(borders.getBorder('horizontal')) && borders.getBorder('horizontal') instanceof WBorder) {
|
|
294
|
+
var horizontal = new WBorder(this);
|
|
295
|
+
horizontal.copyFormat(borders.getBorder('horizontal'));
|
|
296
|
+
this.horizontal = horizontal;
|
|
297
|
+
}
|
|
298
|
+
if (!isNullOrUndefined(borders.getBorder('vertical')) && borders.getBorder('vertical') instanceof WBorder) {
|
|
299
|
+
var vertical = new WBorder(this);
|
|
300
|
+
vertical.copyFormat(borders.getBorder('vertical'));
|
|
301
|
+
this.vertical = vertical;
|
|
302
|
+
}
|
|
303
|
+
if (!isNullOrUndefined(borders.diagonalDown) && borders.diagonalDown instanceof WBorder) {
|
|
304
|
+
this.diagonalDown = new WBorder(this);
|
|
305
|
+
this.diagonalDown.copyFormat(borders.diagonalDown);
|
|
306
|
+
}
|
|
307
|
+
if (!isNullOrUndefined(borders.diagonalUp) && borders.diagonalUp instanceof WBorder) {
|
|
308
|
+
this.diagonalUp = new WBorder(this);
|
|
309
|
+
this.diagonalUp.copyFormat(borders.diagonalUp);
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
return WBorders;
|
|
313
|
+
}());
|
|
314
|
+
export { WBorders };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { CellVerticalAlignment, WidthType } from '../base/types';
|
|
2
|
+
import { WBorders } from './borders';
|
|
3
|
+
import { WShading } from './shading';
|
|
4
|
+
/**
|
|
5
|
+
* @private
|
|
6
|
+
*/
|
|
7
|
+
export declare class WCellFormat {
|
|
8
|
+
private uniqueCellFormat;
|
|
9
|
+
private static uniqueCellFormats;
|
|
10
|
+
private static uniqueFormatType;
|
|
11
|
+
initialCellWidth: number;
|
|
12
|
+
borders: WBorders;
|
|
13
|
+
shading: WShading;
|
|
14
|
+
ownerBase: Object;
|
|
15
|
+
leftMargin: number;
|
|
16
|
+
rightMargin: number;
|
|
17
|
+
topMargin: number;
|
|
18
|
+
bottomMargin: number;
|
|
19
|
+
cellWidth: number;
|
|
20
|
+
columnSpan: number;
|
|
21
|
+
rowSpan: number;
|
|
22
|
+
preferredWidth: number;
|
|
23
|
+
verticalAlignment: CellVerticalAlignment;
|
|
24
|
+
preferredWidthType: WidthType;
|
|
25
|
+
verticallyMergedCellsKeepWithNext: boolean;
|
|
26
|
+
constructor(node?: Object);
|
|
27
|
+
getPropertyValue(property: string): Object;
|
|
28
|
+
private setPropertyValue;
|
|
29
|
+
private initializeUniqueCellFormat;
|
|
30
|
+
private addUniqueCellFormat;
|
|
31
|
+
private static getPropertyDefaultValue;
|
|
32
|
+
containsMargins(): boolean;
|
|
33
|
+
destroy(): void;
|
|
34
|
+
cloneFormat(): WCellFormat;
|
|
35
|
+
hasValue(property: string): boolean;
|
|
36
|
+
copyFormat(format: WCellFormat): void;
|
|
37
|
+
/**
|
|
38
|
+
* @private
|
|
39
|
+
*/
|
|
40
|
+
initializeCellBorders(): void;
|
|
41
|
+
static clear(): void;
|
|
42
|
+
}
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
2
|
+
import { Dictionary } from '../base/dictionary';
|
|
3
|
+
import { WUniqueFormat } from '../base/unique-format';
|
|
4
|
+
import { WUniqueFormats } from '../base/unique-formats';
|
|
5
|
+
import { WBorders } from './borders';
|
|
6
|
+
import { WShading } from './shading';
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
/**
|
|
9
|
+
* @private
|
|
10
|
+
*/
|
|
11
|
+
var WCellFormat = /** @class */ (function () {
|
|
12
|
+
function WCellFormat(node) {
|
|
13
|
+
this.uniqueCellFormat = undefined;
|
|
14
|
+
this.initialCellWidth = 0;
|
|
15
|
+
this.borders = new WBorders(this);
|
|
16
|
+
this.shading = new WShading(this);
|
|
17
|
+
this.ownerBase = node;
|
|
18
|
+
this.borders = new WBorders(this);
|
|
19
|
+
this.shading = new WShading(this);
|
|
20
|
+
}
|
|
21
|
+
Object.defineProperty(WCellFormat.prototype, "leftMargin", {
|
|
22
|
+
get: function () {
|
|
23
|
+
return this.getPropertyValue('leftMargin');
|
|
24
|
+
},
|
|
25
|
+
set: function (value) {
|
|
26
|
+
this.setPropertyValue('leftMargin', value);
|
|
27
|
+
},
|
|
28
|
+
enumerable: true,
|
|
29
|
+
configurable: true
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(WCellFormat.prototype, "rightMargin", {
|
|
32
|
+
get: function () {
|
|
33
|
+
return this.getPropertyValue('rightMargin');
|
|
34
|
+
},
|
|
35
|
+
set: function (value) {
|
|
36
|
+
this.setPropertyValue('rightMargin', value);
|
|
37
|
+
},
|
|
38
|
+
enumerable: true,
|
|
39
|
+
configurable: true
|
|
40
|
+
});
|
|
41
|
+
Object.defineProperty(WCellFormat.prototype, "topMargin", {
|
|
42
|
+
get: function () {
|
|
43
|
+
return this.getPropertyValue('topMargin');
|
|
44
|
+
},
|
|
45
|
+
set: function (value) {
|
|
46
|
+
this.setPropertyValue('topMargin', value);
|
|
47
|
+
},
|
|
48
|
+
enumerable: true,
|
|
49
|
+
configurable: true
|
|
50
|
+
});
|
|
51
|
+
Object.defineProperty(WCellFormat.prototype, "bottomMargin", {
|
|
52
|
+
get: function () {
|
|
53
|
+
return this.getPropertyValue('bottomMargin');
|
|
54
|
+
},
|
|
55
|
+
set: function (value) {
|
|
56
|
+
this.setPropertyValue('bottomMargin', value);
|
|
57
|
+
},
|
|
58
|
+
enumerable: true,
|
|
59
|
+
configurable: true
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(WCellFormat.prototype, "cellWidth", {
|
|
62
|
+
get: function () {
|
|
63
|
+
return this.getPropertyValue('cellWidth');
|
|
64
|
+
},
|
|
65
|
+
set: function (value) {
|
|
66
|
+
this.setPropertyValue('cellWidth', value);
|
|
67
|
+
},
|
|
68
|
+
enumerable: true,
|
|
69
|
+
configurable: true
|
|
70
|
+
});
|
|
71
|
+
Object.defineProperty(WCellFormat.prototype, "columnSpan", {
|
|
72
|
+
get: function () {
|
|
73
|
+
return this.getPropertyValue('columnSpan');
|
|
74
|
+
},
|
|
75
|
+
set: function (value) {
|
|
76
|
+
this.setPropertyValue('columnSpan', value);
|
|
77
|
+
},
|
|
78
|
+
enumerable: true,
|
|
79
|
+
configurable: true
|
|
80
|
+
});
|
|
81
|
+
Object.defineProperty(WCellFormat.prototype, "rowSpan", {
|
|
82
|
+
get: function () {
|
|
83
|
+
return this.getPropertyValue('rowSpan');
|
|
84
|
+
},
|
|
85
|
+
set: function (value) {
|
|
86
|
+
this.setPropertyValue('rowSpan', value);
|
|
87
|
+
},
|
|
88
|
+
enumerable: true,
|
|
89
|
+
configurable: true
|
|
90
|
+
});
|
|
91
|
+
Object.defineProperty(WCellFormat.prototype, "preferredWidth", {
|
|
92
|
+
get: function () {
|
|
93
|
+
return this.getPropertyValue('preferredWidth');
|
|
94
|
+
},
|
|
95
|
+
set: function (value) {
|
|
96
|
+
this.setPropertyValue('preferredWidth', value);
|
|
97
|
+
},
|
|
98
|
+
enumerable: true,
|
|
99
|
+
configurable: true
|
|
100
|
+
});
|
|
101
|
+
Object.defineProperty(WCellFormat.prototype, "verticalAlignment", {
|
|
102
|
+
get: function () {
|
|
103
|
+
return this.getPropertyValue('verticalAlignment');
|
|
104
|
+
},
|
|
105
|
+
set: function (value) {
|
|
106
|
+
this.setPropertyValue('verticalAlignment', value);
|
|
107
|
+
},
|
|
108
|
+
enumerable: true,
|
|
109
|
+
configurable: true
|
|
110
|
+
});
|
|
111
|
+
Object.defineProperty(WCellFormat.prototype, "preferredWidthType", {
|
|
112
|
+
get: function () {
|
|
113
|
+
return this.getPropertyValue('preferredWidthType');
|
|
114
|
+
},
|
|
115
|
+
set: function (value) {
|
|
116
|
+
this.setPropertyValue('preferredWidthType', value);
|
|
117
|
+
},
|
|
118
|
+
enumerable: true,
|
|
119
|
+
configurable: true
|
|
120
|
+
});
|
|
121
|
+
Object.defineProperty(WCellFormat.prototype, "verticallyMergedCellsKeepWithNext", {
|
|
122
|
+
get: function () {
|
|
123
|
+
return this.getPropertyValue('verticallyMergedCellsKeepWithNext');
|
|
124
|
+
},
|
|
125
|
+
set: function (value) {
|
|
126
|
+
this.setPropertyValue('verticallyMergedCellsKeepWithNext', value);
|
|
127
|
+
},
|
|
128
|
+
enumerable: true,
|
|
129
|
+
configurable: true
|
|
130
|
+
});
|
|
131
|
+
WCellFormat.prototype.getPropertyValue = function (property) {
|
|
132
|
+
var hasValue = this.hasValue(property);
|
|
133
|
+
if (hasValue) {
|
|
134
|
+
var propertyType = WUniqueFormat.getPropertyType(WCellFormat.uniqueFormatType, property);
|
|
135
|
+
if (!isNullOrUndefined(this.uniqueCellFormat) && this.uniqueCellFormat.propertiesHash.containsKey(propertyType)) {
|
|
136
|
+
return this.uniqueCellFormat.propertiesHash.get(propertyType);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return WCellFormat.getPropertyDefaultValue(property);
|
|
140
|
+
};
|
|
141
|
+
WCellFormat.prototype.setPropertyValue = function (property, value) {
|
|
142
|
+
if (isNullOrUndefined(value) || value === '') {
|
|
143
|
+
value = WCellFormat.getPropertyDefaultValue(property);
|
|
144
|
+
}
|
|
145
|
+
if (isNullOrUndefined(this.uniqueCellFormat)) {
|
|
146
|
+
this.initializeUniqueCellFormat(property, value);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
var propertyType = WUniqueFormat.getPropertyType(this.uniqueCellFormat.uniqueFormatType, property);
|
|
150
|
+
if (this.uniqueCellFormat.propertiesHash.containsKey(propertyType) &&
|
|
151
|
+
this.uniqueCellFormat.propertiesHash.get(propertyType) === value) {
|
|
152
|
+
//Do nothing, since no change in property value and return
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
this.uniqueCellFormat = WCellFormat.uniqueCellFormats.updateUniqueFormat(this.uniqueCellFormat, property, value);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
WCellFormat.prototype.initializeUniqueCellFormat = function (property, propValue) {
|
|
159
|
+
var uniqueCellFormatTemp = new Dictionary();
|
|
160
|
+
this.addUniqueCellFormat('leftMargin', property, propValue, uniqueCellFormatTemp);
|
|
161
|
+
this.addUniqueCellFormat('topMargin', property, propValue, uniqueCellFormatTemp);
|
|
162
|
+
this.addUniqueCellFormat('bottomMargin', property, propValue, uniqueCellFormatTemp);
|
|
163
|
+
this.addUniqueCellFormat('rightMargin', property, propValue, uniqueCellFormatTemp);
|
|
164
|
+
this.addUniqueCellFormat('cellWidth', property, propValue, uniqueCellFormatTemp);
|
|
165
|
+
this.addUniqueCellFormat('columnSpan', property, propValue, uniqueCellFormatTemp);
|
|
166
|
+
this.addUniqueCellFormat('rowSpan', property, propValue, uniqueCellFormatTemp);
|
|
167
|
+
this.addUniqueCellFormat('preferredWidth', property, propValue, uniqueCellFormatTemp);
|
|
168
|
+
this.addUniqueCellFormat('verticalAlignment', property, propValue, uniqueCellFormatTemp);
|
|
169
|
+
this.addUniqueCellFormat('preferredWidthType', property, propValue, uniqueCellFormatTemp);
|
|
170
|
+
this.addUniqueCellFormat('verticallyMergedCellsKeepWithNext', property, propValue, uniqueCellFormatTemp);
|
|
171
|
+
this.uniqueCellFormat = WCellFormat.uniqueCellFormats.addUniqueFormat(uniqueCellFormatTemp, WCellFormat.uniqueFormatType);
|
|
172
|
+
};
|
|
173
|
+
WCellFormat.prototype.addUniqueCellFormat = function (property, modifiedProperty, propValue, uniqueCellFormatTemp) {
|
|
174
|
+
var propertyType = WUniqueFormat.getPropertyType(WCellFormat.uniqueFormatType, property);
|
|
175
|
+
if (property === modifiedProperty) {
|
|
176
|
+
uniqueCellFormatTemp.add(propertyType, propValue);
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
WCellFormat.getPropertyDefaultValue = function (property) {
|
|
180
|
+
var value = undefined;
|
|
181
|
+
switch (property) {
|
|
182
|
+
case 'leftMargin':
|
|
183
|
+
value = undefined;
|
|
184
|
+
break;
|
|
185
|
+
case 'topMargin':
|
|
186
|
+
value = undefined;
|
|
187
|
+
break;
|
|
188
|
+
case 'bottomMargin':
|
|
189
|
+
value = undefined;
|
|
190
|
+
break;
|
|
191
|
+
case 'rightMargin':
|
|
192
|
+
value = undefined;
|
|
193
|
+
break;
|
|
194
|
+
case 'cellWidth':
|
|
195
|
+
value = 0;
|
|
196
|
+
break;
|
|
197
|
+
case 'columnSpan':
|
|
198
|
+
value = 1;
|
|
199
|
+
break;
|
|
200
|
+
case 'rowSpan':
|
|
201
|
+
value = 1;
|
|
202
|
+
break;
|
|
203
|
+
case 'preferredWidth':
|
|
204
|
+
value = 0;
|
|
205
|
+
break;
|
|
206
|
+
case 'verticalAlignment':
|
|
207
|
+
value = 'Top';
|
|
208
|
+
break;
|
|
209
|
+
case 'preferredWidthType':
|
|
210
|
+
value = 'Point';
|
|
211
|
+
break;
|
|
212
|
+
case 'verticallyMergedCellsKeepWithNext':
|
|
213
|
+
value = false;
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
return value;
|
|
217
|
+
};
|
|
218
|
+
WCellFormat.prototype.containsMargins = function () {
|
|
219
|
+
return (!isNullOrUndefined(this.leftMargin)
|
|
220
|
+
|| !isNullOrUndefined(this.rightMargin)
|
|
221
|
+
|| !isNullOrUndefined(this.bottomMargin)
|
|
222
|
+
|| !isNullOrUndefined(this.topMargin));
|
|
223
|
+
};
|
|
224
|
+
WCellFormat.prototype.destroy = function () {
|
|
225
|
+
if (!isNullOrUndefined(this.borders)) {
|
|
226
|
+
this.borders.destroy();
|
|
227
|
+
}
|
|
228
|
+
if (!isNullOrUndefined(this.shading)) {
|
|
229
|
+
this.shading.destroy();
|
|
230
|
+
}
|
|
231
|
+
if (!isNullOrUndefined(this.uniqueCellFormat)) {
|
|
232
|
+
WCellFormat.uniqueCellFormats.remove(this.uniqueCellFormat);
|
|
233
|
+
}
|
|
234
|
+
this.uniqueCellFormat = undefined;
|
|
235
|
+
this.borders = undefined;
|
|
236
|
+
this.shading = undefined;
|
|
237
|
+
};
|
|
238
|
+
WCellFormat.prototype.cloneFormat = function () {
|
|
239
|
+
var format = new WCellFormat(undefined);
|
|
240
|
+
format.verticalAlignment = this.verticalAlignment;
|
|
241
|
+
format.leftMargin = this.leftMargin;
|
|
242
|
+
format.rightMargin = this.rightMargin;
|
|
243
|
+
format.topMargin = this.topMargin;
|
|
244
|
+
format.bottomMargin = this.bottomMargin;
|
|
245
|
+
format.preferredWidth = this.preferredWidth;
|
|
246
|
+
format.preferredWidthType = this.preferredWidthType;
|
|
247
|
+
format.verticallyMergedCellsKeepWithNext = this.verticallyMergedCellsKeepWithNext;
|
|
248
|
+
format.cellWidth = this.cellWidth;
|
|
249
|
+
format.borders = isNullOrUndefined(this.borders) ? undefined : this.borders.cloneFormat();
|
|
250
|
+
format.shading = isNullOrUndefined(this.shading) ? undefined : this.shading.cloneFormat();
|
|
251
|
+
return format;
|
|
252
|
+
};
|
|
253
|
+
WCellFormat.prototype.hasValue = function (property) {
|
|
254
|
+
if (!isNullOrUndefined(this.uniqueCellFormat)) {
|
|
255
|
+
var propertyType = WUniqueFormat.getPropertyType(this.uniqueCellFormat.uniqueFormatType, property);
|
|
256
|
+
return this.uniqueCellFormat.propertiesHash.containsKey(propertyType);
|
|
257
|
+
}
|
|
258
|
+
return false;
|
|
259
|
+
};
|
|
260
|
+
WCellFormat.prototype.copyFormat = function (format) {
|
|
261
|
+
if (!isNullOrUndefined(format)) {
|
|
262
|
+
if (!isNullOrUndefined(format.uniqueCellFormat)) {
|
|
263
|
+
this.cellWidth = format.cellWidth;
|
|
264
|
+
this.leftMargin = format.leftMargin;
|
|
265
|
+
this.topMargin = format.topMargin;
|
|
266
|
+
this.rightMargin = format.rightMargin;
|
|
267
|
+
this.bottomMargin = format.bottomMargin;
|
|
268
|
+
this.preferredWidth = format.preferredWidth;
|
|
269
|
+
this.columnSpan = format.columnSpan;
|
|
270
|
+
this.rowSpan = format.rowSpan;
|
|
271
|
+
this.preferredWidthType = format.preferredWidthType;
|
|
272
|
+
this.verticalAlignment = format.verticalAlignment;
|
|
273
|
+
this.verticallyMergedCellsKeepWithNext = format.verticallyMergedCellsKeepWithNext;
|
|
274
|
+
}
|
|
275
|
+
if (!isNullOrUndefined(format.shading)) {
|
|
276
|
+
this.shading = new WShading(this);
|
|
277
|
+
this.shading.copyFormat(format.shading);
|
|
278
|
+
}
|
|
279
|
+
if (!isNullOrUndefined(format.borders)) {
|
|
280
|
+
this.borders = new WBorders(this);
|
|
281
|
+
this.borders.copyFormat(format.borders);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* @private
|
|
287
|
+
*/
|
|
288
|
+
WCellFormat.prototype.initializeCellBorders = function () {
|
|
289
|
+
this.borders.left.lineStyle = 'Single';
|
|
290
|
+
this.borders.left.lineWidth = 0.5;
|
|
291
|
+
this.borders.right.lineStyle = 'Single';
|
|
292
|
+
this.borders.right.lineWidth = 0.5;
|
|
293
|
+
this.borders.top.lineStyle = 'Single';
|
|
294
|
+
this.borders.top.lineWidth = 0.5;
|
|
295
|
+
this.borders.bottom.lineStyle = 'Single';
|
|
296
|
+
this.borders.bottom.lineWidth = 0.5;
|
|
297
|
+
this.borders.horizontal.lineStyle = 'Single';
|
|
298
|
+
this.borders.horizontal.lineWidth = 0.5;
|
|
299
|
+
this.borders.vertical.lineStyle = 'Single';
|
|
300
|
+
this.borders.vertical.lineWidth = 0.5;
|
|
301
|
+
};
|
|
302
|
+
WCellFormat.clear = function () {
|
|
303
|
+
this.uniqueCellFormats.clear();
|
|
304
|
+
};
|
|
305
|
+
WCellFormat.uniqueCellFormats = new WUniqueFormats();
|
|
306
|
+
WCellFormat.uniqueFormatType = 4;
|
|
307
|
+
return WCellFormat;
|
|
308
|
+
}());
|
|
309
|
+
export { WCellFormat };
|