Compartilhar via


DataValidation Class

Data Validation.When the object is serialized out as xml, its qualified name is x:dataValidation.

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlCompositeElement
      DocumentFormat.OpenXml.Spreadsheet.DataValidation

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

Syntax

'Declaration
<ChildElementInfoAttribute(GetType(Formula1))> _
<ChildElementInfoAttribute(GetType(Formula2))> _
Public Class DataValidation _
    Inherits OpenXmlCompositeElement
'Usage
Dim instance As DataValidation
[ChildElementInfoAttribute(typeof(Formula1))]
[ChildElementInfoAttribute(typeof(Formula2))]
public class DataValidation : OpenXmlCompositeElement

Remarks

The following table lists the possible child types:

  • Formula1 <x:formula1>

  • Formula2 <x:formula2>

[ISO/IEC 29500-1 1st Edition]

18.3.1.32 dataValidation (Data Validation)

A single item of data validation defined on a range of the worksheet.

Parent Elements

dataValidations (§18.3.1.33)

Child Elements

Subclause

formula1 (Formula 1)

§18.3.1.44

formula2 (Formula 2)

§18.3.1.45

Attributes

Description

allowBlank (Allow Blank)

A boolean value indicating whether the data validation allows the use of empty or blank entries. '1' means empty entries are OK and do not violate the validation constraints.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

error (Error Message)

Message text of error alert.

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

errorStyle (Data Validation Error Style)

The style of error alert used for this data validation.

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

errorTitle (Error Alert Text)

Title bar text of error alert.

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

imeMode (IME Mode Enforced)

The IME (input method editor) mode enforced by this data validation. Only applies for these languages:

  • Chinese Simplified

  • Chinese Traditional

  • Japanese

  • Korean

  • When imeMode is set, the input for the cell can be restricted to specific sets of characters, as specified by the value of imeMode. See the simple type referenced below for additional details.

When imeMode is set but the application's language is not one of the languages listed above, then the default value is noControl.

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

operator (Operator)

The relational operator used with this data validation.

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

prompt (Input Prompt)

Message text of input prompt.

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

promptTitle (Prompt Title)

Title bar text of input prompt.

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

showDropDown (Show Drop Down)

A boolean value indicating whether to display a dropdown combo box for a list type data validation.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

showErrorMessage (Show Error Message)

A boolean value indicating whether to display the error alert message when an invalid value has been entered, according to the criteria specified.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

showInputMessage (Show Input Message)

A boolean value indicating whether to display the input prompt message.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

sqref (Sequence of References)

Range over which data validation is applied.

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

type (Data Validation Type)

The type of data validation.

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

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

DataValidation Members

DocumentFormat.OpenXml.Spreadsheet Namespace