Skip to main content

XlDataValidation.Ranges Property

Provides access to the collection of cell ranges to which the data validation rule is applied.

Namespace: DevExpress.Export.Xl

Assembly: DevExpress.Printing.v23.2.Core.dll

NuGet Package: DevExpress.Printing.Core

Declaration

public IList<XlCellRange> Ranges { get; }

Property Value

Type Description
IList<XlCellRange>

A IList<XlCellRange> object representing the list of cell ranges.

Remarks

The code sample below shows how to create a data validation rule:

// Apply data validation to cells.
// Restrict data entry in the range A2:A5 to a 5-digit number.
XlDataValidation validation = new XlDataValidation();
validation.Ranges.Add(XlCellRange.FromLTRB(0, 1, 0, 4));
validation.Type = XlDataValidationType.Custom;
validation.Criteria1 = "=AND(ISNUMBER(A2),LEN(A2)=5)";
// Add the specified rule to the worksheet collection of data validation rules.
sheet.DataValidations.Add(validation);
See Also