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

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlCompositeElement
      DocumentFormat.OpenXml.Drawing.Spreadsheet.ContentPart

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

Syntax

声明
<ChildElementInfoAttribute(GetType(Transform2D), FileFormatVersions.Office2010)> _
<ChildElementInfoAttribute(GetType(ExcelNonVisualContentPartProperties), FileFormatVersions.Office2010)> _
<ChildElementInfoAttribute(GetType(ExcelNonVisualContentPartShapeProperties), FileFormatVersions.Office2010)> _
<ChildElementInfoAttribute(GetType(ApplicationNonVisualDrawingProperties), FileFormatVersions.Office2010)> _
<ChildElementInfoAttribute(GetType(OfficeArtExtensionList), FileFormatVersions.Office2010)> _
<OfficeAvailabilityAttribute(FileFormatVersions.Office2010)> _
Public Class ContentPart _
    Inherits OpenXmlCompositeElement
用法
Dim instance As ContentPart
[ChildElementInfoAttribute(typeof(Transform2D), FileFormatVersions.Office2010)]
[ChildElementInfoAttribute(typeof(ExcelNonVisualContentPartProperties), FileFormatVersions.Office2010)]
[ChildElementInfoAttribute(typeof(ExcelNonVisualContentPartShapeProperties), FileFormatVersions.Office2010)]
[ChildElementInfoAttribute(typeof(ApplicationNonVisualDrawingProperties), FileFormatVersions.Office2010)]
[ChildElementInfoAttribute(typeof(OfficeArtExtensionList), FileFormatVersions.Office2010)]
[OfficeAvailabilityAttribute(FileFormatVersions.Office2010)]
public class ContentPart : OpenXmlCompositeElement

Remarks

The following table lists the possible child types:

  • DocumentFormat.OpenXml.Office2010.Excel.Drawing.ExcelNonVisualContentPartProperties <xdr14:nvContentPr>

  • DocumentFormat.OpenXml.Office2010.Excel.Drawing.ExcelNonVisualContentPartShapeProperties <xdr14:nvContentPartPr>

  • DocumentFormat.OpenXml.Office2010.Excel.Drawing.ApplicationNonVisualDrawingProperties <xdr14:nvPr>

  • DocumentFormat.OpenXml.Office2010.Excel.Drawing.Transform2D <xdr14:xfrm>

  • DocumentFormat.OpenXml.Office2010.Excel.Drawing.OfficeArtExtensionList <xdr14:extLst>

[ISO/IEC 29500-1 第 1 个版本]

