예제 #1
0
        public static CT_LineEndProperties Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_LineEndProperties ctObj = new CT_LineEndProperties();

            if (node.Attribute("type") != null)
            {
                ctObj.type = (ST_LineEndType)Enum.Parse(typeof(ST_LineEndType), node.Attribute("type").Value);
            }
            if (node.Attribute("w") != null)
            {
                ctObj.w = (ST_LineEndWidth)Enum.Parse(typeof(ST_LineEndWidth), node.Attribute("w").Value);
            }
            if (node.Attribute("len") != null)
            {
                ctObj.len = (ST_LineEndLength)Enum.Parse(typeof(ST_LineEndLength), node.Attribute("len").Value);
            }
            return(ctObj);
        }
예제 #2
0
        public static CT_LineProperties Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_LineProperties ctObj = new CT_LineProperties();

            ctObj.w = XmlHelper.ReadInt(node.Attribute("w"));
            if (node.Attribute("cap") != null)
            {
                ctObj.cap = (ST_LineCap)Enum.Parse(typeof(ST_LineCap), node.Attribute("cap").Value);
            }
            if (node.Attribute("cmpd") != null)
            {
                ctObj.cmpd = (ST_CompoundLine)Enum.Parse(typeof(ST_CompoundLine), node.Attribute("cmpd").Value);
            }
            if (node.Attribute("algn") != null)
            {
                ctObj.algn = (ST_PenAlignment)Enum.Parse(typeof(ST_PenAlignment), node.Attribute("algn").Value);
            }
            ctObj.custDash = new List <CT_DashStop>();
            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "noFill")
                {
                    ctObj.noFill = new CT_NoFillProperties();
                }
                else if (childNode.Name.LocalName == "solidFill")
                {
                    ctObj.solidFill = CT_SolidColorFillProperties.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "gradFill")
                {
                    ctObj.gradFill = CT_GradientFillProperties.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "pattFill")
                {
                    ctObj.pattFill = CT_PatternFillProperties.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "prstDash")
                {
                    ctObj.prstDash = CT_PresetLineDashProperties.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "round")
                {
                    ctObj.round = new CT_LineJoinRound();
                }
                else if (childNode.Name.LocalName == "bevel")
                {
                    ctObj.bevel = new CT_LineJoinBevel();
                }
                else if (childNode.Name.LocalName == "miter")
                {
                    ctObj.miter = CT_LineJoinMiterProperties.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "headEnd")
                {
                    ctObj.headEnd = CT_LineEndProperties.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "tailEnd")
                {
                    ctObj.tailEnd = CT_LineEndProperties.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "extLst")
                {
                    ctObj.extLst = CT_OfficeArtExtensionList.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "custDash")
                {
                    ctObj.custDash.Add(CT_DashStop.Parse(childNode, namespaceManager));
                }
            }
            return(ctObj);
        }