| @@ -23,7 +23,8 @@ namespace ConsoleApp1 | |||
| c.AddLegend(ChartLegendPosition.Bottom, false); | |||
| c.BarDirection = BarDirection.Column; | |||
| c.BarGrouping = BarGrouping.Standard; | |||
| c.GapWidth = 200; | |||
| c.GapWidth = 200; | |||
| c.Title = "贺州供有点"; | |||
| // Create the data. | |||
| var canada = CreateCanadaExpenses(); | |||
| @@ -13,6 +13,7 @@ | |||
| ***********************************************************************************/ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Xml.Linq; | |||
| namespace Xceed.Words.NET | |||
| @@ -81,9 +82,18 @@ namespace Xceed.Words.NET | |||
| { | |||
| set | |||
| { | |||
| var t = new XElement(CXName("t"), "CCCC"); | |||
| var rpr = new XElement(CXName("rPr"), CAttr("lang", "zh-CN"), CAttr("altLang", "en-US")); | |||
| var p = CElement("p",CElement()) | |||
| var t = new XElement(XE.A.CName("t"), value); | |||
| var rpr = new XElement(XE.A.CName("rPr"), XE.A.CAttr("lang", "zh-CN"), XE.A.CAttr("altLang", "en-US")); | |||
| var pPr = new XElement(XE.A.CName("pPr"), | |||
| XE.A.CAttr("defTabSz", "914400"), | |||
| XE.A.CElement("defRPr", new List<object>(XE.A.CAttrs("lang=zh-CN sz=1400 b=0 i=0 u=none strike=noStrike kern=1200 spc=0 baseline=0")) | |||
| { XE.A.CElement("solidFill",XE.A.CElement("schemeClr",XE.A.CAttr("val=tx1"),XE.A.CElement("lumMod","65000"),XE.A.CElement("lumOff","35000"))) }.ToArray()) | |||
| ); | |||
| var bodyPr = XE.A.CElement("bodyPr", XE.A.CAttrs("rot=0 spcFirstLastPara=0 vertOverflow=ellipsis vert=horz wrap=square anchor=ctr anchorCtr=1")); | |||
| var rich = XE.C.CElement("rich", bodyPr, XE.A.CElement("lstStyle"), XE.A.CElement("p", pPr, XE.A.CElement("r", rpr, t))); | |||
| var title = XE.C.CElement("title", XE.C.CElement("tx", rich), XE.C.CElement("overlay", "0")); | |||
| this.ChartRootXml.AddFirst(title); | |||
| } | |||
| } | |||
| @@ -298,26 +298,6 @@ namespace Xceed.Words.NET | |||
| protected abstract XElement CreateChartXml(); | |||
| #endregion | |||
| public static XName CXName(string eleName) | |||
| { | |||
| return XName.Get(eleName, DocX.c.NamespaceName); | |||
| } | |||
| public static XElement CXElement(string eleName, string value, string valName = "val") | |||
| { | |||
| return new XElement(CXName(eleName), new XAttribute(CXName(valName), value)); | |||
| } | |||
| public static XElement CElement(string eleName,params object[] eles) | |||
| { | |||
| return new XElement(CXName(eleName), eles); | |||
| } | |||
| public static XAttribute CAttr(string arr, string value) | |||
| { | |||
| return new XAttribute(CXName(arr), value); | |||
| } | |||
| } | |||
| /// <summary> | |||
| @@ -371,20 +351,20 @@ namespace Xceed.Words.NET | |||
| var sve = this.Xml.Element(XName.Get("dLbls", DocX.c.NamespaceName)); | |||
| if (sve != null) | |||
| { | |||
| //TODO remove this Element | |||
| } | |||
| var list = new List<XElement>(); | |||
| list.Add(Chart.CXElement("dLblPos", "outEnd"));//< c:dLblPos val = "outEnd" /> | |||
| list.Add(Chart.CXElement("showLegendKey", "0"));//< c:showLegendKey val = "0" /> | |||
| list.Add(Chart.CXElement("showVal", Convert.ToInt32(value).ToString()));// < c:showVal val = "1" /> | |||
| list.Add(Chart.CXElement("showCatName", "0"));//< c:showCatName val = "0" /> | |||
| list.Add(Chart.CXElement("showSerName", "0"));//< c:showSerName val = "0" /> | |||
| list.Add(Chart.CXElement("showPercent", "0"));//< c:showPercent val = "0" /> | |||
| list.Add(Chart.CXElement("showBubbleSize", "0"));//< c:showBubbleSize val = "0" /> | |||
| list.Add(Chart.CXElement("showLeaderLines", "0"));//< c:showLeaderLines val = "0" /> | |||
| sve = new XElement(Chart.CXName("dLbls"), list.ToArray()); | |||
| this.Xml.Element(Chart.CXName("invertIfNegative")).AddAfterSelf(sve); | |||
| list.Add(XE.C.CElement("dLblPos", "outEnd"));//< c:dLblPos val = "outEnd" /> | |||
| list.Add(XE.C.CElement("showLegendKey", "0"));//< c:showLegendKey val = "0" /> | |||
| list.Add(XE.C.CElement("showVal", Convert.ToInt32(value).ToString()));// < c:showVal val = "1" /> | |||
| list.Add(XE.C.CElement("showCatName", "0"));//< c:showCatName val = "0" /> | |||
| list.Add(XE.C.CElement("showSerName", "0"));//< c:showSerName val = "0" /> | |||
| list.Add(XE.C.CElement("showPercent", "0"));//< c:showPercent val = "0" /> | |||
| list.Add(XE.C.CElement("showBubbleSize", "0"));//< c:showBubbleSize val = "0" /> | |||
| list.Add(XE.C.CElement("showLeaderLines", "0"));//< c:showLeaderLines val = "0" /> | |||
| sve = new XElement(XE.C.CName("dLbls"), list.ToArray()); | |||
| this.Xml.Element(XE.C.CName("invertIfNegative")).AddAfterSelf(sve); | |||
| } | |||
| } | |||
| @@ -0,0 +1,61 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using System.Xml.Linq; | |||
| namespace Xceed.Words.NET | |||
| { | |||
| public class XE | |||
| { | |||
| private XNamespace _NameSpace; | |||
| public XE(XNamespace ns) | |||
| { | |||
| _NameSpace = ns; | |||
| } | |||
| public XName CName(string eleName) | |||
| { | |||
| return XName.Get(eleName, _NameSpace.NamespaceName); | |||
| } | |||
| public XElement CElement(string eleName, string value, string valName = "val") | |||
| { | |||
| return new XElement(CName(eleName), new XAttribute(XName.Get(valName), value)); | |||
| } | |||
| public XElement CElement(string eleName, params object[] eles) | |||
| { | |||
| return new XElement(CName(eleName), eles); | |||
| } | |||
| public XAttribute CAttr(string arr, string value) | |||
| { | |||
| return new XAttribute(XName.Get(arr), value); | |||
| } | |||
| public List<XAttribute> CAttrs(string attrs) | |||
| { | |||
| var list = new List<XAttribute>(); | |||
| var arr = attrs.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); | |||
| foreach (var item in arr) | |||
| { | |||
| list.Add(CAttr(item)); | |||
| } | |||
| return list; | |||
| } | |||
| public XAttribute CAttr(string kv) | |||
| { | |||
| var arr = kv.Split('='); | |||
| return CAttr(arr[0], arr[1]); | |||
| } | |||
| public readonly static XE C = new XE(DocX.c); | |||
| public readonly static XE A = new XE(DocX.a); | |||
| public readonly static XE N = new XE(DocX.n); | |||
| } | |||
| } | |||
| @@ -113,6 +113,7 @@ | |||
| <Compile Include="Src\PageLayout.cs" /> | |||
| <Compile Include="Src\Section.cs" /> | |||
| <Compile Include="Src\TableOfContents.cs" /> | |||
| <Compile Include="Src\XE.cs" /> | |||
| <Compile Include="Src\_BaseClasses.cs" /> | |||
| <Compile Include="Src\Table.cs" /> | |||
| <Compile Include="Src\_Enumerations.cs" /> | |||