Get Cell Validation in ODS Files

Get Cell Validation in ODS Files

With Aspose.Cells, you can get the validation applied to a cell in ODS files. For this, the API provides the GetValidation method of the Cell class.

The following code sample demonstrates the use of the GetValidation method by loading the source ODS file and reading the validation of the cell A9.

Sample Code

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
//Source directory
string sourceDir = RunExamples.Get_SourceDirectory();
//Load source Excel file
Workbook workbook = new Workbook(sourceDir + "SampleBook1.ods");
//Access first worksheet
Worksheet worksheet = workbook.Worksheets[0];
Cell cell = worksheet.Cells["A9"];
if (cell.GetValidation() != null)
{
Console.WriteLine(cell.GetValidation().Type);
}