Variant Class

Variant.When the object is serialized out as xml, its qualified name is vt:variant.

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlCompositeElement
      DocumentFormat.OpenXml.VariantTypes.Variant

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

Syntax

'Declaration
<ChildElementInfoAttribute(GetType(VTOStreamData))> _
<ChildElementInfoAttribute(GetType(VTUnsignedInteger))> _
<ChildElementInfoAttribute(GetType(VTClipboardData))> _
<ChildElementInfoAttribute(GetType(VTVector))> _
<ChildElementInfoAttribute(GetType(VTArray))> _
<ChildElementInfoAttribute(GetType(VTBlob))> _
<ChildElementInfoAttribute(GetType(VTOBlob))> _
<ChildElementInfoAttribute(GetType(VTEmpty))> _
<ChildElementInfoAttribute(GetType(VTNull))> _
<ChildElementInfoAttribute(GetType(VTByte))> _
<ChildElementInfoAttribute(GetType(VTShort))> _
<ChildElementInfoAttribute(GetType(VTInt32))> _
<ChildElementInfoAttribute(GetType(VTInt64))> _
<ChildElementInfoAttribute(GetType(VTInteger))> _
<ChildElementInfoAttribute(GetType(VTUnsignedByte))> _
<ChildElementInfoAttribute(GetType(VTUnsignedShort))> _
<ChildElementInfoAttribute(GetType(VTUnsignedInt32))> _
<ChildElementInfoAttribute(GetType(VTUnsignedInt64))> _
<ChildElementInfoAttribute(GetType(Variant))> _
<ChildElementInfoAttribute(GetType(VTFloat))> _
<ChildElementInfoAttribute(GetType(VTDouble))> _
<ChildElementInfoAttribute(GetType(VTDecimal))> _
<ChildElementInfoAttribute(GetType(VTLPSTR))> _
<ChildElementInfoAttribute(GetType(VTLPWSTR))> _
<ChildElementInfoAttribute(GetType(VTBString))> _
<ChildElementInfoAttribute(GetType(VTDate))> _
<ChildElementInfoAttribute(GetType(VTFileTime))> _
<ChildElementInfoAttribute(GetType(VTBool))> _
<ChildElementInfoAttribute(GetType(VTCurrency))> _
<ChildElementInfoAttribute(GetType(VTError))> _
<ChildElementInfoAttribute(GetType(VTStreamData))> _
<ChildElementInfoAttribute(GetType(VTStorage))> _
<ChildElementInfoAttribute(GetType(VTOStorage))> _
<ChildElementInfoAttribute(GetType(VTVStreamData))> _
<ChildElementInfoAttribute(GetType(VTClassId))> _
Public Class Variant _
    Inherits OpenXmlCompositeElement
'Usage
Dim instance As Variant
[ChildElementInfoAttribute(typeof(VTOStreamData))]
[ChildElementInfoAttribute(typeof(VTUnsignedInteger))]
[ChildElementInfoAttribute(typeof(VTClipboardData))]
[ChildElementInfoAttribute(typeof(VTVector))]
[ChildElementInfoAttribute(typeof(VTArray))]
[ChildElementInfoAttribute(typeof(VTBlob))]
[ChildElementInfoAttribute(typeof(VTOBlob))]
[ChildElementInfoAttribute(typeof(VTEmpty))]
[ChildElementInfoAttribute(typeof(VTNull))]
[ChildElementInfoAttribute(typeof(VTByte))]
[ChildElementInfoAttribute(typeof(VTShort))]
[ChildElementInfoAttribute(typeof(VTInt32))]
[ChildElementInfoAttribute(typeof(VTInt64))]
[ChildElementInfoAttribute(typeof(VTInteger))]
[ChildElementInfoAttribute(typeof(VTUnsignedByte))]
[ChildElementInfoAttribute(typeof(VTUnsignedShort))]
[ChildElementInfoAttribute(typeof(VTUnsignedInt32))]
[ChildElementInfoAttribute(typeof(VTUnsignedInt64))]
[ChildElementInfoAttribute(typeof(Variant))]
[ChildElementInfoAttribute(typeof(VTFloat))]
[ChildElementInfoAttribute(typeof(VTDouble))]
[ChildElementInfoAttribute(typeof(VTDecimal))]
[ChildElementInfoAttribute(typeof(VTLPSTR))]
[ChildElementInfoAttribute(typeof(VTLPWSTR))]
[ChildElementInfoAttribute(typeof(VTBString))]
[ChildElementInfoAttribute(typeof(VTDate))]
[ChildElementInfoAttribute(typeof(VTFileTime))]
[ChildElementInfoAttribute(typeof(VTBool))]
[ChildElementInfoAttribute(typeof(VTCurrency))]
[ChildElementInfoAttribute(typeof(VTError))]
[ChildElementInfoAttribute(typeof(VTStreamData))]
[ChildElementInfoAttribute(typeof(VTStorage))]
[ChildElementInfoAttribute(typeof(VTOStorage))]
[ChildElementInfoAttribute(typeof(VTVStreamData))]
[ChildElementInfoAttribute(typeof(VTClassId))]
public class Variant : OpenXmlCompositeElement

