/** * * @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); }
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 }); }
/** * 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); }
/// <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); }
/** * * @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; }
/** * 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; }
/** * Sets the parent graphic frame. */ protected void SetGraphicFrame(XSSFGraphicFrame frame) { this.frame = frame; }
/** * Sets the parent graphic frame. */ internal void SetGraphicFrame(XSSFGraphicFrame frame) { this.frame = frame; }