| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179 | 1×
1×
1×
5×
1×
1×
4×
4×
5×
4×
4×
1×
| define(["require", "exports", "@syncfusion/ej2-base"], function (require, exports, ej2_base_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function createDefaultTextBoxOptions() {
return {
name: 'Text Box',
text: '',
width: 185.76,
height: 74.88,
widthRelativePercent: -3.4028235e38,
heightRelativePercent: -3.4028235e38,
horizontalPosition: -3.75,
verticalPosition: 1.5,
horizontalOrigin: 'Column',
verticalOrigin: 'Paragraph',
horizontalAlignment: 'None',
verticalAlignment: 'None',
horizontalRelativePercent: -3.4028235e38,
verticalRelativePercent: -3.4028235e38,
horizontalPositionMode: 'Absolute',
verticalPositionMode: 'Absolute',
textWrappingStyle: 'InFrontOfText',
textWrappingType: 'Both',
distanceLeft: 9,
distanceRight: 9,
distanceTop: 0,
distanceBottom: 0,
widthScale: 100,
heightScale: 98,
lockAspectRatio: false
};
}
exports.createDefaultTextBoxOptions = createDefaultTextBoxOptions;
function buildTextBoxSfdt(options) {
var text = ej2_base_1.SanitizeHtmlHelper.sanitize(options.text || '');
var lines = text.split(/\r\n|\r|\n/);
var blocks = lines.map(function (line) { return ({
paragraphFormat: { styleName: 'Normal' },
characterFormat: {},
inlines: line.length > 0 ? [{ text: line }] : []
}); });
var document = {
sections: [{
sectionFormat: {
pageWidth: 612,
pageHeight: 792,
leftMargin: 72,
rightMargin: 72,
topMargin: 72,
bottomMargin: 72,
differentFirstPage: false,
differentOddAndEvenPages: false,
headerDistance: 36,
footerDistance: 36,
bidi: false
},
blocks: [{
paragraphFormat: { styleName: 'Normal' },
characterFormat: {},
inlines: [{
shapeId: 0,
name: options.name || 'Text Box',
visible: true,
is2007Shape: false,
autoShapeType: 'Rectangle',
width: options.width,
height: options.height,
widthScale: isNaN(options.widthScale) ? 100 : options.widthScale,
heightScale: isNaN(options.heightScale) ? 100 : options.heightScale,
rotation: 0,
widthRelativePercent: options.widthRelativePercent,
heightRelativePercent: options.heightRelativePercent,
horizontalRelativePercent: isNaN(options.horizontalRelativePercent)
? -3.4028235e38 : options.horizontalRelativePercent,
verticalRelativePercent: isNaN(options.verticalRelativePercent)
? -3.4028235e38 : options.verticalRelativePercent,
horizontalPosition: options.horizontalPosition,
verticalPosition: options.verticalPosition,
horizontalOrigin: options.horizontalOrigin,
verticalOrigin: options.verticalOrigin,
horizontalAlignment: options.horizontalAlignment || 'None',
verticalAlignment: options.verticalAlignment || 'None',
textWrappingStyle: options.textWrappingStyle,
textWrappingType: options.textWrappingType,
zOrderPosition: 251659264,
allowOverlap: true,
layoutInCell: true,
lockAnchor: false,
distanceLeft: options.distanceLeft,
distanceRight: options.distanceRight,
distanceTop: options.distanceTop,
distanceBottom: options.distanceBottom,
lineFromXPosition: 0,
lineFromYPosition: 0,
lineToXPosition: 0,
lineToYPosition: 0,
leftMargin: 0,
topMargin: 0,
coordinateSize: '0,0',
coordinateXOrigin: 0,
coordinateYOrigin: 0,
lineFormat: {
lineFormatType: 'Solid',
weight: 0.5,
color: '#000000',
line: true
},
fillFormat: {
color: '#ffffff',
fill: true,
fillType: 'FillSolid'
},
textFrame: {
textVerticalAlignment: 'Top',
leftMargin: 7.2,
rightMargin: 7.2,
topMargin: 3.6,
bottomMargin: 3.6,
blocks: blocks
}
}]
}],
headersFooters: {}
}],
characterFormat: {
bold: false,
italic: false,
fontSize: 11,
fontFamily: 'Calibri',
underline: 'None',
strikethrough: 'None',
baselineAlignment: 'Normal',
highlightColor: 'NoColor',
fontColor: '#00000000',
bidi: false
},
paragraphFormat: {
leftIndent: 0,
rightIndent: 0,
firstLineIndent: 0,
beforeSpacing: 0,
afterSpacing: 8,
lineSpacing: 1.0791666507720947,
lineSpacingType: 'Multiple',
textAlignment: 'Left',
outlineLevel: 'BodyText'
},
defaultTabWidth: 36,
formatting: false,
protectionType: 'NoProtection',
enforcement: false,
dontUseHtmlParagraphAutoSpacing: false,
formFieldShading: true,
compatibilityMode: 'Word2013',
styles: [{
name: 'Normal',
type: 'Paragraph',
paragraphFormat: {
lineSpacing: 1.149999976158142,
lineSpacingType: 'Multiple',
listFormat: {}
},
characterFormat: {
fontFamily: 'Calibri',
fontSize: 11
},
next: 'Normal'
}],
lists: [],
abstractLists: [],
comments: [],
revisions: [],
customXml: []
};
return JSON.stringify(document);
}
exports.buildTextBoxSfdt = buildTextBoxSfdt;
});
|