Remarks

The following table lists the possible child types:

  • Variant <vt:variant>

  • VTVector <vt:vector>

  • VTArray <vt:array>

  • VTBlob <vt:blob>

  • VTOBlob <vt:oblob>

  • VTEmpty <vt:empty>

  • VTNull <vt:null>

  • VTByte <vt:i1>

  • VTShort <vt:i2>

  • VTInt32 <vt:i4>

  • VTInt64 <vt:i8>

  • VTInteger <vt:int>

  • VTUnsignedByte <vt:ui1>

  • VTUnsignedShort <vt:ui2>

  • VTUnsignedInt32 <vt:ui4>

  • VTUnsignedInt64 <vt:ui8>

  • VTUnsignedInteger <vt:uint>

  • VTFloat <vt:r4>

  • VTDouble <vt:r8>

  • VTDecimal <vt:decimal>

  • VTLPSTR <vt:lpstr>

  • VTLPWSTR <vt:lpwstr>

  • VTBString <vt:bstr>

  • VTDate <vt:date>

  • VTFileTime <vt:filetime>

  • VTBool <vt:bool>

  • VTCurrency <vt:cy>

  • VTError <vt:error>

  • VTStreamData <vt:stream>

  • VTOStreamData <vt:ostream>

  • VTStorage <vt:storage>

  • VTOStorage <vt:ostorage>

  • VTVStreamData <vt:vstream>

  • VTClassId <vt:clsid>

  • VTClipboardData <vt:cf>

[ISO/IEC 29500-1 1st Edition]

22.4.2.32 variant (Variant)

This element can contain exactly 1 child element of any variant type. This element is only valid as a child element of a vector or array variant type.

[Example: A vector of variant types:

<vt:vector baseType="variant">
<vt:variant>
<vt:i4>12</vt:i4>
</vt:variant>
<vt:variant>
<vt:lpstr>WorkSheets</vt:lpstr>
</vt:variant>
</vt:vector>

end example]

Parent Elements

array (§22.4.2.1); variant (§22.4.2.32); vector (§22.4.2.33)

Child Elements

Subclause

array (Array)

§22.4.2.1

blob (Binary Blob)

§22.4.2.2

bool (Boolean)

§22.4.2.3

bstr (Basic String)

§22.4.2.4

clsid (Class ID)

§22.4.2.5

cy (Currency)

§22.4.2.6

date (Date and Time)

§22.4.2.7

decimal (Decimal)

§22.4.2.8

empty (Empty)

§22.4.2.9

error (Error Status Code)

§22.4.2.10

filetime (File Time)

§22.4.2.11

i1 (1-Byte Signed Integer)

§22.4.2.12

i2 (2-Byte Signed Integer)

§22.4.2.13

i4 (4-Byte Signed Integer)

§22.4.2.14

i8 (8-Byte Signed Integer)

§22.4.2.15

int (Integer)

§22.4.2.16

lpstr (LPSTR)

§22.4.2.17

lpwstr (LPWSTR)

§22.4.2.18

null (Null)

§22.4.2.19

oblob (Binary Blob Object)

§22.4.2.20

ostorage (Binary Storage Object)

§22.4.2.21

ostream (Binary Stream Object)

§22.4.2.22

r4 (4-Byte Real Number)

§22.4.2.23

r8 (8-Byte Real Number)

§22.4.2.24

storage (Binary Storage)

§22.4.2.25

stream (Binary Stream)

§22.4.2.26

ui1 (1-Byte Unsigned Integer)

§22.4.2.27

ui2 (2-Byte Unsigned Integer)

§22.4.2.28

ui4 (4-Byte Unsigned Integer)

§22.4.2.29

ui8 (8-Byte Unsigned Integer)

§22.4.2.30

uint (Unsigned Integer)

§22.4.2.31

variant (Variant)

§22.4.2.32

vector (Vector)

§22.4.2.33

vstream (Binary Versioned Stream)

§22.4.2.34

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

Variant Members

DocumentFormat.OpenXml.VariantTypes Namespace