Ejemplo n.º 1
0
        public static CT_Shape Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_Shape ctObj = new CT_Shape();

            ctObj.macro      = XmlHelper.ReadString(node.Attribute("macro"));
            ctObj.textlink   = XmlHelper.ReadString(node.Attribute("textlink"));
            ctObj.fLocksText = XmlHelper.ReadBool(node.Attribute("fLocksText"));
            ctObj.fPublished = XmlHelper.ReadBool(node.Attribute("fPublished"));
            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "nvSpPr")
                {
                    ctObj.nvSpPr = CT_ShapeNonVisual.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "spPr")
                {
                    ctObj.spPr = CT_ShapeProperties.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "txBody")
                {
                    ctObj.txBody = CT_TextBody.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "style")
                {
                    ctObj.style = CT_ShapeStyle.Parse(childNode, namespaceManager);
                }
            }
            return(ctObj);
        }
Ejemplo n.º 2
0
        public static CT_ShapeStyle Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_ShapeStyle ctObj = new CT_ShapeStyle();

            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "lnRef")
                {
                    ctObj.lnRef = CT_StyleMatrixReference.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "fillRef")
                {
                    ctObj.fillRef = CT_StyleMatrixReference.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "effectRef")
                {
                    ctObj.effectRef = CT_StyleMatrixReference.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "fontRef")
                {
                    ctObj.fontRef = CT_FontReference.Parse(childNode, namespaceManager);
                }
            }
            return(ctObj);
        }
Ejemplo n.º 3
0
        public static CT_Picture Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_Picture ctObj = new CT_Picture();

            ctObj.macro      = XmlHelper.ReadString(node.Attribute("macro"));
            ctObj.fPublished = XmlHelper.ReadBool(node.Attribute("fPublished"));
            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "nvPicPr")
                {
                    ctObj.nvPicPr = CT_PictureNonVisual.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "blipFill")
                {
                    ctObj.blipFill = CT_BlipFillProperties.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "spPr")
                {
                    ctObj.spPr = CT_ShapeProperties.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "style")
                {
                    ctObj.style = CT_ShapeStyle.Parse(childNode, namespaceManager);
                }
            }
            return(ctObj);
        }
Ejemplo n.º 4
0
        public void Set(CT_Shape obj)
        {
            this.macroField      = obj.macro;
            this.textlinkField   = obj.textlink;
            this.fLocksTextField = obj.fLocksText;
            this.fPublishedField = obj.fPublished;

            this.nvSpPrField = obj.nvSpPr;
            this.spPrField   = obj.spPr;
            this.styleField  = obj.style;
            this.txBodyField = obj.txBody;
        }
Ejemplo n.º 5
0
        /**
         * Initialize default structure of a new auto-shape
         *
         */
        public static CT_Connector Prototype()
        {
            CT_Connector          shape = new CT_Connector();
            CT_ConnectorNonVisual nv    = shape.AddNewNvCxnSpPr();

            Npoi.Core.OpenXmlFormats.Dml.Spreadsheet.CT_NonVisualDrawingProps nvp = nv.AddNewCNvPr();
            nvp.id   = (1);
            nvp.name = ("Shape 1");
            nv.AddNewCNvCxnSpPr();

            Npoi.Core.OpenXmlFormats.Dml.Spreadsheet.CT_ShapeProperties sp = shape.AddNewSpPr();
            CT_Transform2D    t2d = sp.AddNewXfrm();
            CT_PositiveSize2D p1  = t2d.AddNewExt();

            p1.cx = (0);
            p1.cy = (0);
            CT_Point2D p2 = t2d.AddNewOff();

            p2.x = (0);
            p2.y = (0);

            CT_PresetGeometry2D geom = sp.AddNewPrstGeom();

            geom.prst = (ST_ShapeType.line);
            geom.AddNewAvLst();

            Npoi.Core.OpenXmlFormats.Dml.Spreadsheet.CT_ShapeStyle style = shape.AddNewStyle();
            CT_SchemeColor scheme = style.AddNewLnRef().AddNewSchemeClr();

            scheme.val      = (ST_SchemeColorVal.accent1);
            style.lnRef.idx = (1);

            CT_StyleMatrixReference fillref = style.AddNewFillRef();

            fillref.idx = (0);
            fillref.AddNewSchemeClr().val = (ST_SchemeColorVal.accent1);

            CT_StyleMatrixReference effectRef = style.AddNewEffectRef();

            effectRef.idx = (0);
            effectRef.AddNewSchemeClr().val = (ST_SchemeColorVal.accent1);

            CT_FontReference fontRef = style.AddNewFontRef();

            fontRef.idx = (ST_FontCollectionIndex.minor);
            fontRef.AddNewSchemeClr().val = (ST_SchemeColorVal.tx1);

            prototype = shape;

            return(prototype);
        }
Ejemplo n.º 6
0
 public CT_ShapeStyle AddNewStyle()
 {
     this.styleField = new CT_ShapeStyle();
     return(this.styleField);
 }