コード例 #1
0
ファイル: XSSFDrawing.cs プロジェクト: flowbywind/npoi
        /**
         *
         * @return list of shapes in this drawing
         */
        public List <XSSFShape> GetShapes()
        {
            List <XSSFShape> lst = new List <XSSFShape>();

            foreach (IEG_Anchor anchor in drawing.CellAnchors)
            {
                XSSFShape shape = null;
                if (anchor.picture != null)
                {
                    shape = new XSSFPicture(this, anchor.picture);
                }
                else if (anchor.connector != null)
                {
                    shape = new XSSFConnector(this, anchor.connector);
                }
                else if (anchor.groupShape != null)
                {
                    shape = new XSSFShapeGroup(this, anchor.groupShape);
                }
                else if (anchor.graphicFrame != null)
                {
                    shape = new XSSFGraphicFrame(this, anchor.graphicFrame);
                }
                else if (anchor.sp != null)
                {
                    shape = new XSSFSimpleShape(this, anchor.sp);
                }
                if (shape != null)
                {
                    shape.anchor = GetAnchorFromIEGAnchor(anchor);
                    lst.Add(shape);
                }
            }
            //foreach (XmlNode obj in xmldoc.SelectNodes("./*/*/*"))
            //{
            //    XSSFShape shape = null;
            //    if (obj.LocalName == "sp")
            //    {
            //        shape = new XSSFSimpleShape(this, obj);
            //    }
            //    else if (obj.LocalName == "pic")
            //    {
            //        shape = new XSSFPicture(this, obj);
            //    }
            //    else if (obj.LocalName == "cxnSp")
            //    {
            //        shape = new XSSFConnector(this, obj);
            //    }
            //    //    else if (obj is CT_GraphicalObjectFrame) shape = new XSSFGraphicFrame(this, (CT_GraphicalObjectFrame)obj);
            //    //    else if (obj is CT_GroupShape) shape = new XSSFShapeGroup(this, (CT_GroupShape)obj);
            //    if (shape != null)
            //    {
            //        shape.anchor = GetAnchorFromParent(obj);
            //        lst.Add(shape);
            //    }
            //}
            return(lst);
        }
コード例 #2
0
        private XSSFGraphicFrame CreateGraphicFrame(XSSFClientAnchor anchor)
        {
            CT_GraphicalObjectFrame ctGraphicFrame = this.CreateTwoCellAnchor((IClientAnchor)anchor).AddNewGraphicFrame();

            ctGraphicFrame.Set(XSSFGraphicFrame.Prototype());
            long num = this.numOfGraphicFrames++;

            return(new XSSFGraphicFrame(this, ctGraphicFrame)
            {
                Anchor = anchor, Id = num, Name = "Diagramm" + (object)num
            });
        }
コード例 #3
0
ファイル: XSSFDrawing.cs プロジェクト: flowbywind/npoi
        /**
         * Creates a new graphic frame.
         *
         * @param anchor    the client anchor describes how this frame is attached
         *                  to the sheet
         * @return  the newly Created graphic frame
         */
        private XSSFGraphicFrame CreateGraphicFrame(XSSFClientAnchor anchor)
        {
            CT_TwoCellAnchor        ctAnchor       = CreateTwoCellAnchor(anchor);
            CT_GraphicalObjectFrame ctGraphicFrame = ctAnchor.AddNewGraphicFrame();

            ctGraphicFrame.Set(XSSFGraphicFrame.Prototype());

            long             frameId      = numOfGraphicFrames++;
            XSSFGraphicFrame graphicFrame = new XSSFGraphicFrame(this, ctGraphicFrame);

            graphicFrame.Anchor = anchor;
            graphicFrame.Id     = frameId;
            graphicFrame.Name   = "Diagramm" + frameId;
            return(graphicFrame);
        }
コード例 #4
0
ファイル: XSSFDrawing.cs プロジェクト: flowbywind/npoi
        /// <summary>
        /// Creates a chart.
        /// </summary>
        /// <param name="anchor">the client anchor describes how this chart is attached to</param>
        /// <returns>the newly created chart</returns>
        public IChart CreateChart(IClientAnchor anchor)
        {
            int chartNumber = GetPackagePart().Package.
                              GetPartsByContentType(XSSFRelation.CHART.ContentType).Count + 1;

            XSSFChart chart = (XSSFChart)CreateRelationship(
                XSSFRelation.CHART, XSSFFactory.GetInstance(), chartNumber);
            String chartRelId = chart.GetPackageRelationship().Id;

            XSSFGraphicFrame frame = CreateGraphicFrame((XSSFClientAnchor)anchor);

            frame.SetChart(chart, chartRelId);

            return(chart);
        }
