'Declaration
Public Class DataValidation
'Usage
Dim instance As DataValidation
public class DataValidation
'Declaration
Public Class DataValidation
'Usage
Dim instance As DataValidation
public class DataValidation
DataValidation validation0= new DataValidation( ValidationType.WholeNumber, new DataValidationRangeCondition( RangeConditionType.Between, -100, 100 ) ); DataValidation validation1 = DataValidation.Create( ValidationType.TextLength, new DataValidationRangeCondition( RangeConditionType.Between, 5, 10 ) ); DataValidation validation2= DataValidation.Create( ValidationType.WholeNumber, new DataValidationSingleCondition( SingleConditionType.Equal, 6 ) ); //Changes the validation condition validation0.Condition = new DataValidationSingleCondition( SingleConditionType.GreaterThan, 7 ) );
using( var workbook = Workbook.Create( "AddDataValidation.xlsx" ) ) { // Gets the first Worksheet; a Workbook always contains at least 1 Worksheet. var worksheet = workbook.Worksheets[ 0 ]; // Creates a new DataValidation and assigns it to Cells A1 to A3. var dataValidation = new DataValidation( ValidationType.Decimal, DataComparisonType.LessThanOrEqual ) { Value = 10 }; dataValidation.SetError( "My Error", "Value must under 10", DataValidationErrorStyle.Warning ); worksheet.Cells[ "A1", "A3" ].DataValidation = dataValidation; // Saves Workbook to disk; workbook.Save(); }
System.Object
Xceed.Workbooks.NET.DataValidation
Name | Description | |
---|---|---|
![]() | DataValidation Constructor | Creates a DataValidation based on a ValidationType & a DataValidationCondition. |
Name | Description | |
---|---|---|
![]() | Error | |
![]() | InputMessage |
Name | Description | |
---|---|---|
![]() | Condition | Gets or sets the DataValidationCondition. |
![]() | IgnoreBlank | Gets or sets if the DataValidation ignores blank Cells. |
![]() | InCellDropdown | Gets or sets if the Cell contains a drop-down menu offering choices that can be used for DataValidation. |
![]() | Type | Gets the ValidationType. |
Name | Description | |
---|---|---|
![]() | AddAreas | Adds a DataValidation in specific areas of the Worksheet. |
![]() | Clone | |
![]() ![]() | Create | Creates a new DataValidation. |
![]() | Equals | Overloaded. |
![]() | GetHashCode | |
![]() | SetError | Sets an error message. |
![]() | SetInputMessage | Sets the message that will be displayed when the user selects or hovers over the target Cell(s). |
Target Platforms: Windows 11, Windows 10, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2