Export (0) Print
Expand All

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 w:contentPart.

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

public class ContentPart : OpenXmlLeafElement

[ISO/IEC 29500-1 1st Edition]

contentPart (Content Part)

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

  • MathML (http://www.w3.org/TR/MathML2/)

  • SMIL (http://www.w3.org/TR/REC-smil/)

  • SVG (http://www.w3.org/TR/SVG11/)

end note]

The relationship type of the explicit relationship specified by this element shall be http://schemas.openxmlformats.org/officeDocument/2006/customXml 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.

[Example: Consider a WordprocessingML document which includes the following MathML markup in a part named math1.xml:

<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML">
      <mml:mfenced separators="|">

The Main Document Part would reference this content as follows:

  …  <w:p>
      <w:contentPart r:id="rId8" />

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

<Relationships … >
  …  <Relationship Id="rId8" TargetMode="Internal" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml" Target="math1.xml" />

The corresponding relationship part item shows that the file to be imported is located next to the main document and is named math1.xml. end example]

Parent Elements

r (§; r (§



id (Relationship to Part)

Namespace: .../officeDocument/2006/relationships

Specifies the relationship ID to a specified part.

The specified relationship shall match the relationship type required by the parent element:

  • http://schemas.openxmlformats.org/officeDocument/2006/customXml for the contentPart element

  • http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer for the footerReference element

  • http://schemas.openxmlformats.org/officeDocument/2006/relationships/header for the headerReference element

  • http://schemas.openxmlformats.org/officeDocument/2006/relationships/font for the embedBold, embedBoldItalic, embedItalic, or embedRegular elements

  • http://schemas.openxmlformats.org/officeDocument/2006/relationships/printerSettings for the printerSettings element

  • http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink for the longDesc or hyperlink element

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

<… r:id="rId10" />

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.1. end note]

© ISO/IEC29500: 2008.

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