20.5.2.12 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 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 SpreadsheetML document which includes the following SVG markup in a part named svg1.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!--======================================================================-->
<!--=  Copyright 2000 World Wide Web Consortium, (Massachusetts          =-->
<!--=  Institute of Technology, Institut National de Recherche en        =-->
<!--=  Informatique et en Automatique, Keio University). All Rights      =-->
<!--=  Reserved. See http://www.w3.org/Consortium/Legal/.                =-->
<!--======================================================================-->
<!-- =====================================================================-->
<!--                                                                     -->
<!-- color-datatypes-BE-01.svg                                           -->
<!-- renamed for 1.1 suite to color-prop-02-f.svg                        -->
<!--                                                                     -->
<!-- Author : Chris Lilley,  12-Aug-2000                                 -->
<!--          1.1 revision by Rick Graham                                -->
<!--          Revised for SVGT/B: Benoit Bezaire Jul/02/2002             -->
<!--          More revision  CL  -->
<!--======================================================================-->
<svg version="1.1" baseProfile="full" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg-root" width="100%" height="100%" viewBox="0 0 480 360">
  <title id="test-title">color-prop-02-f.svg</title>
  <desc id="test-desc">Test that viewer has the basic capability to render X11colors, using any of the equivalent forms.</desc>
  <!--================================================================-->
  <!--Content of Test Case follows…                  ===============-->
  <!--================================================================-->
  <g id="test-body-content">
    <!-- groups of five colors  -->
    <g>
      <circle cx="75" cy="40" r="20" fill="crimson"/>
      <circle cx="115" cy="40" r="20" fill="#DC143C"/>
      <circle cx="75" cy="80" r="20" fill="rgb(220,20,60)"/>
      <circle cx="115" cy="80" r="20" fill="rgb(86.274509803921568627450980392157%,7.8431372549019607843137254901961%,23.529411764705882352941176470588%)"/>
    </g>
    <g>
      <circle cx="200" cy="40" r="20" fill="palegreen"/>
      <circle cx="240" cy="40" r="20" fill="#98FB98"/>
      <circle cx="200" cy="80" r="20" fill="rgb(152, 251, 152)"/>
      <circle cx="240" cy="80" r="20" fill="rgb(59.60784313725490196078431372549%,98.431372549019607843137254901961%,59.60784313725490196078431372549%)"/>
    </g>
    <g>
      <circle cx="325" cy="40" r="20" fill="royalblue"/>
      <circle cx="365" cy="40" r="20" fill="#4169E1"/>
      <circle cx="325" cy="80" r="20" fill="rgb(65, 105, 225)"/>
      <circle cx="365" cy="80" r="20" fill="rgb(25.490196078431372549019607843137%,41.176470588235294117647058823529%,88.235294117647058823529411764706%)"/>
    </g>
    <g>
      <circle cx="75" cy="135" r="20" fill="firebrick"/>
      <circle cx="115" cy="135" r="20" fill="#B22222"/>
      <circle cx="75" cy="175" r="20" fill="rgb(178,34,34)"/>
      <circle cx="115" cy="175" r="20" fill="rgb(69.803921568627450980392156862745%,13.333333333333333333333333333333%,13.333333333333333333333333333333%)"/>
    </g>
    <g>
      <circle cx="200" cy="135" r="20" fill="seagreen"/>
      <circle cx="240" cy="135" r="20" fill="#2E8B57"/>
      <circle cx="200" cy="175" r="20" fill="rgb(46, 139, 87)"/>
      <circle cx="240" cy="175" r="20" fill="rgb(18.039215686274509803921568627451%,54.509803921568627450980392156863%,34.117647058823529411764705882353%)"/>
    </g>
    <g>
      <circle cx="325" cy="135" r="20" fill="mediumblue"/>
      <circle cx="365" cy="135" r="20" fill="#0000CD"/>
      <circle cx="325" cy="175" r="20" fill="rgb(0, 0, 205)"/>
      <circle cx="365" cy="175" r="20" fill="rgb(0%,0%,80.39215686274509803921568627451%)"/>
    </g>
    <g>
      <circle cx="75" cy="230" r="20" fill="indianred"/>
      <circle cx="115" cy="230" r="20" fill="#CD5C5C"/>
      <circle cx="75" cy="270" r="20" fill="rgb(205, 92, 92)"/>
      <circle cx="115" cy="270" r="20" fill="rgb(80.39215686274509803921568627451%,36.078431372549019607843137254902%,36.078431372549019607843137254902%)"/>
    </g>
    <g>
      <circle cx="200" cy="230" r="20" fill="lawngreen"/>
      <circle cx="240" cy="230" r="20" fill="#7CFC00"/>
      <circle cx="200" cy="270" r="20" fill="rgb(124, 252, 0)"/>
      <circle cx="240" cy="270" r="20" fill="rgb(48.627450980392156862745098039216%,98.823529411764705882352941176471%,0%)"/>
    </g>
    <g>
      <circle cx="325" cy="230" r="20" fill="mediumturquoise"/>
      <circle cx="365" cy="230" r="20" fill="#48D1CC"/>
      <circle cx="325" cy="270" r="20" fill="rgb(72, 209, 204)"/>
      <circle cx="365" cy="270" r="20" fill="rgb(28.235294117647058823529411764706%,81.960784313725490196078431372549%,80%)"/>
    </g>
  </g>
  <text id="revision" x="10" y="340" font-size="40" stroke="none" fill="black">$Revision: 1.6 $</text>
  <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/>
</svg>

The SpreadsheetML Drawing part would reference this content as follows:

<wsDr>
<twoCellAnchor>
<from>
      <col>3</col> 
      <colOff>152400</colOff> 
      <row>5</row> 
      <rowOff>123825</rowOff> 
    </from>
    <to>
      <col>8</col> 
      <colOff>266700</colOff> 
      <row>22</row> 
      <rowOff>38100</rowOff> 
    </to>
</twoCellAnchor>
<contentPart r:id="svg1"/>
</wsDr>

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

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

The corresponding relationship part item shows that the file to be imported is named svg1.xml. end example]

Parent Elements

absoluteAnchor (§20.5.2.1); oneCellAnchor (§20.5.2.24); twoCellAnchor (§20.5.2.33)

Attributes

Description

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 (§22.8.2.1).

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

© ISO/IEC29500: 2008. 以上摘要已经由 Microsoft(和/或其代理公司)从英语翻译为简体中文,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.

See Also

Reference

ContentPart Members

DocumentFormat.OpenXml.Drawing.Spreadsheet Namespace