Message-ID: <480138567.8999.1711671342933.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_8998_425002127.1711671342933" ------=_Part_8998_425002127.1711671342933 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html DataValidation

DataValidation

Description

=20

A DataValidation object rep= resents a rule for validating data entered in cells. The rule may be applie= d to a cell or a set of cells. The Workb= ook class contains several CreateDataValidation methods for creating DataValidat= ion objects. To apply a DataValidation object to a cell= or group of cells, use Area.SetDataValidation or Range.SetDataValidation.

=20
C#
=20
 public sealed class DataValidation
=20
=20
vb.net
=20
Public NotInheritable Class DataValidation
=20
=20

Remarks

In Microsoft Excel, data val= idation rules are created through the=20 Data Validation dialog. To open this dialog, open the=20 Data menu and select=20 Validation.=20

Examples

=20
C#
=20

          ExcelApplication xlw =3D new ExcelApplication();
          Workbook wb =3D xlw.Create();

          //--- Create a data validation rule:
          DataValidation dv =3D wb.CreateDataValidation(
               DataValidation.ValidationType.WholeNumber,
               DataValidation.ComparisonType.Between,
               "=3D1", "=3D100");
          String formula =3D "Sheet1!A2:F33 Sheet2!A5:D15";

          //--- Apply the rule to a Range:
          wb.CreateRange(formula).SetDataValidation(dv);
        
=20
=20
vb.net
=20

          Dim xlw As New ExcelApplication()
          Dim wb As Workbook =3D xlw.Create()

          '--- Create a data validation rule:
          Dim dv As DataValidation =3D wb.CreateDataValidation( _
               DataValidation.ValidationType.WholeNumber, _
               DataValidation.ComparisonType.Between, _
               "=3D1", "=3D100")
          Dim formula As String =3D "Sheet1!A2:F33 Sheet2!A5:D15"

          '--- Apply the rule to a Range:
          wb.CreateRange(formula).SetDataValidation(dv)
        
=20
=20

Properties

=20
=20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20

Name

Description

AllowedType

Returns the type of value that may be entered in= a cell.

Comparison

Returns the type of comparison that will be used= to validate a value entered in a cell with a data validation rule.

ErrorAlert

Sets or returns the content of the error alert m= essage displayed when invalid data is entered in a cell.

ErrorAlertStyle

Sets or returns the style of error alert to disp= lay if error alerts are enabled.

ErrorAlertTitle

Sets or returns the title of the error alert dia= log that is displayed when invalid data is entered in a cell.

IgnoreBlanks

Sets or returns whether the data validation rule= should ignore blank cells.

InputMessage

Sets or returns the content of the input message= dialog that is displayed when the user selects a cell with a data validati= on rule.

MinimumValue

Sets or returns the minimum value that may be en= tered in a cell with a data validation rule.

MaximumValue

Sets or returns the maximum value that may be en= tered in a cell with a data validation rule.

ShowErrorAlert

Sets or returns whether Excel should display an = error alert if invalid data is entered.

ShowInputMessage

Sets or returns whether to show a message when t= he user selects a cell to which a data validation rule applies.

Title

Sets or returns the title of the input message d= ialog that is displayed when the user selects a cell with a data validation= rule.

UseListDropdown

Sets or returns whether a drop-down list will be= used to display valid values.
=20

Methods

=20
=20 =20 =20 =20 =20 =20 =20 =20 =20 = =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20

Name

Description

Clear()

Sets all properties of the DataValidation object to an uninitialized state.=20

SetAllowedType(ValidationType, ComparisonType, Object)

Sets the allowed data type, comparison type, and= minimum value to use when validating a cell entry.

SetAllowedType(ValidationType, ComparisonType, Object, Object)

Sets the allowed data type, comparison type, and= minimum and maximum values to use when validating a cell entry.

SetAllowedType(ValidationType, Object)

Sets the allowed data type and a set of valid va= lues to use when validating a cell entry.
=20

Nested Classes

=20
=20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 = =20 =20

Name

Description

ComparisonType

The type of comparison that will be used for val= idating the value of the cell.

ErrorAlertStyleType

Type style of the icon in the error alert messag= e box.

ValidationType

The data type allowed as the cell's value.
------=_Part_8998_425002127.1711671342933--