npoi

Форк
0
/
spreadsheetShape.cs 
836 строк · 25.3 Кб
1
using NPOI.OpenXml4Net.Util;
2
using NPOI.OpenXmlFormats.Dml.Spreadsheet;
3
using System;
4
using System.Collections.Generic;
5
using System.ComponentModel;
6
using System.IO;
7
using System.Text;
8
using System.Xml;
9
using System.Xml.Serialization;
10

11
namespace NPOI.OpenXmlFormats.Dml.Spreadsheet
12
{
13
    [Serializable]
14
    [XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
15
    public class CT_Shape // empty interface: EG_ObjectChoices
16
    {
17
        private CT_ShapeNonVisual nvSpPrField;
18
        private CT_ShapeProperties spPrField;
19
        private CT_ShapeStyle styleField;
20
        private CT_TextBody txBodyField;
21

22
        private string macroField;
23
        private string textlinkField;
24
        private bool fLocksTextField;
25
        private bool fPublishedField;
26

27
        public void Set(CT_Shape obj)
28
        {
29
            this.macroField = obj.macro;
30
            this.textlinkField = obj.textlink;
31
            this.fLocksTextField = obj.fLocksText;
32
            this.fPublishedField = obj.fPublished;
33

34
            this.nvSpPrField = obj.nvSpPr;
35
            this.spPrField = obj.spPr;
36
            this.styleField = obj.style;
37
            this.txBodyField = obj.txBody;
38
        }
39
        public static CT_Shape Parse(XmlNode node, XmlNamespaceManager namespaceManager)
40
        {
41
            if (node == null)
42
                return null;
43
            CT_Shape ctObj = new CT_Shape();
44
            ctObj.macro = XmlHelper.ReadString(node.Attributes["macro"]);
45
            ctObj.textlink = XmlHelper.ReadString(node.Attributes["textlink"]);
46
            ctObj.fLocksText = XmlHelper.ReadBool(node.Attributes["fLocksText"]);
47
            ctObj.fPublished = XmlHelper.ReadBool(node.Attributes["fPublished"]);
48
            foreach (XmlNode childNode in node.ChildNodes)
49
            {
50
                if (childNode.LocalName == "nvSpPr")
51
                    ctObj.nvSpPr = CT_ShapeNonVisual.Parse(childNode, namespaceManager);
52
                else if (childNode.LocalName == "spPr")
53
                    ctObj.spPr = CT_ShapeProperties.Parse(childNode, namespaceManager);
54
                else if (childNode.LocalName == "txBody")
55
                    ctObj.txBody = CT_TextBody.Parse(childNode, namespaceManager);
56
                else if (childNode.LocalName == "style")
57
                    ctObj.style = CT_ShapeStyle.Parse(childNode, namespaceManager);
58
            }
59
            return ctObj;
60
        }
61

62

63

64
        internal void Write(StreamWriter sw, string nodeName)
65
        {
66
            sw.Write(string.Format("<xdr:{0}", nodeName));
67
            XmlHelper.WriteAttribute(sw, "macro", this.macro, true);
68
            XmlHelper.WriteAttribute(sw, "textlink", this.textlink,true);
69
            XmlHelper.WriteAttribute(sw, "fLocksText", this.fLocksText, false);
70
            XmlHelper.WriteAttribute(sw, "fPublished", this.fPublished, false);
71
            sw.Write(">");
72
            if (this.nvSpPr != null)
73
                this.nvSpPr.Write(sw, "nvSpPr");
74
            if (this.spPr != null)
75
                this.spPr.Write(sw, "spPr");
76
            if (this.style != null)
77
                this.style.Write(sw, "style");
78
            if (this.txBody != null)
79
                this.txBody.Write(sw, "txBody");
80
            sw.Write(string.Format("</xdr:{0}>", nodeName));
81
        }
82

83
        public CT_ShapeNonVisual AddNewNvSpPr()
84
        {
85
            this.nvSpPrField = new CT_ShapeNonVisual();
86
            return this.nvSpPrField;
87
        }
88

89
        public CT_ShapeProperties AddNewSpPr()
90
        {
91
            this.spPrField = new CT_ShapeProperties();
92
            return this.spPrField;
93
        }
94
        public CT_ShapeStyle AddNewStyle()
95
        {
96
            this.styleField = new CT_ShapeStyle();
97
            return this.styleField;
98
        }
99
        public CT_TextBody AddNewTxBody()
100
        {
101
            this.txBodyField = new CT_TextBody();
102
            return this.txBodyField;
103
        }
104

105
        public CT_ShapeNonVisual nvSpPr
106
        {
107
            get
108
            {
109
                return this.nvSpPrField;
110
            }
111
            set
112
            {
113
                this.nvSpPrField = value;
114
            }
115
        }
116
        public CT_ShapeProperties spPr
117
        {
118
            get
119
            {
120
                return this.spPrField;
121
            }
122
            set
123
            {
124
                this.spPrField = value;
125
            }
126
        }
127
        public CT_TextBody txBody
128
        {
129
            get
130
            {
131
                return this.txBodyField;
132
            }
133
            set
134
            {
135
                this.txBodyField = value;
136
            }
137
        }
138
        public CT_ShapeStyle style
139
        {
140
            get
141
            {
142
                return this.styleField;
143
            }
144
            set
145
            {
146
                this.styleField = value;
147
            }
148
        }
149

150
        [XmlAttribute]
151
        public string macro
152
        {
153
            get { return macroField; }
154
            set { macroField = value; }
155
        }
156

157
        [XmlAttribute]
158
        public string textlink
159
        {
160
            get { return textlinkField; }
161
            set { textlinkField = value; }
162
        }
163
        [XmlAttribute]
164
        public bool fLocksText
165
        {
166
            get { return fLocksTextField; }
167
            set { fLocksTextField = value; }
168
        }
169

170
        [XmlAttribute]
171
        public bool fPublished
172
        {
173
            get { return fPublishedField; }
174
            set { fPublishedField = value; }
175
        }
176

177
    }
178

179
    [System.ComponentModel.DesignerCategory("code")]
180
    [XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
181
    public class CT_TextBody
182
    {
183

184
        private CT_TextBodyProperties bodyPrField;
185

186
        private CT_TextListStyle lstStyleField;
187

188
        private List<CT_TextParagraph> pField;
189

190
        public static CT_TextBody Parse(XmlNode node, XmlNamespaceManager namespaceManager)
191
        {
192
            if (node == null)
193
                return null;
194
            CT_TextBody ctObj = new CT_TextBody();
195
            ctObj.p = new List<CT_TextParagraph>();
196
            foreach (XmlNode childNode in node.ChildNodes)
197
            {
198
                if (childNode.LocalName == "bodyPr")
199
                    ctObj.bodyPr = CT_TextBodyProperties.Parse(childNode, namespaceManager);
200
                else if (childNode.LocalName == "lstStyle")
201
                    ctObj.lstStyle = CT_TextListStyle.Parse(childNode, namespaceManager);
202
                else if (childNode.LocalName == "p")
203
                    ctObj.p.Add(CT_TextParagraph.Parse(childNode, namespaceManager));
204
            }
205
            return ctObj;
206
        }
207

208

209

210
        internal void Write(StreamWriter sw, string nodeName)
211
        {
212
            sw.Write(string.Format("<xdr:{0}", nodeName));
213
            sw.Write(">");
214
            if (this.bodyPr != null)
215
                this.bodyPr.Write(sw, "bodyPr");
216
            if (this.lstStyle != null)
217
                this.lstStyle.Write(sw, "lstStyle");
218
            foreach (CT_TextParagraph x in this.p)
219
            {
220
                x.Write(sw, "p");
221
            }
222
            sw.Write(string.Format("</xdr:{0}>", nodeName));
223
        }
224

225
        public void SetPArray(CT_TextParagraph[] array)
226
        {
227
            if (array == null)
228
                pField.Clear();
229
            else
230
                pField = new List<CT_TextParagraph>(array);
231
        }
232
        public CT_TextParagraph AddNewP()
233
        {
234
            if (this.pField == null)
235
                pField = new List<CT_TextParagraph>();
236
            CT_TextParagraph tp = new CT_TextParagraph();
237
            pField.Add(tp);
238
            return tp;
239
        }
240
        public CT_TextBodyProperties AddNewBodyPr()
241
        {
242
            this.bodyPrField = new CT_TextBodyProperties();
243
            return this.bodyPrField;
244
        }
245
        public CT_TextListStyle AddNewLstStyle()
246
        {
247
            this.lstStyleField = new CT_TextListStyle();
248
            return this.lstStyleField;
249
        }
250

251
        public CT_TextBodyProperties bodyPr
252
        {
253
            get
254
            {
255
                return this.bodyPrField;
256
            }
257
            set
258
            {
259
                this.bodyPrField = value;
260
            }
261
        }
262

263

264
        public CT_TextListStyle lstStyle
265
        {
266
            get
267
            {
268
                return this.lstStyleField;
269
            }
270
            set
271
            {
272
                this.lstStyleField = value;
273
            }
274
        }
275
        public override string ToString()
276
        {
277
            if (p == null || p.Count == 0)
278
                return string.Empty;
279
            StringBuilder sb = new StringBuilder();
280
            foreach (CT_TextParagraph tp in p)
281
            {
282
                foreach (CT_RegularTextRun tr in tp.r)
283
                {
284
                    sb.Append(tr.t);
285
                }
286
            }
287
            return sb.ToString();
288
        }
289

290
        [XmlElement("p")]
291
        public List<CT_TextParagraph> p
292
        {
293
            get
294
            {
295
                return this.pField;
296
            }
297
            set
298
            {
299
                this.pField = value;
300
            }
301
        }
302

303
        public CT_TextParagraph GetPArray(int pos)
304
        {
305
            if (p == null)
306
                return null;
307
            return p[pos];
308
        }
309

310
        public int SizeOfPArray()
311
        {
312
            return p.Count;
313
        }
314
    }
315

316
    [Serializable]
317
    [System.ComponentModel.DesignerCategory("code")]
318
    [XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
319
    public class CT_ShapeStyle
320
    {
321

322
        private CT_StyleMatrixReference lnRefField;
323

324
        private CT_StyleMatrixReference fillRefField;
325

326
        private CT_StyleMatrixReference effectRefField;
327

328
        private CT_FontReference fontRefField;
329
        public static CT_ShapeStyle Parse(XmlNode node, XmlNamespaceManager namespaceManager)
330
        {
331
            if (node == null)
332
                return null;
333
            CT_ShapeStyle ctObj = new CT_ShapeStyle();
334
            foreach (XmlNode childNode in node.ChildNodes)
335
            {
336
                if (childNode.LocalName == "lnRef")
337
                    ctObj.lnRef = CT_StyleMatrixReference.Parse(childNode, namespaceManager);
338
                else if (childNode.LocalName == "fillRef")
339
                    ctObj.fillRef = CT_StyleMatrixReference.Parse(childNode, namespaceManager);
340
                else if (childNode.LocalName == "effectRef")
341
                    ctObj.effectRef = CT_StyleMatrixReference.Parse(childNode, namespaceManager);
342
                else if (childNode.LocalName == "fontRef")
343
                    ctObj.fontRef = CT_FontReference.Parse(childNode, namespaceManager);
344
            }
345
            return ctObj;
346
        }
347

348

349

350
        internal void Write(StreamWriter sw, string nodeName)
351
        {
352
            sw.Write(string.Format("<xdr:{0}", nodeName));
353
            sw.Write(">");
354
            if (this.lnRef != null)
355
                this.lnRef.Write(sw, "lnRef");
356
            if (this.fillRef != null)
357
                this.fillRef.Write(sw, "fillRef");
358
            if (this.effectRef != null)
359
                this.effectRef.Write(sw, "effectRef");
360
            if (this.fontRef != null)
361
                this.fontRef.Write(sw, "fontRef");
362
            sw.Write(string.Format("</xdr:{0}>", nodeName));
363
        }
364

365
        public CT_StyleMatrixReference AddNewFillRef()
366
        {
367
            this.fillRefField = new CT_StyleMatrixReference();
368
            return this.fillRefField;
369
        }
370
        public CT_StyleMatrixReference AddNewLnRef()
371
        {
372
            this.lnRefField = new CT_StyleMatrixReference();
373
            return this.lnRefField;
374
        }
375
        public CT_FontReference AddNewFontRef()
376
        {
377
            this.fontRefField = new CT_FontReference();
378
            return this.fontRefField;
379
        }
380
        public CT_StyleMatrixReference AddNewEffectRef()
381
        {
382
            this.effectRefField = new CT_StyleMatrixReference();
383
            return this.effectRefField;
384
        }
385
        [XmlElement(Order = 0)]
386
        public CT_StyleMatrixReference lnRef
387
        {
388
            get
389
            {
390
                return this.lnRefField;
391
            }
392
            set
393
            {
394
                this.lnRefField = value;
395
            }
396
        }
397

398
        [XmlElement(Order = 1)]
399
        public CT_StyleMatrixReference fillRef
400
        {
401
            get
402
            {
403
                return this.fillRefField;
404
            }
405
            set
406
            {
407
                this.fillRefField = value;
408
            }
409
        }
410

411
        [XmlElement(Order = 2)]
412
        public CT_StyleMatrixReference effectRef
413
        {
414
            get
415
            {
416
                return this.effectRefField;
417
            }
418
            set
419
            {
420
                this.effectRefField = value;
421
            }
422
        }
423

424
        [XmlElement(Order = 3)]
425
        public CT_FontReference fontRef
426
        {
427
            get
428
            {
429
                return this.fontRefField;
430
            }
431
            set
432
            {
433
                this.fontRefField = value;
434
            }
435
        }
436
    }
437

438
    [Serializable]
439
    [XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
440
    public class CT_ShapeNonVisual
441
    {
442
        private CT_NonVisualDrawingProps cNvPrField;
443
        private CT_NonVisualDrawingShapeProps cNvSpPrField;
444

445
        public CT_NonVisualDrawingProps AddNewCNvPr()
446
        {
447
            this.cNvPrField = new CT_NonVisualDrawingProps();
448
            return this.cNvPrField;
449
        }
450
        public CT_NonVisualDrawingShapeProps AddNewCNvSpPr()
451
        {
452
            this.cNvSpPrField = new CT_NonVisualDrawingShapeProps();
453
            return this.cNvSpPrField;
454
        }
455
        public CT_NonVisualDrawingProps cNvPr
456
        {
457
            get
458
            {
459
                return this.cNvPrField;
460
            }
461
            set
462
            {
463
                this.cNvPrField = value;
464
            }
465
        }
466

467
        public CT_NonVisualDrawingShapeProps cNvSpPr
468
        {
469
            get
470
            {
471
                return this.cNvSpPrField;
472
            }
473
            set
474
            {
475
                this.cNvSpPrField = value;
476
            }
477
        }
478
        public static CT_ShapeNonVisual Parse(XmlNode node, XmlNamespaceManager namespaceManager)
479
        {
480
            if (node == null)
481
                return null;
482
            CT_ShapeNonVisual ctObj = new CT_ShapeNonVisual();
483
            foreach (XmlNode childNode in node.ChildNodes)
484
            {
485
                if (childNode.LocalName == "cNvPr")
486
                    ctObj.cNvPr = CT_NonVisualDrawingProps.Parse(childNode, namespaceManager);
487
                else if (childNode.LocalName == "cNvSpPr")
488
                    ctObj.cNvSpPr = CT_NonVisualDrawingShapeProps.Parse(childNode, namespaceManager);
489
            }
490
            return ctObj;
491
        }
492

493

494

495
        internal void Write(StreamWriter sw, string nodeName)
496
        {
497
            sw.Write(string.Format("<xdr:{0}", nodeName));
498
            sw.Write(">");
499
            if (this.cNvPr != null)
500
                this.cNvPr.Write(sw, "cNvPr");
501
            if (this.cNvSpPr != null)
502
                this.cNvSpPr.Write(sw, "cNvSpPr");
503
            sw.Write(string.Format("</xdr:{0}>", nodeName));
504
        }
505

506

507
    }
508
    [Serializable]
509
    [System.ComponentModel.DesignerCategoryAttribute("code")]
510
    [XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")]
511
    [XmlRoot(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", IsNullable = true)]
512
    public class CT_NonVisualDrawingShapeProps
513
    {
514

515
        private CT_ShapeLocking spLocksField;
516

517
        private CT_OfficeArtExtensionList extLstField;
518

519
        private bool txBoxField;
520
        public static CT_NonVisualDrawingShapeProps Parse(XmlNode node, XmlNamespaceManager namespaceManager)
521
        {
522
            if (node == null)
523
                return null;
524
            CT_NonVisualDrawingShapeProps ctObj = new CT_NonVisualDrawingShapeProps();
525
            ctObj.txBox = XmlHelper.ReadBool(node.Attributes["txBox"]);
526
            foreach (XmlNode childNode in node.ChildNodes)
527
            {
528
                if (childNode.LocalName == "spLocks")
529
                    ctObj.spLocks = CT_ShapeLocking.Parse(childNode, namespaceManager);
530
                else if (childNode.LocalName == "extLst")
531
                    ctObj.extLst = CT_OfficeArtExtensionList.Parse(childNode, namespaceManager);
532
            }
533
            return ctObj;
534
        }
535

536

537

538
        internal void Write(StreamWriter sw, string nodeName)
539
        {
540
            sw.Write(string.Format("<xdr:{0}", nodeName));
541
            XmlHelper.WriteAttribute(sw, "txBox", this.txBox, false);
542
            sw.Write(">");
543
            if (this.spLocks != null)
544
                this.spLocks.Write(sw, "spLocks");
545
            if (this.extLst != null)
546
                this.extLst.Write(sw, "extLst");
547
            sw.Write(string.Format("</xdr:{0}>", nodeName));
548
        }
549

550

551

552
        [XmlElement(Order = 0)]
553
        public CT_ShapeLocking spLocks
554
        {
555
            get
556
            {
557
                return this.spLocksField;
558
            }
559
            set
560
            {
561
                this.spLocksField = value;
562
            }
563
        }
564

565
        [XmlElement(Order = 1)]
566
        public CT_OfficeArtExtensionList extLst
567
        {
568
            get
569
            {
570
                return this.extLstField;
571
            }
572
            set
573
            {
574
                this.extLstField = value;
575
            }
576
        }
577

578
        [XmlAttribute]
579
        [DefaultValue(false)]
580
        public bool txBox
581
        {
582
            get
583
            {
584
                return this.txBoxField;
585
            }
586
            set
587
            {
588
                this.txBoxField = value;
589
            }
590
        }
591
    }
592
    [Serializable]
593
    [XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
594
    public class CT_GroupShape
595
    {
596
        CT_GroupShapeProperties grpSpPrField;
597
        CT_GroupShapeNonVisual nvGrpSpPrField;
598
        List<CT_Connector> connectors = null;
599
        List<CT_Picture> pictures = null;
600
        List<CT_Shape> shapes = null;
601
        List<CT_GroupShape> groups = null;
602

603
        public CT_GroupShape()
604
        {
605
            this.connectors = new List<CT_Connector>();
606
            this.pictures = new List<CT_Picture>();
607
            this.shapes = new List<CT_Shape>();
608
            this.groups = new List<CT_GroupShape>();
609
        }
610

611
        public void Set(CT_GroupShape groupShape)
612
        {
613
            this.grpSpPrField = groupShape.grpSpPr;
614
            this.nvGrpSpPrField = groupShape.nvGrpSpPr;
615
        }
616

617
        public CT_GroupShapeProperties AddNewGrpSpPr()
618
        {
619
            this.grpSpPrField = new CT_GroupShapeProperties();
620
            return this.grpSpPrField;
621
        }
622
        public CT_GroupShapeNonVisual AddNewNvGrpSpPr()
623
        {
624
            this.nvGrpSpPrField = new CT_GroupShapeNonVisual();
625
            return this.nvGrpSpPrField;
626
        }
627
        public CT_Connector AddNewCxnSp()
628
        {
629
            var connectorField = new CT_Connector();
630
            connectors.Add(connectorField);
631
            return connectorField;
632
        }
633
        public CT_Shape AddNewSp()
634
        {
635
            var shapeField = new CT_Shape();
636
            shapes.Add(shapeField);
637
            return shapeField;
638
        }
639
        public CT_Picture AddNewPic()
640
        {
641
            var pic=new CT_Picture();
642
            pictures.Add(pic);
643
            return pic;
644
        }
645
        public CT_GroupShape AddNewGroup()
646
        {
647
            var group = new CT_GroupShape();
648
            groups.Add(group);
649
            return group;
650
        }
651

652
        public CT_GroupShapeNonVisual nvGrpSpPr
653
        {
654
            get { return nvGrpSpPrField; }
655
            set { nvGrpSpPrField = value; }
656
        }
657
        public CT_GroupShapeProperties grpSpPr
658
        {
659
            get { return grpSpPrField; }
660
            set { grpSpPrField = value; }
661

662
        }
663
        public List<CT_Connector> Connectors { get => connectors; }
664
        public List<CT_Picture> Pictures { get => pictures; }
665
        public List<CT_Shape> Shapes { get => shapes; }
666
        public List<CT_GroupShape> Groups { get => groups; }
667

668
        public void GetShapes(List<object> aShapes)         // a:Argument
669
        {
670
            aShapes.Add(this);
671
            if(connectors != null)
672
            {
673
                foreach(var c in connectors)
674
                {
675
                    aShapes.Add(c);
676
                }
677
            }
678
            if(pictures != null)
679
            {
680
                foreach(var p in pictures)
681
                {
682
                    aShapes.Add(p);
683
                }
684
            }
685
            if(shapes != null)
686
            {
687
                foreach(var s in shapes)
688
                {
689
                    aShapes.Add(s);
690
                }
691
            }
692
            if(groups != null)
693
            {
694
                foreach(var shp in groups)
695
                {
696
                    shp.GetShapes(aShapes);
697
                }
698
            }
699
        }
700

701
        public static CT_GroupShape Parse(XmlNode node, XmlNamespaceManager namespaceManager)
702
        {
703
            if (node == null)
704
                return null;
705
            CT_GroupShape ctObj = new CT_GroupShape();
706
            foreach (XmlNode childNode in node.ChildNodes)
707
            {
708
                if (childNode.LocalName == "nvGrpSpPr")
709
                    ctObj.nvGrpSpPr = CT_GroupShapeNonVisual.Parse(childNode, namespaceManager);
710
                else if (childNode.LocalName == "grpSpPr")
711
                    ctObj.grpSpPr = CT_GroupShapeProperties.Parse(childNode, namespaceManager);
712
                else if (childNode.LocalName == "pic")
713
                {
714
                    var pic = CT_Picture.Parse(childNode, namespaceManager);
715
                    ctObj.pictures.Add(pic);
716
                }
717
                else if (childNode.LocalName == "sp")
718
                {
719
                    var shape = CT_Shape.Parse(childNode, namespaceManager);
720
                    ctObj.shapes.Add(shape);
721
                }
722
                else if (childNode.LocalName == "cxnSp")
723
                {
724
                    var connector = CT_Connector.Parse(childNode, namespaceManager);
725
                    ctObj.connectors.Add(connector);
726
                }
727
                else if (childNode.LocalName == "grpSp")
728
                {
729
                    var group = CT_GroupShape.Parse(childNode, namespaceManager);
730
                    ctObj.groups.Add(group);
731
                }
732
            }
733
            return ctObj;
734
        }
735

736

737

738
        internal void Write(StreamWriter sw, string nodeName)
739
        {
740
            sw.Write(string.Format("<xdr:{0}", nodeName));
741
            sw.Write(">");
742
            if (this.nvGrpSpPr != null)
743
                this.nvGrpSpPr.Write(sw, "xdr:nvGrpSpPr");
744
            if (this.grpSpPr != null)
745
                this.grpSpPr.Write(sw, "xdr:grpSpPr");
746
            if (this.shapes.Count > 0)
747
            {
748
                foreach (var shape in this.shapes)
749
                {
750
                    shape.Write(sw, "sp");
751
                }
752
            }
753
            if (this.pictures.Count > 0)
754
            {
755
                foreach (var pic in this.pictures)
756
                {
757
                    pic.Write(sw, "pic");
758
                }
759
            }
760
            if (this.connectors.Count > 0)
761
            {
762
                foreach(var con in this.connectors)
763
                {
764
                    con.Write(sw, "cxnSp");
765
                }
766
            }
767
            if (this.groups.Count > 0)
768
            {
769
                foreach(var group in this.groups)
770
                {
771
                    group.Write(sw, "grpSp");
772
                }
773
            }
774
            sw.Write(string.Format("</xdr:{0}>", nodeName));
775
        }
776

777
    }
778

779
    [Serializable]
780
    [XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
781
    public class CT_GroupShapeNonVisual
782
    {
783
        CT_NonVisualDrawingProps cNvPrField;
784
        CT_NonVisualGroupDrawingShapeProps cNvGrpSpPrField;
785
        public static CT_GroupShapeNonVisual Parse(XmlNode node, XmlNamespaceManager namespaceManager)
786
        {
787
            if (node == null)
788
                return null;
789
            CT_GroupShapeNonVisual ctObj = new CT_GroupShapeNonVisual();
790
            foreach (XmlNode childNode in node.ChildNodes)
791
            {
792
                if (childNode.LocalName == "cNvPr")
793
                    ctObj.cNvPr = CT_NonVisualDrawingProps.Parse(childNode, namespaceManager);
794
                else if (childNode.LocalName == "cNvGrpSpPr")
795
                    ctObj.cNvGrpSpPr = CT_NonVisualGroupDrawingShapeProps.Parse(childNode, namespaceManager);
796
            }
797
            return ctObj;
798
        }
799

800

801

802
        internal void Write(StreamWriter sw, string nodeName)
803
        {
804
            sw.Write(string.Format("<{0}", nodeName));
805
            sw.Write(">");
806
            if (this.cNvPr != null)
807
                this.cNvPr.Write(sw, "cNvPr");
808
            if (this.cNvGrpSpPr != null)
809
                this.cNvGrpSpPr.Write(sw, "xdr:cNvGrpSpPr");
810
            sw.Write(string.Format("</{0}>", nodeName));
811
        }
812

813
        public CT_NonVisualGroupDrawingShapeProps AddNewCNvGrpSpPr()
814
        {
815
            this.cNvGrpSpPrField = new CT_NonVisualGroupDrawingShapeProps();
816
            return this.cNvGrpSpPrField;
817
        }
818
        public CT_NonVisualDrawingProps AddNewCNvPr()
819
        {
820
            this.cNvPrField = new CT_NonVisualDrawingProps();
821
            return this.cNvPrField;
822
        }
823

824
        public CT_NonVisualDrawingProps cNvPr
825
        {
826
            get { return cNvPrField; }
827
            set { cNvPrField = value; }
828
        }
829
        public CT_NonVisualGroupDrawingShapeProps cNvGrpSpPr
830
        {
831
            get { return cNvGrpSpPrField; }
832
            set { cNvGrpSpPrField = value; }
833
        }
834
    }
835

836
}
837

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

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

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

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