コード例 #5
0
ファイル: XSSFDrawing.cs プロジェクト: newlysoft/npoi
    /**
 *
 * @return list of shapes in this drawing
 */
    public List<XSSFShape> GetShapes()
    {
        List<XSSFShape> lst = new List<XSSFShape>();
        foreach (IEG_Anchor anchor in drawing.CellAnchors)
        {
            XSSFShape shape = null;
            if (anchor.picture != null)
            {
                shape = new XSSFPicture(this, anchor.picture);
            }
            else if (anchor.connector != null)
            {
                shape = new XSSFConnector(this, anchor.connector);
            }
            else if (anchor.groupShape != null)
            {
                shape = new XSSFShapeGroup(this, anchor.groupShape);
            }
            else if (anchor.graphicFrame != null)
            {
                shape = new XSSFGraphicFrame(this, anchor.graphicFrame);
            }
            else if (anchor.sp != null)
            {
               shape = new XSSFSimpleShape(this, anchor.sp);
            }
            if (shape != null)
            {
                shape.anchor = GetAnchorFromIEGAnchor(anchor);
                lst.Add(shape);
            }
        }
        //foreach (XmlNode obj in xmldoc.SelectNodes("./*/*/*"))
        //{
        //    XSSFShape shape = null;
        //    if (obj.LocalName == "sp")
        //    {
        //        shape = new XSSFSimpleShape(this, obj);
        //    }
        //    else if (obj.LocalName == "pic")
        //    {
        //        shape = new XSSFPicture(this, obj);
        //    }
        //    else if (obj.LocalName == "cxnSp")
        //    {
        //        shape = new XSSFConnector(this, obj);
        //    }
        //    //    else if (obj is CT_GraphicalObjectFrame) shape = new XSSFGraphicFrame(this, (CT_GraphicalObjectFrame)obj);
        //    //    else if (obj is CT_GroupShape) shape = new XSSFShapeGroup(this, (CT_GroupShape)obj);
        //    if (shape != null)
        //    {
        //        shape.anchor = GetAnchorFromParent(obj);
        //        lst.Add(shape);
        //    }
        //}
        return lst;
    }
コード例 #6
0
ファイル: XSSFDrawing.cs プロジェクト: newlysoft/npoi
        /**
         * Creates a new graphic frame.
         *
         * @param anchor    the client anchor describes how this frame is attached
         *                  to the sheet
         * @return  the newly Created graphic frame
         */
        private XSSFGraphicFrame CreateGraphicFrame(XSSFClientAnchor anchor)
        {
            CT_TwoCellAnchor ctAnchor = CreateTwoCellAnchor(anchor);
            CT_GraphicalObjectFrame ctGraphicFrame = ctAnchor.AddNewGraphicFrame();
            ctGraphicFrame.Set(XSSFGraphicFrame.Prototype());

            long frameId = numOfGraphicFrames++;
            XSSFGraphicFrame graphicFrame = new XSSFGraphicFrame(this, ctGraphicFrame);
            graphicFrame.Anchor = anchor;
            graphicFrame.Id = frameId;
            graphicFrame.Name = "Diagramm" + frameId;
            return graphicFrame;
        }
コード例 #7
0
 /**
  * Sets the parent graphic frame.
  */
 protected void SetGraphicFrame(XSSFGraphicFrame frame)
 {
     this.frame = frame;
 }
コード例 #8
0
ファイル: XSSFChart.cs プロジェクト: eatage/npoi
 /**
  * Sets the parent graphic frame.
  */
 internal void SetGraphicFrame(XSSFGraphicFrame frame)
 {
     this.frame = frame;
 }
コード例 #9
0
ファイル: XSSFChart.cs プロジェクト: piaoye2019/npoi
 /**
  * Sets the parent graphic frame.
  */
 internal void SetGraphicFrame(XSSFGraphicFrame frame)
 {
     this.frame = frame;
 }
コード例 #10
0
ファイル: XSSFChart.cs プロジェクト: xoposhiy/npoi
 /**
  * Sets the parent graphic frame.
  */
 protected void SetGraphicFrame(XSSFGraphicFrame frame)
 {
     this.frame = frame;
 }