Пример #1
0
        public static CT_GroupShape Parse(XmlNode node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_GroupShape ctObj = new CT_GroupShape();

            foreach (XmlNode childNode in node.ChildNodes)
            {
                if (childNode.LocalName == "nvGrpSpPr")
                {
                    ctObj.nvGrpSpPr = CT_GroupShapeNonVisual.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "grpSpPr")
                {
                    ctObj.grpSpPr = CT_GroupShapeProperties.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "pic")
                {
                    var pic = CT_Picture.Parse(childNode, namespaceManager);
                    ctObj.pictures.Add(pic);
                }
                else if (childNode.LocalName == "sp")
                {
                    var shape = CT_Shape.Parse(childNode, namespaceManager);
                    ctObj.shapes.Add(shape);
                }
            }
            return(ctObj);
        }
Пример #2
0
        public static CT_Shape Parse(XmlNode node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_Shape ctObj = new CT_Shape();

            ctObj.macro      = XmlHelper.ReadString(node.Attributes["macro"]);
            ctObj.textlink   = XmlHelper.ReadString(node.Attributes["textlink"]);
            ctObj.fLocksText = XmlHelper.ReadBool(node.Attributes["fLocksText"]);
            ctObj.fPublished = XmlHelper.ReadBool(node.Attributes["fPublished"]);
            foreach (XmlNode childNode in node.ChildNodes)
            {
                if (childNode.LocalName == "nvSpPr")
                {
                    ctObj.nvSpPr = CT_ShapeNonVisual.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "spPr")
                {
                    ctObj.spPr = CT_ShapeProperties.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "txBody")
                {
                    ctObj.txBody = CT_TextBody.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "style")
                {
                    ctObj.style = CT_ShapeStyle.Parse(childNode, namespaceManager);
                }
            }
            return(ctObj);
        }
Пример #3
0
        public CT_Shape AddNewSp()
        {
            var shapeField = new CT_Shape();

            shapes.Add(shapeField);
            return(shapeField);
        }
Пример #4
0
        /**
         * Prototype with the default structure of a new auto-shape.
         */
        internal static CT_Shape Prototype()
        {
                CT_Shape shape = new CT_Shape();


                CT_ShapeNonVisual nv = shape.AddNewNvSpPr();
                NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_NonVisualDrawingProps nvp = nv.AddNewCNvPr();
                nvp.id = (1);
                nvp.name = ("Shape 1");
                nv.AddNewCNvSpPr();

                NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_ShapeProperties sp = shape.AddNewSpPr();
                NPOI.OpenXmlFormats.Dml.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.rect);
                geom.AddNewAvLst();

                NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_ShapeStyle style = shape.AddNewStyle();
                CT_SchemeColor scheme = style.AddNewLnRef().AddNewSchemeClr();
                scheme.val = (ST_SchemeColorVal.accent1);
                scheme.AddNewShade().val = 50000;
                style.lnRef.idx = (2);

                CT_StyleMatrixReference Fillref = style.AddNewFillRef();
                Fillref.idx = (1);
                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.lt1);

                NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_TextBody body = shape.AddNewTxBody();
                CT_TextBodyProperties bodypr = body.AddNewBodyPr();
                bodypr.anchor = (ST_TextAnchoringType.ctr);
                bodypr.rtlCol = (false);
                CT_TextParagraph p = body.AddNewP();

                p.AddNewPPr().algn = (ST_TextAlignType.ctr);
                CT_TextCharacterProperties endPr = p.AddNewEndParaRPr();
                endPr.lang = ("en-US");
                endPr.sz = (1100);

                body.AddNewLstStyle();

                prototype = shape;
            
            return prototype;
        }
Пример #5
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;
        }
Пример #6
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;
        }
Пример #7
0
        public ITextbox CreateTextbox(IClientAnchor anchor)
        {
            long num = this.newShapeId();

            NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_Shape ctShape = this.CreateTwoCellAnchor(anchor).AddNewSp();
            ctShape.Set(XSSFSimpleShape.Prototype());
            ctShape.nvSpPr.cNvPr.id = (uint)num;
            XSSFTextBox xssfTextBox = new XSSFTextBox(this, ctShape);

            xssfTextBox.anchor = (XSSFAnchor)anchor;
            return((ITextbox)xssfTextBox);
        }
Пример #8
0
        public XSSFSimpleShape CreateSimpleShape(XSSFClientAnchor anchor)
        {
            long num = this.newShapeId();

            NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_Shape ctShape = this.CreateTwoCellAnchor((IClientAnchor)anchor).AddNewSp();
            ctShape.Set(XSSFSimpleShape.Prototype());
            ctShape.nvSpPr.cNvPr.id = (uint)num;
            XSSFSimpleShape xssfSimpleShape = new XSSFSimpleShape(this, ctShape);

            xssfSimpleShape.anchor = (XSSFAnchor)anchor;
            return(xssfSimpleShape);
        }
Пример #9
0
 public static CT_Shape Parse(XmlNode node, XmlNamespaceManager namespaceManager)
 {
     if (node == null)
         return null;
     CT_Shape ctObj = new CT_Shape();
     ctObj.macro = XmlHelper.ReadString(node.Attributes["macro"]);
     ctObj.textlink = XmlHelper.ReadString(node.Attributes["textlink"]);
     ctObj.fLocksText = XmlHelper.ReadBool(node.Attributes["fLocksText"]);
     ctObj.fPublished = XmlHelper.ReadBool(node.Attributes["fPublished"]);
     foreach (XmlNode childNode in node.ChildNodes)
     {
         if (childNode.LocalName == "nvSpPr")
             ctObj.nvSpPr = CT_ShapeNonVisual.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "spPr")
             ctObj.spPr = CT_ShapeProperties.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "txBody")
             ctObj.txBody = CT_TextBody.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "style")
             ctObj.style = CT_ShapeStyle.Parse(childNode, namespaceManager);
     }
     return ctObj;
 }
Пример #10
0
 public CT_Shape AddNewSp()
 {
     shapeField = new CT_Shape();
     return shapeField;
 }
Пример #11
0
 public CT_Shape AddNewSp()
 {
     shapeField = new CT_Shape();
     return(shapeField);
 }
Пример #12
0
        internal XSSFTextBox(XSSFDrawing drawing, CT_Shape ctShape)
            : base(drawing, ctShape)
        {

        }
Пример #13
0
 public XSSFSimpleShape(XSSFDrawing drawing, XmlNode spNode)
 {
     this.drawing = drawing;
     this.ctShape = CT_Shape.Parse(spNode, null);
 }
Пример #14
0
 public XSSFSimpleShape(XSSFDrawing drawing, CT_Shape ctShape)
 {
     this.drawing = drawing;
     this.ctShape = ctShape;
 }
Пример #15
0
 public abstract bool Fetch(CT_Shape props);
Пример #16
0
 internal XSSFCheckBox(XSSFDrawing drawing, CT_Shape ctShape, NPOI.OpenXmlFormats.Vml.CT_Shape vmlShape, XSSFCtrlProp ctrlProp)
     : base(drawing, ctShape)
 {
     _vmlShape = vmlShape;
     _ctrlProp = ctrlProp;
 }