Shape Class

Defines the Shape Class.When the object is serialized out as xml, its qualified name is dsp:sp.

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlCompositeElement
      DocumentFormat.OpenXml.Office.Drawing.Shape

Namespace:  DocumentFormat.OpenXml.Office.Drawing
Assembly:  DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)

Syntax

'Declaration
<ChildElementInfoAttribute(GetType(OfficeArtExtensionList))> _
<ChildElementInfoAttribute(GetType(TextBody))> _
<ChildElementInfoAttribute(GetType(Transform2D))> _
<ChildElementInfoAttribute(GetType(ShapeNonVisualProperties))> _
<ChildElementInfoAttribute(GetType(ShapeProperties))> _
<ChildElementInfoAttribute(GetType(ShapeStyle))> _
Public Class Shape _
    Inherits OpenXmlCompositeElement
'Usage
Dim instance As Shape
[ChildElementInfoAttribute(typeof(OfficeArtExtensionList))]
[ChildElementInfoAttribute(typeof(TextBody))]
[ChildElementInfoAttribute(typeof(Transform2D))]
[ChildElementInfoAttribute(typeof(ShapeNonVisualProperties))]
[ChildElementInfoAttribute(typeof(ShapeProperties))]
[ChildElementInfoAttribute(typeof(ShapeStyle))]
public class Shape : OpenXmlCompositeElement

Remarks

The following table lists the possible child types:

  • ShapeNonVisualProperties <dsp:nvSpPr>

  • ShapeProperties <dsp:spPr>

  • ShapeStyle <dsp:style>

  • TextBody <dsp:txBody>

  • Transform2D <dsp:txXfrm>

  • OfficeArtExtensionList <dsp:extLst>

2.5.51 CT_Shape

Target namespace: https://schemas.microsoft.com/office/drawing/2008/diagram

Referenced by: CT_GroupShape

This element specifies the existence of a single shape. A shape can either be a preset or a custom geometry, defined using the DrawingML framework. In addition to a geometry each shape can have both visual and non-visual properties attached. Text and corresponding styling information can also be attached to a shape. This shape is specified along with all other shapes within group shape elements.

Child Elements:

nvSpPr : A CT_ShapeNonVisual element that specifies non-visual shape properties associated with this shape.

spPr : A CT_ShapeProperties [ISO/IEC-29500-1] section A.4.1 element that specifies visual shape properties associated with this shape

style : A CT_ShapeStyle [ISO/IEC-29500-1] section A.4.1 element that specifies the style of the shape.

txBody : A CT_TextBody [ISO/IEC-29500-1] section A.4.1 element that specifies the shape text associated with this shape

txXfrm : A CT_Transform2D [ISO/IEC-29500-1] section A.4.1 element that specifies a 2-D transform to be applied to the text body of this shape.

extLst : A CT_OfficeArtExtensionList [ISO/IEC-29500-1] section A.4.1 element that allows for future extensions to the shape.

Attributes:

modelId : An ST_ModelId [ISO/IEC-29500-1] section 21.4.7.43 attribute that specifies the id of the DataModel element which this shape represents.

The following W3C XML Schema ([XMLSCHEMA1] section 2.1) fragment specifies the contents of this complex type.

<xsd:complexType name="CT_Shape">

<xsd:sequence>

<xsd:element name="nvSpPr" type="CT_ShapeNonVisual" minOccurs="1" maxOccurs="1"/>

<xsd:element name="spPr" type="a:CT_ShapeProperties" minOccurs="1" maxOccurs="1"/>

<xsd:element name="style" type="a:CT_ShapeStyle" minOccurs="0" maxOccurs="1"/>

<xsd:element name="txBody" type="a:CT_TextBody" minOccurs="0" maxOccurs="1"/>

<xsd:element name="txXfrm" type="a:CT_Transform2D" minOccurs="0" maxOccurs="1"/>

<xsd:element name="extLst" type="a:CT_OfficeArtExtensionList" minOccurs="0" maxOccurs="1"/>

</xsd:sequence>

<xsd:attribute name="modelId" type="d:ST_ModelId" use="required"/>

</xsd:complexType>

See section 5.8 for the full W3C XML Schema ([XMLSCHEMA1] section 2.1).

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Shape Members

DocumentFormat.OpenXml.Office.Drawing Namespace