ContentPart Class

Defines the ContentPart Class.This class is only available in Office2010.When the object is serialized out as xml, its qualified name is p:contentPart.

Inheritance Hierarchy


Namespace:  DocumentFormat.OpenXml.Presentation
Assembly:  DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)


<ChildElementInfoAttribute(GetType(NonVisualContentPartProperties), FileFormatVersions.Office2010)> _
<ChildElementInfoAttribute(GetType(Transform2D), FileFormatVersions.Office2010)> _
<OfficeAvailabilityAttribute(FileFormatVersions.Office2010)> _
<ChildElementInfoAttribute(GetType(ExtensionListModify), FileFormatVersions.Office2010)> _
Public Class ContentPart _
    Inherits OpenXmlCompositeElement
Dim instance As ContentPart
[ChildElementInfoAttribute(typeof(NonVisualContentPartProperties), FileFormatVersions.Office2010)]
[ChildElementInfoAttribute(typeof(Transform2D), FileFormatVersions.Office2010)]
[ChildElementInfoAttribute(typeof(ExtensionListModify), FileFormatVersions.Office2010)]
public class ContentPart : OpenXmlCompositeElement


The following table lists the possible child types:

  • DocumentFormat.OpenXml.Office2010.PowerPoint.NonVisualContentPartProperties <p14:nvContentPartPr>

  • DocumentFormat.OpenXml.Office2010.PowerPoint.Transform2D <p14:xfrm>

  • DocumentFormat.OpenXml.Office2010.PowerPoint.ExtensionListModify <p14:extLst>

[ISO/IEC 29500-1 1st Edition] contentPart (Content Part)

This element specifies a reference to XML content in a format not defined by ISO/IEC 29500. [Note: This part allows the native use of other commonly used interchange formats, such as:

end note]

The relationship type of the explicit relationship specified by this element shall be and have a TargetMode attribute value of Internal. If an application cannot process content of the content type specified by the targeted part, then it should continue to process the file. If possible, it should also provide some indication that unknown content was not imported.

[Note: For better interoperability, only standard XML formats should be used. end note]

[Example: Consider a PresentationML document which includes the following SMIL markup in a part named smil1.xml:

            Copyright: Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
Author: Aaron Cohen (Intel)
           Version: February 7, 2001
            Module: Animation Module
           Feature: animation
         File Name: animation-add-BE-05.smil
  Media Components: none
 Expected Behavior: Nine red rectangles numbered 1 to 9 shrink to squares
                    over 2s as follows:
                    at 2s #1 shrinks.
                    at 5s #2 shrinks, 1s after #1 completes
                    at 8s #3 shrinks.
                    #4 shrinks when it is clicked on.
                    #5 shrinks 1s after it is clicked on.
                    #6 shrinks 2s after it is clicked on.
                    #7 shrinks when the accesskey '1' is pressed.
                    #8 should be shrunk from 0s since it's wallclock time is in the past.
                    #9 will not shrink unless a DOM call causes it to begin.
<smil xmlns="">
      <root-layout width="640" height="480" backgroundColor="white"/>
      <region id="whole" width="640" height="480" z-index="0"/>
      <region id="rect1" top="50px" left="90px" height="50px" width="30px" backgroundColor="red" z-index="1"/>
      <region id="rect2" top="50px" left="234px" height="50px" width="30px" backgroundColor="red" z-index="1"/>
      <region id="rect4" top="160px" left="90px" height="50px" width="30px" backgroundColor="transparent" z-index="1"/>
      <region id="rect5" top="160px" left="234px" height="50px" width="30px" backgroundColor="transparent" z-index="1"/>
      <region id="rect6" top="160px" left="380px" height="50px" width="30px" backgroundColor="transparent" z-index="1"/>
      <region id="rect7" top="270px" left="90px" height="50px" width="30px" backgroundColor="red" z-index="1"/>
      <region id="rect8" top="270px" left="234px" height="50px" width="30px" backgroundColor="red" z-index="1"/>
      <region id="rect9" top="270px" left="380px" height="50px" width="30px" backgroundColor="red" z-index="1"/>
<!-- Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
See -->
    <par dur="indefinite">
      <img src="../images/animation-timing-BE-05.jpg" region="whole"/>
      <animate id="anim1" targetElement="rect1" attributeName="height" from="50" to="25" begin="2s" dur="2s" fill="freeze"/>
      <animate id="anim2" targetElement="rect2" attributeName="height" from="50" to="25" begin="anim1.end+1s" dur="2s" fill="freeze"/>
      <brush id="brush4" color="red" region="rect4" height="50px" width="30px"/>
      <animate id="anim4" targetElement="brush4" attributeName="height" from="50" to="25" begin="brush4.activateEvent" dur="2s" fill="freeze"/>
      <brush id="brush5" color="red" region="rect5" height="50px" width="30px"/>
      <animate id="anim5" targetElement="brush5" attributeName="height" from="50" to="25" begin="brush5.activateEvent+1s" dur="2s" fill="freeze"/>
      <brush id="brush6" color="red" region="rect6" height="50px" width="30px"/>
      <animate id="anim6a" targetElement="brush6" attributeName="width" repeatCount="3" from="30" to="30" begin="brush6.activateEvent" dur="1s" fill="freeze"/>
      <animate id="anim6b" targetElement="brush6" attributeName="height" from="50" to="25" begin="anim6a.repeat(2)" dur="2s" fill="freeze"/>
      <animate id="anim7" targetElement="rect7" attributeName="height" from="50" to="25" begin="accesskey(1)" dur="2s" fill="freeze"/>
      <animate id="anim8" targetElement="rect8" attributeName="height" from="50" to="25" begin="wallclock(2000-01-01T00:00:00Z)" dur="2s" fill="freeze"/>
      <animate id="anim9" targetElement="rect9" attributeName="width" from="30" to="30" begin="indefinite" dur="1s" fill="freeze"/>

A Slide Part would reference this content as follows:

<p:contentPart r:id="smil01"/>

The contentPart element specifies that the content targeted by the relationship with an ID of smil01 is part of the PresentationML document. Examining the contents of the corresponding relationship part item, we can see the targets for that relationship:

<Relationships … >
<Relationship Id="smil01" TargetMode="Internal" Type="" Target="smil1.xml" />

The corresponding relationship part item shows that the SMIL content is located next to the slide and is named smil1.xml. end example]

Parent Elements

grpSp (§; spTree (§



id (Relationship to Part)

Namespace: .../officeDocument/2006/relationships

Specifies the relationship ID to a content part.

[Example: Consider an XML element which has the following id attribute:

<… r:id="rId1" />

The markup specifies the associated relationship part with relationship ID rId1 contains the corresponding relationship information for the parent XML element. end example]

The possible values for this attribute are defined by the ST_RelationshipId simple type (§

[Note: The W3C XML Schema definition of this element’s content model (CT_Rel) is located in §A.3. end note]

© ISO/IEC29500: 2008.

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


ContentPart Members

DocumentFormat.OpenXml.Presentation Namespace