npoi
618 строк · 17.5 Кб
1
2using System;
3using System.Collections.Generic;
4using System.ComponentModel;
5using System.Diagnostics;
6using System.Xml.Serialization;
7
8namespace 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)]
15public class CT_CustomProperties
16{
17public CT_CustomProperties()
18{
19propertyField = new List<CT_Property>();
20}
21private List<CT_Property> propertyField;
22
23
24[XmlElement("property")]
25public List<CT_Property> property
26{
27get
28{
29return this.propertyField;
30}
31set
32{
33this.propertyField = value;
34}
35}
36public int sizeOfPropertyArray()
37{
38return this.propertyField.Count;
39}
40public CT_Property AddNewProperty()
41{
42CT_Property p = new CT_Property();
43propertyField.Add(p);
44return p;
45}
46public CT_Property GetPropertyArray(int index)
47{
48return this.propertyField[index];
49}
50public List<CT_Property> GetPropertyList()
51{
52return propertyField;
53}
54public CT_Property GetProperty(string name)
55{
56for (int i = 0; i < propertyField.Count; i++)
57{
58if (propertyField[i].name.Equals(name, StringComparison.InvariantCultureIgnoreCase))
59{
60return propertyField[i];
61}
62}
63return null;
64}
65public CT_CustomProperties Copy()
66{
67CT_CustomProperties prop = new CT_CustomProperties();
68prop.propertyField = new List<CT_Property>();
69foreach (CT_Property p in this.propertyField)
70{
71prop.propertyField.Add(p);
72}
73return 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)]
83public class CT_Property
84{
85
86private object itemField;
87
88private ItemChoiceType itemElementNameField;
89
90private string fmtidField;
91
92private int pidField;
93
94private string nameField;
95
96private 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")]
134public object Item
135{
136get
137{
138return this.itemField;
139}
140set
141{
142this.itemField = value;
143}
144}
145
146public bool IsSetFiletime()
147{
148throw new NotImplementedException();
149}
150
151public bool IsSetBool()
152{
153throw new NotImplementedException();
154}
155
156public object GetBool()
157{
158throw new NotImplementedException();
159}
160
161public bool IsSetI1()
162{
163throw new NotImplementedException();
164}
165
166public object GetI1()
167{
168throw new NotImplementedException();
169}
170
171public object GetI2()
172{
173throw new NotImplementedException();
174}
175
176public bool IsSetI2()
177{
178throw new NotImplementedException();
179}
180
181public object GetI4()
182{
183throw new NotImplementedException();
184}
185
186public object GetFiletime()
187{
188throw new NotImplementedException();
189}
190
191public bool IsSetI4()
192{
193throw new NotImplementedException();
194}
195
196public bool IsSetUi1()
197{
198throw new NotImplementedException();
199}
200
201public object GetUi1()
202{
203throw new NotImplementedException();
204}
205
206public object GetUi2()
207{
208throw new NotImplementedException();
209}
210
211public object GetUi4()
212{
213throw new NotImplementedException();
214}
215
216public bool IsSetUi8()
217{
218throw new NotImplementedException();
219}
220
221public bool IsSetUint()
222{
223throw new NotImplementedException();
224}
225
226public object GetUint()
227{
228throw new NotImplementedException();
229}
230
231public bool IsSetR4()
232{
233throw new NotImplementedException();
234}
235
236public bool IsSetR8()
237{
238throw new NotImplementedException();
239}
240
241public object GetR8()
242{
243throw new NotImplementedException();
244}
245
246public string GetR4()
247{
248throw new NotImplementedException();
249}
250
251public object GetUi8()
252{
253throw new NotImplementedException();
254}
255
256public bool IsSetDecimal()
257{
258throw new NotImplementedException();
259}
260
261public decimal? GetDecimal()
262{
263throw new NotImplementedException();
264}
265
266public bool IsSetUi4()
267{
268throw new NotImplementedException();
269}
270
271public bool IsSetUi2()
272{
273throw new NotImplementedException();
274}
275
276public bool IsSetI8()
277{
278throw new NotImplementedException();
279}
280
281public object GetI8()
282{
283throw new NotImplementedException();
284}
285
286public bool IsSetInt()
287{
288throw new NotImplementedException();
289}
290
291public object GetInt()
292{
293throw new NotImplementedException();
294}
295
296public object GetDate()
297{
298throw new NotImplementedException();
299}
300
301public bool IsSetDate()
302{
303throw new NotImplementedException();
304}
305
306public string GetLpstr()
307{
308throw new NotImplementedException();
309}
310
311public bool IsSetLpstr()
312{
313throw new NotImplementedException();
314}
315
316public string GetLpwstr()
317{
318throw new NotImplementedException();
319}
320
321[XmlIgnore]
322public ItemChoiceType ItemElementName
323{
324get
325{
326return this.itemElementNameField;
327}
328set
329{
330this.itemElementNameField = value;
331}
332}
333
334
335[XmlAttribute]
336public string fmtid
337{
338get
339{
340return this.fmtidField;
341}
342set
343{
344this.fmtidField = value;
345}
346}
347
348
349[XmlAttribute]
350public int pid
351{
352get
353{
354return this.pidField;
355}
356set
357{
358this.pidField = value;
359}
360}
361
362
363[XmlAttribute]
364public string name
365{
366get
367{
368return this.nameField;
369}
370set
371{
372this.nameField = value;
373}
374}
375
376
377[XmlAttribute]
378public string linkTarget
379{
380get
381{
382return this.linkTargetField;
383}
384set
385{
386this.linkTargetField = value;
387}
388}
389public override bool Equals(object obj)
390{
391if (!(obj is CT_Property))
392return false;
393
394CT_Property a = (CT_Property)obj;
395if (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)
401return false;
402
403return true;
404}
405public override int GetHashCode()
406{
407return this.pidField.GetHashCode();
408}
409public override string ToString()
410{
411return String.Format("[CT_Property][pid={0},name={1}]", pidField, nameField);
412}
413public bool IsSetLpwstr()
414{
415throw new NotImplementedException();
416}
417}
418
419
420
421[Serializable]
422[XmlType(Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
423public enum ST_ArrayBaseType
424{
425
426
427variant,
428
429
430i1,
431
432
433i2,
434
435
436i4,
437
438
439@int,
440
441
442ui1,
443
444
445ui2,
446
447
448ui4,
449
450
451@uint,
452
453
454r4,
455
456
457r8,
458
459
460@decimal,
461
462
463bstr,
464
465
466date,
467
468
469@bool,
470
471
472cy,
473
474
475error,
476}
477
478[Serializable]
479[XmlType(Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", IncludeInSchema = false)]
480public enum ItemChoiceType
481{
482
483
484[XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:array")]
485array,
486
487
488[XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:blob")]
489blob,
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")]
497bstr,
498
499
500[XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:cf")]
501cf,
502
503
504[XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:clsid")]
505clsid,
506
507
508[XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:cy")]
509cy,
510
511
512[XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:date")]
513date,
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")]
521empty,
522
523
524[XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:error")]
525error,
526
527
528[XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:filetime")]
529filetime,
530
531
532[XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:i1")]
533i1,
534
535
536[XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:i2")]
537i2,
538
539
540[XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:i4")]
541i4,
542
543
544[XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:i8")]
545i8,
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")]
553lpstr,
554
555
556[XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:lpwstr")]
557lpwstr,
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")]
565oblob,
566
567
568[XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:ostorage")]
569ostorage,
570
571
572[XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:ostream")]
573ostream,
574
575
576[XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:r4")]
577r4,
578
579
580[XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:r8")]
581r8,
582
583
584[XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:storage")]
585storage,
586
587
588[XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:stream")]
589stream,
590
591
592[XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:ui1")]
593ui1,
594
595
596[XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:ui2")]
597ui2,
598
599
600[XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:ui4")]
601ui4,
602
603
604[XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:ui8")]
605ui8,
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")]
613vector,
614
615
616[XmlEnum("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes:vstream")]
617vstream,
618}
619}