Ejemplo n.º 1
0
        public static BoundaryProperties ParseXmlNode(XElement Node)
        {
            BoundaryProperties b = new BoundaryProperties();

            IEnumerable <XAttribute> attrCol = Node.Attributes();

            foreach (XAttribute item in attrCol)
            {
                switch (item.Name.LocalName)
                {
                case Constants.COLOR:
                    b.Color = item.Value;
                    break;

                case Constants.FONTFAMILIY:
                    b.FontFamiliy = item.Value;
                    break;

                case Constants.FONTSIZE:
                    b.FontSize = item.Value;
                    break;

                case Constants.FONTSYTLE:
                    b.FontStyle = item.Value;
                    break;

                case Constants.FONTWEIGHT:
                    b.FontWeight = item.Value;
                    break;

                case Constants.TEXTDECORATION:
                    b.TextDecoration = item.Value;
                    break;

                case Constants.SHAPECLASS:
                    b.ShapeClass = item.Value;
                    break;

                case Constants.FILL:
                    b.Fill = item.Value;
                    break;

                default:
                    break;
                }
            }
            return(b);
        }
Ejemplo n.º 2
0
        public static XElement CreateXmlNode(XNamespace Ns, BoundaryProperties B)
        {
            XElement el = new XElement(Constants.BOUNDARYPROPERTIES);

            XNamespace nsFormat = "fo";
            XNamespace nsSVG    = "svg";

            /*Font Attributes*/
            if (String.IsNullOrEmpty(B.FontFamiliy))
            {
                el.Add(new XAttribute(nsFormat + Constants.FONTFAMILIY, B.FontFamiliy));
            }
            if (String.IsNullOrEmpty(B.FontSize))
            {
                el.Add(new XAttribute(nsFormat + Constants.FONTSIZE, B.FontSize));
            }
            if (String.IsNullOrEmpty(B.FontStyle))
            {
                el.Add(new XAttribute(nsFormat + Constants.FONTSYTLE, B.FontStyle));
            }
            if (String.IsNullOrEmpty(B.FontWeight))
            {
                el.Add(new XAttribute(nsFormat + Constants.FONTWEIGHT, B.FontWeight));
            }
            if (String.IsNullOrEmpty(B.TextDecoration))
            {
                el.Add(new XAttribute(nsFormat + Constants.FONTWEIGHT, B.TextDecoration));
            }

            /*Line Attributes*/
            if (String.IsNullOrEmpty(B.LineColor))
            {
                el.Add(new XAttribute(Constants.LINECOLOR, B.LineColor));
            }
            if (String.IsNullOrEmpty(B.LinePattern))
            {
                el.Add(new XAttribute(Constants.LINEPATTERN, B.LinePattern));
            }
            if (String.IsNullOrEmpty(B.Linetapered))
            {
                el.Add(new XAttribute(Constants.LINETAPERED, B.Linetapered));
            }
            if (String.IsNullOrEmpty(B.LineWidth))
            {
                el.Add(new XAttribute(Constants.LINEWIDHT, B.LineWidth));
            }
            if (String.IsNullOrEmpty(B.LineClass))
            {
                el.Add(new XAttribute(Constants.LINECLASS, B.LineClass));
            }

            if (String.IsNullOrEmpty(B.ShapeClass))
            {
                el.Add(new XAttribute(Constants.SHAPECLASS, B.ShapeClass));
            }

            if (String.IsNullOrEmpty(B.Fill))
            {
                el.Add(new XAttribute(nsSVG + Constants.FILL, B.Fill));
            }

            return(el);
        }