共用方式為


CustomXmlAttribute Class

Custom XML Attribute.When the object is serialized out as xml, its qualified name is w:attr.

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlLeafElement
      DocumentFormat.OpenXml.Wordprocessing.CustomXmlAttribute

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

Syntax

'Declaration
Public Class CustomXmlAttribute _
    Inherits OpenXmlLeafElement
'Usage
Dim instance As CustomXmlAttribute
public class CustomXmlAttribute : OpenXmlLeafElement

Remarks

[ISO/IEC 29500-1 1st Edition]

17.5.1.1 attr (Custom XML Attribute)

This element specifies a custom XML attribute which shall be located on the parent custom XML element specified via the customXml element (§17.5.1.4;§17.5.1.5;§17.5.1.3; §17.5.1.6). The attributes on this element shall be used to specify the contents of the custom XML attribute.

[Example: Consider a custom XML element with the following properties:

<w:customXmlPr>
<w:attr w:name="companyName" … />
<w:attr w:name="companySymbol" … />
</w:customXmPr>

This property bag specifies that the parent custom XML element must have two attributes associated with it, he first with a name of companyName, and the second with a name of companySymbol. end example]

Parent Elements

customXmlPr (§17.5.1.7)

Attributes

Description

name (Name)

Specifies the name of the current custom XML attribute or smart tag property.

[Example: Consider a custom XML attribute which must have a name of companyName. This requirement would be specified using the following WordprocessingML:

<w:customXmlPr>
<w:attr w:name="companyName" … />
</w:customXmlPr>

The name attribute specifies that the name for this property must be companyName. end example]

The possible values for this attribute are defined by the ST_String simple type (§22.9.2.13).

uri (Namespace)

Specifies the namespace URI of the current custom XML attribute or smart tag property.

If this attribute is omitted, the URI shall be assumed to be null (no associated URI).

[Example: Consider a smart tag property which must have a namespace URI of https://schemas.openxmlformats.org/2006/example. This requirement would be specified using the following WordprocessingML:

<w:smartTagPr>
<w:attr w:uri="http://schemas.openxmlformats
.org/2006/example" … />
</w:smartTagPr>

The uri attribute specifies that the namespace for this property must be https://schemas.openxmlformats.org/2006/example. end example]

The possible values for this attribute are defined by the ST_String simple type (§22.9.2.13).

val (Value)

Specifies the value of the current custom XML attribute or smart tag property.

[Example: Consider a smart tag property which must have a value of propertyValue. This requirement would be specified using the following WordprocessingML:

<w:smartTagPr>
<w:attr … w:val="propertyValue" />
</w:smartTagPr>

The val attribute specifies that the value for this property must be propertyValue. end example]

The possible values for this attribute are defined by the ST_String simple type (§22.9.2.13).

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

[ISO/IEC 29500-1 1st Edition]

17.5.1.2 attr (Smart Tag Property)

This element specifies a single smart tag property which shall be located on the parent smart tag, specified via the smartTag element (§17.5.1.9). The attributes on this element shall be used to specify the contents of smart tag property.

[Example: Consider a smart tag with the following properties:

<w:smartTagPr>
<w:attr w:name="attributeOne" … />
<w:attr w:name="attributeTwo" … />
</w:smartTagPr>

This property bag specifies that the parent smart tag must have two properties associated with it, the first with a name of attributeOne, and the second with a name of attributeTwo. end example].

Parent Elements

smartTagPr (§17.5.1.10)

Attributes

Description

name (Name)

Specifies the name of the current custom XML attribute or smart tag property.

[Example: Consider a custom XML attribute which must have a name of companyName. This requirement would be specified using the following WordprocessingML:

<w:customXmlPr>
<w:attr w:name="companyName" … />
</w:customXmlPr>

The name attribute specifies that the name for this property must be companyName. end example]

The possible values for this attribute are defined by the ST_String simple type (§22.9.2.13).

uri (Namespace)

Specifies the namespace URI of the current custom XML attribute or smart tag property.

If this attribute is omitted, the URI shall be assumed to be null (no associated URI).

[Example: Consider a smart tag property which must have a namespace URI of https://schemas.openxmlformats.org/2006/example. This requirement would be specified using the following WordprocessingML:

<w:smartTagPr>
<w:attr w:uri="http://schemas.openxmlformats
.org/2006/example" … />
</w:smartTagPr>

The uri attribute specifies that the namespace for this property must be https://schemas.openxmlformats.org/2006/example. end example]

The possible values for this attribute are defined by the ST_String simple type (§22.9.2.13).

val (Value)

Specifies the value of the current custom XML attribute or smart tag property.

[Example: Consider a smart tag property which must have a value of propertyValue. This requirement would be specified using the following WordprocessingML:

<w:smartTagPr>
<w:attr … w:val="propertyValue" />
</w:smartTagPr>

The val attribute specifies that the value for this property must be propertyValue. end example]

The possible values for this attribute are defined by the ST_String simple type (§22.9.2.13).

[Note: The W3C XML Schema definition of this element’s content model (CT_Attr) is located in §A.1. 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

Reference

CustomXmlAttribute Members

DocumentFormat.OpenXml.Wordprocessing Namespace