We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com


Does the Aspose.Excel component support MS Excel “Validation” tools? Like forcing a user to enter a date value only in a paticular cell or range of cells?

Now Aspose.Excel doesn’t supply APIs for this feature, but it supports “Validation” in designer spreadsheet. You can set data validation in your designer spreadsheet. Aspose.Excel can import it and reserve to the result file. You can have a try.

We are also thinking of supply APIs for this feature. It may be available before the end of May.

Aspose.Cells is introduced which has replaced the legacy product Aspose.Excel which is no more continued now. You may use this new product for exciting features supported by the latest versions of MS Excel. This new product also supports data validation in a variety of ways. Here is an example which demonstrates this feature:

// Create a workbook object.
Workbook workbook = new Workbook();

// Create a worksheet and get the first worksheet.
Worksheet ExcelWorkSheet = workbook.Worksheets[0];

// Accessing the Validations collection of the worksheet
ValidationCollection validations = workbook.Worksheets[0].Validations;

// Create Cell Area
CellArea ca = new CellArea();
ca.StartRow = 0;
ca.EndRow = 0;
ca.StartColumn = 0;
ca.EndColumn = 0;

// Creating a Validation object
Validation validation = validations[validations.Add(ca)];

// Setting the validation type to whole number
validation.Type = ValidationType.WholeNumber;

// Setting the operator for validation to Between
validation.Operator = OperatorType.Between;

// Setting the minimum value for the validation
validation.Formula1 = "10";

// Setting the maximum value for the validation
validation.Formula2 = "1000";

// Applying the validation to a range of cells from A1 to B2 using the
// CellArea structure
CellArea area;
area.StartRow = 0;
area.EndRow = 1;
area.StartColumn = 0;
area.EndColumn = 1;

// Adding the cell area to Validation

// Save the workbook.
workbook.Save(dataDir + "output.out.xls");

You may visit the following article which provides a list of features for data validation
Data Validation

For testing you can download the latest version here:
Aspose.Cells for .NET (Latest Version)

A detailed project containing ready to run examples can be downloaded here.