public static bool TryCreateVisual(IOpenXmlVisualContainer container, OpenXmlElement element, out IOpenXmlVisual visual)
        {
            switch (element)
            {
            case Shape shape:
                visual = new OpenXmlShapeVisual(container, shape);
                return(true);

            case GraphicFrame graphicFrame:
                return(TryCreateGraphicFrameVisual(container, graphicFrame, out visual));

            case GroupShape groupShape:
                visual = new OpenXmlGroupShapeVisual(container, groupShape);
                return(true);

            case Picture picture:
                visual = new OpenXmlPictureVisual(container, picture);
                return(true);

            case ConnectionShape connectionShape:
                visual = new OpenXmlConnectionVisual(container, connectionShape);
                return(true);

            default:
                visual = null;
                return(false);
            }
        }
Exemple #2
0
 public OpenXmlChartVisual(IOpenXmlVisualContainer container, GraphicFrame graphicFrame) :
     base(container, graphicFrame)
 {
     this.chart = this.graphicFrame
                  .GetFirstChild <Drawing.Graphic>()
                  .GetFirstChild <Drawing.GraphicData>()
                  .GetFirstChild <Charts.Chart>();
 }
Exemple #3
0
 public OpenXmlTableVisual(IOpenXmlVisualContainer container, GraphicFrame graphicFrame) :
     base(container, graphicFrame)
 {
     this.table = this.graphicFrame
                  .GetFirstChild <Drawing.Graphic>()
                  .GetFirstChild <Drawing.GraphicData>()
                  .GetFirstChild <Drawing.Table>();
 }
        private static bool TryCreateGraphicFrameVisual(IOpenXmlVisualContainer container, GraphicFrame graphicFrame, out IOpenXmlVisual visual)
        {
            string uri = graphicFrame.Graphic?.GraphicData?.Uri?.Value;

            switch (uri)
            {
            case "http://schemas.openxmlformats.org/drawingml/2006/chart":
                visual = new OpenXmlChartVisual(container, graphicFrame);
                return(true);

            case "http://schemas.openxmlformats.org/drawingml/2006/table":
                visual = new OpenXmlTableVisual(container, graphicFrame);
                return(true);

            default:
                visual = new OpenXmlGenericGraphicFrameVisual(container, graphicFrame);
                return(true);
            }
        }
 public OpenXmlGroupShapeVisual(IOpenXmlVisualContainer container, GroupShape groupShape)
 {
     this.container  = container;
     this.groupShape = groupShape;
 }
 public OpenXmlConnectionVisual(IOpenXmlVisualContainer container, ConnectionShape connectionShape)
 {
     this.container       = container;
     this.connectionShape = connectionShape;
 }
Exemple #7
0
 public OpenXmlShapeVisual(IOpenXmlVisualContainer container, Shape shape)
 {
     this.container = container;
     this.shape     = shape;
 }
Exemple #8
0
 public OpenXmlGraphicFrameVisual(IOpenXmlVisualContainer container, GraphicFrame graphicFrame)
 {
     this.container    = container;
     this.graphicFrame = graphicFrame;
 }
 public OpenXmlShapeTree(IOpenXmlVisualContainer container, ShapeTree shapeTree)
 {
     this.container = container;
     this.shapeTree = shapeTree;
 }
Exemple #10
0
 public OpenXmlPictureVisual(IOpenXmlVisualContainer container, Picture picture)
 {
     this.container = container;
     this.picture   = picture;
 }
 public OpenXmlGenericGraphicFrameVisual(IOpenXmlVisualContainer container, GraphicFrame graphicFrame) :
     base(container, graphicFrame)
 {
 }