npoi

Форк
0
/
WordprocessingDrawing.cs 
441 строка · 9.8 Кб
1
using NPOI.OpenXml4Net.Util;
2
using System;
3
using System.IO;
4
using System.Xml;
5
using System.Xml.Serialization;
6

7
namespace NPOI.OpenXmlFormats.Vml.Wordprocessing
8
{
9
    [Serializable]
10

11
    [System.ComponentModel.DesignerCategory("code")]
12
    [XmlType(Namespace="urn:schemas-microsoft-com:office:word")]
13
    [XmlRoot(Namespace="urn:schemas-microsoft-com:office:word", IsNullable=true)]
14
    public class CT_Border {
15
        
16
        private ST_BorderType typeField;
17
        
18
        private bool typeFieldSpecified;
19
        
20
        private string widthField;
21
        
22
        private ST_BorderShadow shadowField;
23
        
24
        private bool shadowFieldSpecified;
25

26
        public static CT_Border Parse(XmlNode node, XmlNamespaceManager namespaceManager)
27
        {
28
            if (node == null)
29
                return null;
30
            CT_Border ctObj = new CT_Border();
31
            if (node.Attributes["type"] != null)
32
                ctObj.type = (ST_BorderType)Enum.Parse(typeof(ST_BorderType), node.Attributes["type"].Value);
33
            ctObj.width = XmlHelper.ReadString(node.Attributes["width"]);
34

35
            ctObj.shadow = NPOI.OpenXmlFormats.Util.XmlHelper.ReadBorderShadow(node.Attributes["shadow"]);
36
            return ctObj;
37
        }
38

39
        internal void Write(StreamWriter sw, string nodeName)
40
        {
41
            sw.Write(string.Format("<w:{0}", nodeName));
42
            if(this.type!= ST_BorderType.none)
43
                XmlHelper.WriteAttribute(sw, "type", this.type.ToString());
44
            XmlHelper.WriteAttribute(sw, "width", this.width);
45
            NPOI.OpenXmlFormats.Util.XmlHelper.WriteAttribute(sw, "shadow", this.shadow);
46
            sw.Write(">");
47
            sw.WriteEndW(nodeName);
48
        }
49

50
        [XmlAttribute]
51
        public ST_BorderType type {
52
            get {
53
                return this.typeField;
54
            }
55
            set {
56
                this.typeField = value;
57
            }
58
        }
59
        
60
    
61
        [XmlIgnore]
62
        public bool typeSpecified {
63
            get {
64
                return this.typeFieldSpecified;
65
            }
66
            set {
67
                this.typeFieldSpecified = value;
68
            }
69
        }
70
        
71
    
72
        [XmlAttribute(DataType="positiveInteger")]
73
        public string width {
74
            get {
75
                return this.widthField;
76
            }
77
            set {
78
                this.widthField = value;
79
            }
80
        }
81
        
82
    
83
        [XmlAttribute]
84
        public ST_BorderShadow shadow {
85
            get {
86
                return this.shadowField;
87
            }
88
            set {
89
                this.shadowField = value;
90
            }
91
        }
92
        
93
    
94
        [XmlIgnore]
95
        public bool shadowSpecified {
96
            get {
97
                return this.shadowFieldSpecified;
98
            }
99
            set {
100
                this.shadowFieldSpecified = value;
101
            }
102
        }
103
    }
104
    
105

106
    [Serializable]
107
    [XmlType(Namespace="urn:schemas-microsoft-com:office:word")]
108
    [XmlRoot(Namespace="urn:schemas-microsoft-com:office:word", IsNullable=false)]
109
    public enum ST_BorderType {
110
        
111
    
112
        none,
113
        
114
    
115
        single,
116
        
117
    
118
        thick,
119
        
120
    
121
        @double,
122
        
123
    
124
        hairline,
125
        
126
    
127
        dot,
128
        
129
    
130
        dash,
131
        
132
    
133
        dotDash,
134
        
135
    
136
        dashDotDot,
137
        
138
    
139
        triple,
140
        
141
    
142
        thinThickSmall,
143
        
144
    
145
        thickThinSmall,
146
        
147
    
148
        thickBetweenThinSmall,
149
        
150
    
151
        thinThick,
152
        
153
    
154
        thickThin,
155
        
156
    
157
        thickBetweenThin,
158
        
159
    
160
        thinThickLarge,
161
        
162
    
163
        thickThinLarge,
164
        
165
    
166
        thickBetweenThinLarge,
167
        
168
    
169
        wave,
170
        
171
    
172
        doubleWave,
173
        
174
    
175
        dashedSmall,
176
        
177
    
178
        dashDotStroked,
179
        
180
    
181
        threeDEmboss,
182
        
183
    
184
        threeDEngrave,
185
        
186
    
187
        HTMLOutset,
188
        
189
    
190
        HTMLInset,
191
    }
192
    
193

194
    [Serializable]
195
    [XmlType(Namespace="urn:schemas-microsoft-com:office:word")]
196
    [XmlRoot(Namespace="urn:schemas-microsoft-com:office:word", IsNullable=false)]
197
    public enum ST_BorderShadow {
198
        
199
    
200
        t,
201
        
202
    
203
        @true,
204
        
205
    
206
        f,
207
        
208
    
209
        @false,
210
    }
211
    
212

213
    [Serializable]
214

215
    [System.ComponentModel.DesignerCategory("code")]
216
    [XmlType(Namespace="urn:schemas-microsoft-com:office:word")]
217
    [XmlRoot(Namespace="urn:schemas-microsoft-com:office:word", IsNullable=true)]
218
    public class CT_Wrap {
219
        
220
        private ST_WrapType typeField;
221
        
222
        private bool typeFieldSpecified;
223
        
224
        private ST_WrapSide sideField;
225
        
226
        private bool sideFieldSpecified;
227
        
228
        private ST_HorizontalAnchor anchorxField;
229
        
230
        private bool anchorxFieldSpecified;
231
        
232
        private ST_VerticalAnchor anchoryField;
233
        
234
        private bool anchoryFieldSpecified;
235

236
        public static CT_Wrap Parse(XmlNode node, XmlNamespaceManager namespaceManager)
237
        {
238
            if (node == null)
239
                return null;
240
            CT_Wrap ctObj = new CT_Wrap();
241
            if (node.Attributes["type"] != null)
242
                ctObj.type = (ST_WrapType)Enum.Parse(typeof(ST_WrapType), node.Attributes["type"].Value);
243
            if (node.Attributes["side"] != null)
244
                ctObj.side = (ST_WrapSide)Enum.Parse(typeof(ST_WrapSide), node.Attributes["side"].Value);
245
            if (node.Attributes["anchorx"] != null)
246
                ctObj.anchorx = (ST_HorizontalAnchor)Enum.Parse(typeof(ST_HorizontalAnchor), node.Attributes["anchorx"].Value);
247
            if (node.Attributes["anchory"] != null)
248
                ctObj.anchory = (ST_VerticalAnchor)Enum.Parse(typeof(ST_VerticalAnchor), node.Attributes["anchory"].Value);
249
            return ctObj;
250
        }
251

252

253

254
        internal void Write(StreamWriter sw, string nodeName)
255
        {
256
            sw.Write(string.Format("<w:{0}", nodeName));
257
            if(this.type!=ST_WrapType.none)
258
                XmlHelper.WriteAttribute(sw, "type", this.type.ToString());
259
            XmlHelper.WriteAttribute(sw, "side", this.side.ToString());
260
            XmlHelper.WriteAttribute(sw, "anchorx", this.anchorx.ToString());
261
            XmlHelper.WriteAttribute(sw, "anchory", this.anchory.ToString());
262
            sw.Write(">");
263
            sw.WriteEndW(nodeName);
264
        }
265

266
        [XmlAttribute]
267
        public ST_WrapType type {
268
            get {
269
                return this.typeField;
270
            }
271
            set {
272
                this.typeField = value;
273
            }
274
        }
275
        
276
    
277
        [XmlIgnore]
278
        public bool typeSpecified {
279
            get {
280
                return this.typeFieldSpecified;
281
            }
282
            set {
283
                this.typeFieldSpecified = value;
284
            }
285
        }
286
        
287
    
288
        [XmlAttribute]
289
        public ST_WrapSide side {
290
            get {
291
                return this.sideField;
292
            }
293
            set {
294
                this.sideField = value;
295
            }
296
        }
297
        
298
    
299
        [XmlIgnore]
300
        public bool sideSpecified {
301
            get {
302
                return this.sideFieldSpecified;
303
            }
304
            set {
305
                this.sideFieldSpecified = value;
306
            }
307
        }
308
        
309
    
310
        [XmlAttribute]
311
        public ST_HorizontalAnchor anchorx {
312
            get {
313
                return this.anchorxField;
314
            }
315
            set {
316
                this.anchorxField = value;
317
            }
318
        }
319
        
320
    
321
        [XmlIgnore]
322
        public bool anchorxSpecified {
323
            get {
324
                return this.anchorxFieldSpecified;
325
            }
326
            set {
327
                this.anchorxFieldSpecified = value;
328
            }
329
        }
330
        
331
    
332
        [XmlAttribute]
333
        public ST_VerticalAnchor anchory {
334
            get {
335
                return this.anchoryField;
336
            }
337
            set {
338
                this.anchoryField = value;
339
            }
340
        }
341
        
342
    
343
        [XmlIgnore]
344
        public bool anchorySpecified {
345
            get {
346
                return this.anchoryFieldSpecified;
347
            }
348
            set {
349
                this.anchoryFieldSpecified = value;
350
            }
351
        }
352
    }
353
    
354

355
    [Serializable]
356
    [XmlType(Namespace="urn:schemas-microsoft-com:office:word")]
357
    [XmlRoot(Namespace="urn:schemas-microsoft-com:office:word", IsNullable=false)]
358
    public enum ST_WrapType {
359
        
360
    
361
        topAndBottom,
362
        
363
    
364
        square,
365
        
366
    
367
        none,
368
        
369
    
370
        tight,
371
        
372
    
373
        through,
374
    }
375
    
376

377
    [Serializable]
378
    [XmlType(Namespace="urn:schemas-microsoft-com:office:word")]
379
    [XmlRoot(Namespace="urn:schemas-microsoft-com:office:word", IsNullable=false)]
380
    public enum ST_WrapSide {
381
        
382
    
383
        both,
384
        
385
    
386
        left,
387
        
388
    
389
        right,
390
        
391
    
392
        largest,
393
    }
394
    
395

396
    [Serializable]
397
    [XmlType(Namespace="urn:schemas-microsoft-com:office:word")]
398
    [XmlRoot(Namespace="urn:schemas-microsoft-com:office:word", IsNullable=false)]
399
    public enum ST_HorizontalAnchor {
400
        
401
    
402
        margin,
403
        
404
    
405
        page,
406
        
407
    
408
        text,
409
        
410
    
411
        @char,
412
    }
413
    
414

415
    [Serializable]
416
    [XmlType(Namespace="urn:schemas-microsoft-com:office:word")]
417
    [XmlRoot(Namespace="urn:schemas-microsoft-com:office:word", IsNullable=false)]
418
    public enum ST_VerticalAnchor {
419
        
420
    
421
        margin,
422
        
423
    
424
        page,
425
        
426
    
427
        text,
428
        
429
    
430
        line,
431
    }
432
    
433

434
    [Serializable]
435

436
    [System.ComponentModel.DesignerCategory("code")]
437
    [XmlType(Namespace="urn:schemas-microsoft-com:office:word")]
438
    [XmlRoot(Namespace="urn:schemas-microsoft-com:office:word", IsNullable=true)]
439
    public class CT_AnchorLock {
440
    }
441
}
442

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.