Class ValidationCollection
Contents
[
Hide
]ValidationCollection class
Represents data validation collection.
public class ValidationCollection : CollectionBase<Validation>
Properties
| Name | Description |
|---|---|
| Capacity { get; set; } | |
| Count { get; } | |
| Item { get; } | Gets the Validation element at the specified index. |
| Item { get; set; } |
Methods
| Name | Description |
|---|---|
| Add() | (Obsolete.) Adds a data validation to the collection. |
| Add(CellArea) | Adds a data validation to the collection. |
| BinarySearch(Validation) | |
| BinarySearch(Validation, IComparer<Validation>) | |
| BinarySearch(int, int, Validation, IComparer<Validation>) | |
| Clear() | |
| Contains(Validation) | |
| CopyTo(Validation[]) | |
| CopyTo(Validation[], int) | |
| CopyTo(int, Validation[], int, int) | |
| Exists(Predicate<Validation>) | |
| Find(Predicate<Validation>) | |
| FindAll(Predicate<Validation>) | |
| FindIndex(Predicate<Validation>) | |
| FindIndex(int, Predicate<Validation>) | |
| FindIndex(int, int, Predicate<Validation>) | |
| FindLast(Predicate<Validation>) | |
| FindLastIndex(Predicate<Validation>) | |
| FindLastIndex(int, Predicate<Validation>) | |
| FindLastIndex(int, int, Predicate<Validation>) | |
| GetEnumerator() | |
| GetValidationInCell(int, int) | Gets the validation applied to given cell. |
| IndexOf(Validation) | |
| IndexOf(Validation, int) | |
| IndexOf(Validation, int, int) | |
| LastIndexOf(Validation) | |
| LastIndexOf(Validation, int) | |
| LastIndexOf(Validation, int, int) | |
| RemoveACell(int, int) | Removes all validation setting on the cell. |
| RemoveArea(CellArea) | Removes all validation setting on the range.. |
| RemoveAt(int) |
Examples
namespace AsposeCellsExamples
{
using Aspose.Cells;
using System;
public class ValidationCollectionDemo
{
public static void ValidationCollectionExample()
{
// Create a new workbook
Workbook workbook = new Workbook();
// Access the first worksheet
Worksheet worksheet = workbook.Worksheets[0];
// Access the validation collection of the worksheet
ValidationCollection validations = worksheet.Validations;
// Define a cell area for the validation
CellArea area = CellArea.CreateCellArea(0, 0, 1, 1);
// Add a validation to the collection
int validationIndex = validations.Add(area);
Validation validation = validations[validationIndex];
// Set validation properties
validation.Type = ValidationType.List;
validation.Formula1 = "a,b,c,d";
// Save the workbook
workbook.Save("ValidationCollectionExample.xlsx");
return;
}
}
}
See Also
- class CollectionBase<T>
- class Validation
- namespace Aspose.Cells
- assembly Aspose.Cells