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.
Inheritance Hierarchy
System.Object
DocumentFormat.OpenXml.OpenXmlElement
DocumentFormat.OpenXml.OpenXmlLeafElement
DocumentFormat.OpenXml.Wordprocessing.ContentPart
Namespace: DocumentFormat.OpenXml.Wordprocessing
Assembly: DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)
Syntax
'Декларация
<OfficeAvailabilityAttribute(FileFormatVersions.Office2010)> _
Public Class ContentPart _
Inherits OpenXmlLeafElement
'Применение
Dim instance As ContentPart
[OfficeAvailabilityAttribute(FileFormatVersions.Office2010)]
public class ContentPart : OpenXmlLeafElement
Remarks
[ISO/IEC 29500-1 редакция 1]
17.3.3.2 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:
MathML (http://www.w3.org/TR/MathML2/)
end note]
The relationship type of the explicit relationship specified by this element shall be https://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:mi>r</mml:mi>
<mml:mo>=</mml:mo>
<mml:msup>
<mml:mrow>
<mml:mfenced separators="|">
<mml:mrow>
<mml:mi>V</mml:mi>
<mml:mfrac>
<mml:mrow>
<mml:mn>3</mml:mn>
</mml:mrow>
<mml:mrow>
<mml:mn>4</mml:mn>
<mml:mi>?</mml:mi>
</mml:mrow>
</mml:mfrac>
</mml:mrow>
</mml:mfenced>
</mml:mrow>
<mml:mrow>
<mml:mfrac>
<mml:mrow>
<mml:mn>1</mml:mn>
</mml:mrow>
<mml:mrow>
<mml:mn>3</mml:mn>
</mml:mrow>
</mml:mfrac>
</mml:mrow>
</mml:msup>
</mml:math>
The Main Document Part would reference this content as follows:
<w:body>
…
<w:p>
<w:r>
<w:contentPart r:id="rId8" />
</w:r>
</w:p>
…
</w:body>
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="https://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml" Target="math1.xml" />
…
</Relationships>
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 (§22.1.2.87); r (§17.3.2.25) |
Attributes |
Description |
---|---|
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:
[Example: Consider an XML element which has the following id attribute:
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 (§22.8.2.1). |
[Note: The W3C XML Schema definition of this element's content model (CT_Rel) is located in §A.1. end note]
© ISO/IEC29500: 2008. Приведенный выше текст переведен с английского языка на русский корпорацией Майкрософт (или ее подрядчиками) и ISO не несет ответственности за эти переводы.
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.