npoi
985 строк · 22.0 Кб
1using NPOI.OpenXml4Net.Util;2using System;3using System.IO;4using System.Xml;5using System.Xml.Serialization;6
7namespace NPOI.OpenXmlFormats.Wordprocessing8{
9
10[Serializable]11[XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]12[XmlRoot(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", IsNullable = true)]13public class CT_Frameset14{15
16private CT_String szField;17
18private CT_FramesetSplitbar framesetSplitbarField;19
20private CT_FrameLayout frameLayoutField;21
22private object[] itemsField;23
24public CT_Frameset()25{26this.itemsField = new object[0];27this.frameLayoutField = new CT_FrameLayout();28this.framesetSplitbarField = new CT_FramesetSplitbar();29this.szField = new CT_String();30}31
32[XmlElement(Order = 0)]33public CT_String sz34{35get36{37return this.szField;38}39set40{41this.szField = value;42}43}44
45[XmlElement(Order = 1)]46public CT_FramesetSplitbar framesetSplitbar47{48get49{50return this.framesetSplitbarField;51}52set53{54this.framesetSplitbarField = value;55}56}57
58[XmlElement(Order = 2)]59public CT_FrameLayout frameLayout60{61get62{63return this.frameLayoutField;64}65set66{67this.frameLayoutField = value;68}69}70
71[XmlElement("frame", typeof(CT_Frame), Order = 3)]72[XmlElement("frameset", typeof(CT_Frameset), Order = 3)]73public object[] Items74{75get76{77return this.itemsField;78}79set80{81this.itemsField = value;82}83}84}85
86
87[Serializable]88
89[XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]90[XmlRoot(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", IsNullable = true)]91public class CT_FramesetSplitbar92{93
94private CT_TwipsMeasure wField;95
96private CT_Color colorField;97
98private CT_OnOff noBorderField;99
100private CT_OnOff flatBordersField;101
102public CT_FramesetSplitbar()103{104this.flatBordersField = new CT_OnOff();105this.noBorderField = new CT_OnOff();106this.colorField = new CT_Color();107this.wField = new CT_TwipsMeasure();108}109
110[XmlElement(Order = 0)]111public CT_TwipsMeasure w112{113get114{115return this.wField;116}117set118{119this.wField = value;120}121}122
123[XmlElement(Order = 1)]124public CT_Color color125{126get127{128return this.colorField;129}130set131{132this.colorField = value;133}134}135
136[XmlElement(Order = 2)]137public CT_OnOff noBorder138{139get140{141return this.noBorderField;142}143set144{145this.noBorderField = value;146}147}148
149[XmlElement(Order = 3)]150public CT_OnOff flatBorders151{152get153{154return this.flatBordersField;155}156set157{158this.flatBordersField = value;159}160}161}162
163
164[Serializable]165
166[XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]167[XmlRoot(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", IsNullable = true)]168public class CT_FrameLayout169{170
171private ST_FrameLayout valField;172
173[XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]174public ST_FrameLayout val175{176get177{178return this.valField;179}180set181{182this.valField = value;183}184}185}186
187
188[Serializable]189[XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]190public enum ST_FrameLayout191{192
193
194rows,195
196
197cols,198
199
200none,201}202
203
204[Serializable]205
206[XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]207[XmlRoot(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", IsNullable = true)]208public class CT_Frame209{210
211private CT_String szField;212
213private CT_String nameField;214
215private CT_Rel sourceFileNameField;216
217private CT_PixelsMeasure marWField;218
219private CT_PixelsMeasure marHField;220
221private CT_FrameScrollbar scrollbarField;222
223private CT_OnOff noResizeAllowedField;224
225private CT_OnOff linkedToFileField;226
227public CT_Frame()228{229this.linkedToFileField = new CT_OnOff();230this.noResizeAllowedField = new CT_OnOff();231this.scrollbarField = new CT_FrameScrollbar();232this.marHField = new CT_PixelsMeasure();233this.marWField = new CT_PixelsMeasure();234this.sourceFileNameField = new CT_Rel();235this.nameField = new CT_String();236this.szField = new CT_String();237}238
239[XmlElement(Order = 0)]240public CT_String sz241{242get243{244return this.szField;245}246set247{248this.szField = value;249}250}251
252[XmlElement(Order = 1)]253public CT_String name254{255get256{257return this.nameField;258}259set260{261this.nameField = value;262}263}264
265[XmlElement(Order = 2)]266public CT_Rel sourceFileName267{268get269{270return this.sourceFileNameField;271}272set273{274this.sourceFileNameField = value;275}276}277
278[XmlElement(Order = 3)]279public CT_PixelsMeasure marW280{281get282{283return this.marWField;284}285set286{287this.marWField = value;288}289}290
291[XmlElement(Order = 4)]292public CT_PixelsMeasure marH293{294get295{296return this.marHField;297}298set299{300this.marHField = value;301}302}303
304[XmlElement(Order = 5)]305public CT_FrameScrollbar scrollbar306{307get308{309return this.scrollbarField;310}311set312{313this.scrollbarField = value;314}315}316
317[XmlElement(Order = 6)]318public CT_OnOff noResizeAllowed319{320get321{322return this.noResizeAllowedField;323}324set325{326this.noResizeAllowedField = value;327}328}329
330[XmlElement(Order = 7)]331public CT_OnOff linkedToFile332{333get334{335return this.linkedToFileField;336}337set338{339this.linkedToFileField = value;340}341}342}343
344[Serializable]345[XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]346[XmlRoot(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", IsNullable = true)]347public class CT_FrameScrollbar348{349
350private ST_FrameScrollbar valField;351
352[XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]353public ST_FrameScrollbar val354{355get356{357return this.valField;358}359set360{361this.valField = value;362}363}364}365
366
367[Serializable]368[XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]369public enum ST_FrameScrollbar370{371
372
373on,374
375
376off,377
378
379auto,380}381
382[Serializable]383
384[XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]385[XmlRoot(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", IsNullable = true)]386public class CT_FramePr387{388
389private ST_DropCap dropCapField;390
391private bool dropCapFieldSpecified;392
393private string linesField;394
395private ulong wField;396
397private bool wFieldSpecified;398
399private ulong hField;400
401private bool hFieldSpecified;402
403private ulong vSpaceField;404
405private bool vSpaceFieldSpecified;406
407private ulong hSpaceField;408
409private bool hSpaceFieldSpecified;410
411private ST_Wrap wrapField;412
413private bool wrapFieldSpecified;414
415private ST_HAnchor hAnchorField;416
417private bool hAnchorFieldSpecified;418
419private ST_VAnchor vAnchorField;420
421private bool vAnchorFieldSpecified;422
423private string xField;424
425private ST_XAlign xAlignField;426
427private bool xAlignFieldSpecified;428
429private string yField;430
431private ST_YAlign yAlignField;432
433private bool yAlignFieldSpecified;434
435private ST_HeightRule hRuleField;436
437private bool hRuleFieldSpecified;438
439private ST_OnOff anchorLockField;440
441private bool anchorLockFieldSpecified;442public static CT_FramePr Parse(XmlNode node, XmlNamespaceManager namespaceManager)443{444if (node == null)445return null;446CT_FramePr ctObj = new CT_FramePr();447if (node.Attributes["w:dropCap"] != null)448ctObj.dropCap = (ST_DropCap)Enum.Parse(typeof(ST_DropCap), node.Attributes["w:dropCap"].Value);449ctObj.lines = XmlHelper.ReadString(node.Attributes["w:lines"]);450ctObj.w = XmlHelper.ReadULong(node.Attributes["w:w"]);451ctObj.h = XmlHelper.ReadULong(node.Attributes["w:h"]);452ctObj.vSpace = XmlHelper.ReadULong(node.Attributes["w:vSpace"]);453ctObj.hSpace = XmlHelper.ReadULong(node.Attributes["w:hSpace"]);454if (node.Attributes["w:wrap"] != null)455ctObj.wrap = (ST_Wrap)Enum.Parse(typeof(ST_Wrap), node.Attributes["w:wrap"].Value);456if (node.Attributes["w:hAnchor"] != null)457ctObj.hAnchor = (ST_HAnchor)Enum.Parse(typeof(ST_HAnchor), node.Attributes["w:hAnchor"].Value);458if (node.Attributes["w:vAnchor"] != null)459ctObj.vAnchor = (ST_VAnchor)Enum.Parse(typeof(ST_VAnchor), node.Attributes["w:vAnchor"].Value);460ctObj.x = XmlHelper.ReadString(node.Attributes["w:x"]);461if (node.Attributes["w:xAlign"] != null)462ctObj.xAlign = (ST_XAlign)Enum.Parse(typeof(ST_XAlign), node.Attributes["w:xAlign"].Value);463ctObj.y = XmlHelper.ReadString(node.Attributes["w:y"]);464if (node.Attributes["w:yAlign"] != null)465ctObj.yAlign = (ST_YAlign)Enum.Parse(typeof(ST_YAlign), node.Attributes["w:yAlign"].Value);466if (node.Attributes["w:hRule"] != null)467ctObj.hRule = (ST_HeightRule)Enum.Parse(typeof(ST_HeightRule), node.Attributes["w:hRule"].Value);468if (node.Attributes["w:anchorLock"] != null)469ctObj.anchorLock = (ST_OnOff)Enum.Parse(typeof(ST_OnOff), node.Attributes["w:anchorLock"].Value,true);470return ctObj;471}472
473
474
475internal void Write(StreamWriter sw, string nodeName)476{477sw.Write(string.Format("<w:{0}", nodeName));478XmlHelper.WriteAttribute(sw, "w:dropCap", this.dropCap.ToString());479XmlHelper.WriteAttribute(sw, "w:lines", this.lines);480XmlHelper.WriteAttribute(sw, "w:w", this.w);481XmlHelper.WriteAttribute(sw, "w:h", this.h);482XmlHelper.WriteAttribute(sw, "w:vSpace", this.vSpace);483XmlHelper.WriteAttribute(sw, "w:hSpace", this.hSpace);484XmlHelper.WriteAttribute(sw, "w:wrap", this.wrap.ToString());485XmlHelper.WriteAttribute(sw, "w:hAnchor", this.hAnchor.ToString());486XmlHelper.WriteAttribute(sw, "w:vAnchor", this.vAnchor.ToString());487XmlHelper.WriteAttribute(sw, "w:x", this.x);488XmlHelper.WriteAttribute(sw, "w:xAlign", this.xAlign.ToString());489XmlHelper.WriteAttribute(sw, "w:y", this.y);490XmlHelper.WriteAttribute(sw, "w:yAlign", this.yAlign.ToString());491XmlHelper.WriteAttribute(sw, "w:hRule", this.hRule.ToString());492XmlHelper.WriteAttribute(sw, "w:anchorLock", this.anchorLock.ToString());493sw.Write(">");494sw.WriteEndW(nodeName);495}496
497
498[XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]499public ST_DropCap dropCap500{501get502{503return this.dropCapField;504}505set506{507this.dropCapField = value;508}509}510
511[XmlIgnore]512public bool dropCapSpecified513{514get515{516return this.dropCapFieldSpecified;517}518set519{520this.dropCapFieldSpecified = value;521}522}523
524[XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified, DataType = "integer")]525public string lines526{527get528{529return this.linesField;530}531set532{533this.linesField = value;534}535}536
537[XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]538public ulong w539{540get541{542return this.wField;543}544set545{546this.wField = value;547}548}549
550[XmlIgnore]551public bool wSpecified552{553get554{555return this.wFieldSpecified;556}557set558{559this.wFieldSpecified = value;560}561}562
563[XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]564public ulong h565{566get567{568return this.hField;569}570set571{572this.hField = value;573}574}575
576[XmlIgnore]577public bool hSpecified578{579get580{581return this.hFieldSpecified;582}583set584{585this.hFieldSpecified = value;586}587}588
589[XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]590public ulong vSpace591{592get593{594return this.vSpaceField;595}596set597{598this.vSpaceField = value;599}600}601
602[XmlIgnore]603public bool vSpaceSpecified604{605get606{607return this.vSpaceFieldSpecified;608}609set610{611this.vSpaceFieldSpecified = value;612}613}614
615[XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]616public ulong hSpace617{618get619{620return this.hSpaceField;621}622set623{624this.hSpaceField = value;625}626}627
628[XmlIgnore]629public bool hSpaceSpecified630{631get632{633return this.hSpaceFieldSpecified;634}635set636{637this.hSpaceFieldSpecified = value;638}639}640
641[XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]642public ST_Wrap wrap643{644get645{646return this.wrapField;647}648set649{650this.wrapField = value;651}652}653
654[XmlIgnore]655public bool wrapSpecified656{657get658{659return this.wrapFieldSpecified;660}661set662{663this.wrapFieldSpecified = value;664}665}666
667[XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]668public ST_HAnchor hAnchor669{670get671{672return this.hAnchorField;673}674set675{676this.hAnchorField = value;677}678}679
680[XmlIgnore]681public bool hAnchorSpecified682{683get684{685return this.hAnchorFieldSpecified;686}687set688{689this.hAnchorFieldSpecified = value;690}691}692
693[XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]694public ST_VAnchor vAnchor695{696get697{698return this.vAnchorField;699}700set701{702this.vAnchorField = value;703}704}705
706[XmlIgnore]707public bool vAnchorSpecified708{709get710{711return this.vAnchorFieldSpecified;712}713set714{715this.vAnchorFieldSpecified = value;716}717}718
719[XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified, DataType = "integer")]720public string x721{722get723{724return this.xField;725}726set727{728this.xField = value;729}730}731
732[XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]733public ST_XAlign xAlign734{735get736{737return this.xAlignField;738}739set740{741this.xAlignField = value;742}743}744
745[XmlIgnore]746public bool xAlignSpecified747{748get749{750return this.xAlignFieldSpecified;751}752set753{754this.xAlignFieldSpecified = value;755}756}757
758[XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified, DataType = "integer")]759public string y760{761get762{763return this.yField;764}765set766{767this.yField = value;768}769}770
771[XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]772public ST_YAlign yAlign773{774get775{776return this.yAlignField;777}778set779{780this.yAlignField = value;781}782}783
784[XmlIgnore]785public bool yAlignSpecified786{787get788{789return this.yAlignFieldSpecified;790}791set792{793this.yAlignFieldSpecified = value;794}795}796
797[XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]798public ST_HeightRule hRule799{800get801{802return this.hRuleField;803}804set805{806this.hRuleField = value;807}808}809
810[XmlIgnore]811public bool hRuleSpecified812{813get814{815return this.hRuleFieldSpecified;816}817set818{819this.hRuleFieldSpecified = value;820}821}822
823[XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]824public ST_OnOff anchorLock825{826get827{828return this.anchorLockField;829}830set831{832this.anchorLockField = value;833}834}835
836[XmlIgnore]837public bool anchorLockSpecified838{839get840{841return this.anchorLockFieldSpecified;842}843set844{845this.anchorLockFieldSpecified = value;846}847}848}849
850
851[Serializable]852[XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]853public enum ST_DropCap854{855
856
857none,858
859
860drop,861
862
863margin,864}865
866
867[Serializable]868[XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]869public enum ST_Wrap870{871
872
873auto,874
875
876notBeside,877
878
879around,880
881
882tight,883
884
885through,886
887
888none,889}890
891
892[Serializable]893[XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]894public enum ST_HAnchor895{896
897
898text,899
900
901margin,902
903
904page,905}906
907
908[Serializable]909[XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]910public enum ST_VAnchor911{912
913
914text,915
916
917margin,918
919
920page,921}922
923
924[Serializable]925[XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]926public enum ST_XAlign927{928
929
930left,931
932
933center,934
935
936right,937
938
939inside,940
941
942outside,943}944
945
946[Serializable]947[XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]948public enum ST_YAlign949{950
951
952inline,953
954
955top,956
957
958center,959
960
961bottom,962
963
964inside,965
966
967outside,968}969
970
971[Serializable]972[XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]973public enum ST_HeightRule974{975
976
977auto,978
979
980exact,981
982
983atLeast,984}985}