npoi

Форк
0
/
DocumentPropertiesCustom.cs 
618 строк · 17.5 Кб
1

2
using System;
3
using System.Collections.Generic;
4
using System.ComponentModel;
5
using System.Diagnostics;
6
using System.Xml.Serialization;
7

8
namespace NPOI.OpenXmlFormats
9
{
10
    [Serializable]
11
    [DebuggerStepThrough]
12
    [DesignerCategory("code")]
13
    [XmlType(Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties")]
14
    [XmlRoot("Properties", Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties", IsNullable = true)]
15
    public class CT_CustomProperties
16
    {
17
        public CT_CustomProperties()
18
        {
19
            propertyField = new List<CT_Property>();
20
        }
21
        private List<CT_Property> propertyField;
22

23
    
24
        [XmlElement("property")]
25
        public List<CT_Property> property
26
        {
27
            get
28
            {
29
                return this.propertyField;
30
            }
31
            set
32
            {
33
                this.propertyField = value;
34
            }
35
        }
36
        public int sizeOfPropertyArray()
37
        {
38
            return this.propertyField.Count;
39
        }
40
        public CT_Property AddNewProperty()
41
        {
42
            CT_Property p = new CT_Property();
43
            propertyField.Add(p);
44
            return p;
45
        }
46
        public CT_Property GetPropertyArray(int index)
47
        {
48
            return this.propertyField[index];
49
        }
50
        public List<CT_Property> GetPropertyList()
51
        {
52
            return propertyField;
53
        }
54
        public CT_Property GetProperty(string name)
55
        {
56
            for (int i = 0; i < propertyField.Count; i++)
57
            {
58
                if (propertyField[i].name.Equals(name, StringComparison.InvariantCultureIgnoreCase))
59
                {
60
                    return propertyField[i];
61
                }
62
            }
63
            return null;
64
        }
65
        public CT_CustomProperties Copy()
66
        {
67
            CT_CustomProperties prop = new CT_CustomProperties();
68
            prop.propertyField = new List<CT_Property>();
69
            foreach (CT_Property p in this.propertyField)
70
            {
71
                prop.propertyField.Add(p);
72
            }
73
            return prop;
74
        }
75
     }
76

77

78
    [Serializable]
79
    [DebuggerStepThrough]
80
    [DesignerCategory("code")]
81
    [XmlType(Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties")]
82
    [XmlRoot(Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties", IsNullable = true)]
83
    public class CT_Property
84
    {
85

86
        private object itemField;
87

88
        private ItemChoiceType itemElementNameField;
89

90
        private string fmtidField;
91

92
        private int pidField;
93

94
        private string nameField;
95

96
        private string linkTargetField;
97

98
    
99
        [XmlElement("array", typeof(CT_Array), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
100
        [XmlElement("blob", typeof(byte[]), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", DataType = "base64Binary")]
101
        [XmlElement("bool", typeof(bool), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
102
        [XmlElement("bstr", typeof(string), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
103
        [XmlElement("cf", typeof(CT_Cf), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
104
        [XmlElement("clsid", typeof(string), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
105
        [XmlElement("cy", typeof(string), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
106
        [XmlElement("date", typeof(DateTime), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
107
        [XmlElement("decimal", typeof(decimal), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
108
        [XmlElement("empty", typeof(CT_Empty), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
109
        [XmlElement("error", typeof(string), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
110
        [XmlElement("filetime", typeof(System.DateTime), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
111
        [XmlElement("i1", typeof(sbyte), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
112
        [XmlElement("i2", typeof(short), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
113
        [XmlElement("i4", typeof(int), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
114
        [XmlElement("i8", typeof(long), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
115
        [XmlElement("int", typeof(int), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
116
        [XmlElement("lpstr", typeof(string), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
117
        [XmlElement("lpwstr", typeof(string), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
118
        [XmlElement("null", typeof(CT_Null), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
119
        [XmlElement("oblob", typeof(byte[]), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", DataType = "base64Binary")]
120
        [XmlElement("ostorage", typeof(byte[]), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", DataType = "base64Binary")]
121
        [XmlElement("ostream", typeof(byte[]), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", DataType = "base64Binary")]
122
        [XmlElement("r4", typeof(float), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
123
        [XmlElement("r8", typeof(double), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
124
        [XmlElement("storage", typeof(byte[]), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", DataType = "base64Binary")]
125
        [XmlElement("stream", typeof(byte[]), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", DataType = "base64Binary")]
126
        [XmlElement("ui1", typeof(byte), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
127
        [XmlElement("ui2", typeof(ushort), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
128
        [XmlElement("ui4", typeof(uint), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
129
        [XmlElement("ui8", typeof(ulong), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
130
        [XmlElement("uint", typeof(uint), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
131
        [XmlElement("vector", typeof(CT_Vector), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
132
        [XmlElement("vstream", typeof(CT_Vstream), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
133
        [XmlChoiceIdentifier("ItemElementName")]
134
        public object Item
135
        {
136
            get
137
            {
138
                return this.itemField;
139
            }
140
            set
141
            {
142
                this.itemField = value;
143
            }
144
        }
145

146
        public bool IsSetFiletime()
147
        {
148
            throw new NotImplementedException();
149
        }
150

151
        public bool IsSetBool()
152
        {
153
            throw new NotImplementedException();
154
        }
155

156
        public object GetBool()
157
        {
158
            throw new NotImplementedException();
159
        }
160

161
        public bool IsSetI1()
162
        {
163
            throw new NotImplementedException();
164
        }
165

166
        public object GetI1()
167
        {
168
            throw new NotImplementedException();
169
        }
170

171
        public object GetI2()
172
        {
173
            throw new NotImplementedException();
174
        }
175

176
        public bool IsSetI2()
177
        {
178
            throw new NotImplementedException();
179
        }
180

181
        public object GetI4()
182
        {
183
            throw new NotImplementedException();
184
        }
185

186
        public object GetFiletime()
187
        {
188
            throw new NotImplementedException();
189
        }
190

191
        public bool IsSetI4()
192
        {
193
            throw new NotImplementedException();
194
        }
195

196
        public bool IsSetUi1()
197
        {
198
            throw new NotImplementedException();
199
        }
200

201
        public object GetUi1()
202
        {
203
            throw new NotImplementedException();
204
        }
205

206
        public object GetUi2()
207
        {
208
            throw new NotImplementedException();
209
        }
210

211
        public object GetUi4()
212
        {
213
            throw new NotImplementedException();
214
        }
215

216
        public bool IsSetUi8()
217
        {
218
            throw new NotImplementedException();
219
        }
220

221
        public bool IsSetUint()
222
        {
223
            throw new NotImplementedException();
224
        }
225

226
        public object GetUint()
227
        {
228
            throw new NotImplementedException();
229
        }
230

231
        public bool IsSetR4()
232
        {
233
            throw new NotImplementedException();
234
        }
235

236
        public bool IsSetR8()
237
        {
238
            throw new NotImplementedException();
239
        }
240

241
        public object GetR8()
242
        {
243
            throw new NotImplementedException();
244
        }
245

246
        public string GetR4()
247
        {
248
            throw new NotImplementedException();
249
        }
250

251
        public object GetUi8()
252
        {
253
            throw new NotImplementedException();
254
        }
255

256
        public bool IsSetDecimal()
257
        {
258
            throw new NotImplementedException();
259
        }
260

261
        public decimal? GetDecimal()
262
        {
263
            throw new NotImplementedException();
264
        }
265

266
        public bool IsSetUi4()
267
        {
268
            throw new NotImplementedException();
269
        }
270

271
        public bool IsSetUi2()
272
        {
273
            throw new NotImplementedException();
274
        }
275

276
        public bool IsSetI8()
277
        {
278
            throw new NotImplementedException();
279
        }
280

281
        public object GetI8()
282
        {
283
            throw new NotImplementedException();
284
        }
285

286
        public bool IsSetInt()
287
        {
288
            throw new NotImplementedException();
289
        }
290

291
        public object GetInt()
292
        {
293
            throw new NotImplementedException();
294
        }
295

296
        public object GetDate()
297
        {
298
            throw new NotImplementedException();
299
        }
300

301
        public bool IsSetDate()
302
        {
303
            throw new NotImplementedException();
304
        }
305

306
        public string GetLpstr()
307
        {
308
            throw new NotImplementedException();
309
        }
310

311
        public bool IsSetLpstr()
312
        {
313
            throw new NotImplementedException();
314
        }
315

316
        public string GetLpwstr()
317
        {
318
            throw new NotImplementedException();
319
        }
320

321
        [XmlIgnore]
322
        public ItemChoiceType ItemElementName
323
        {
324
            get
325
            {
326
                return this.itemElementNameField;
327
            }
328
            set
329
            {
330
                this.itemElementNameField = value;
331
            }
332
        }
333

334
    
335
        [XmlAttribute]
336
        public string fmtid
337
        {
338
            get
339
            {
340
                return this.fmtidField;
341
            }
342
            set
343
            {
344
                this.fmtidField = value;
345
            }
346
        }
347

348
    
349
        [XmlAttribute]
350
        public int pid
351
        {
352
            get
353
            {
354
                return this.pidField;
355
            }
356
            set
357
            {
358
                this.pidField = value;
359
            }
360
        }
361

362
    
363
        [XmlAttribute]
364
        public string name
365
        {
366
            get
367
            {
368
                return this.nameField;
369
            }
370
            set
371
            {
372
                this.nameField = value;
373
            }
374
        }
375

376
    
377
        [XmlAttribute]
378
        public string linkTarget
379
        {
380
            get
381
            {
382
                return this.linkTargetField;
383
            }
384
            set
385
            {
386
                this.linkTargetField = value;
387
            }
388
        }
389
        public override bool Equals(object obj)
390
        {
391
            if (!(obj is CT_Property))
392
                return false;
393

394
            CT_Property a = (CT_Property)obj;
395
            if (a.fmtidField != this.fmtidField
396
                ||a.itemElementNameField!=this.itemElementNameField
397
                ||a.itemField!=this.itemField
398
                ||a.linkTargetField!=this.linkTargetField
399
                ||a.nameField!=this.nameField
400
                ||a.pidField!=this.pidField)
401
                return false;
402

403
            return true;
404
        }
405
        public override int GetHashCode()
406
        {
407
            return this.pidField.GetHashCode();
408
        }
409
        public override string ToString()
410
        {
411
            return String.Format("[CT_Property][pid={0},name={1}]", pidField, nameField);
412
        }
413
        public bool IsSetLpwstr()
414
        {
415
            throw new NotImplementedException();
416
        }
417
    }
418

419

420

421
    [Serializable]
422
    [XmlType(Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
423
    public enum ST_ArrayBaseType
424
    {
425

426
    
427
        variant,
428

429
    
430
        i1,
431

432
    
433
        i2,
434

435
    
436
        i4,
437

438
    
439
        @int,
440

441
    
442
        ui1,
443

444
    
445
        ui2,
446

447
    
448
        ui4,
449

450
    
451
        @uint,
452

453
    
454
        r4,
455

456
    
457
        r8,
458

459
    
460
        @decimal,
461

462
    
463
        bstr,
464

465
    
466
        date,
467

468
    
469
        @bool,
470

471
    
472
        cy,
473

474
    
475
        error,
476
    }
477

478
    [Serializable]
479
    [XmlType(Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", IncludeInSchema = false)]
480
    public enum ItemChoiceType
481
    {
482

483
    
484
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:array")]
485
        array,
486

487
    
488
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:blob")]
489
        blob,
490

491
    
492
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:bool")]
493
        @bool,
494

495
    
496
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:bstr")]
497
        bstr,
498

499
    
500
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:cf")]
501
        cf,
502

503
    
504
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:clsid")]
505
        clsid,
506

507
    
508
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:cy")]
509
        cy,
510

511
    
512
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:date")]
513
        date,
514

515
    
516
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:decimal")]
517
        @decimal,
518

519
    
520
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:empty")]
521
        empty,
522

523
    
524
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:error")]
525
        error,
526

527
    
528
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:filetime")]
529
        filetime,
530

531
    
532
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:i1")]
533
        i1,
534

535
    
536
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:i2")]
537
        i2,
538

539
    
540
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:i4")]
541
        i4,
542

543
    
544
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:i8")]
545
        i8,
546

547
    
548
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:int")]
549
        @int,
550

551
    
552
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:lpstr")]
553
        lpstr,
554

555
    
556
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:lpwstr")]
557
        lpwstr,
558

559
    
560
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:null")]
561
        @null,
562

563
    
564
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:oblob")]
565
        oblob,
566

567
    
568
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:ostorage")]
569
        ostorage,
570

571
    
572
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:ostream")]
573
        ostream,
574

575
    
576
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:r4")]
577
        r4,
578

579
    
580
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:r8")]
581
        r8,
582

583
    
584
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:storage")]
585
        storage,
586

587
    
588
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:stream")]
589
        stream,
590

591
    
592
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:ui1")]
593
        ui1,
594

595
    
596
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:ui2")]
597
        ui2,
598

599
    
600
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:ui4")]
601
        ui4,
602

603
    
604
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:ui8")]
605
        ui8,
606

607
    
608
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:uint")]
609
        @uint,
610

611
    
612
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:vector")]
613
        vector,
614

615
    
616
        [XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:vstream")]
617
        vstream,
618
    }
619
}

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

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

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

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