Decimal validations error

Hi!
I create validations of decimal type in my excel. On my development platform it works fine but on my customers profuction server I get an error (“Input string was not in a correct format.”).

The error occurs when using the following line
validation.Formula1 = "0.5"

If I change it to validation.Formula1 = “1” it will work fine, but I need the “0.5”. I have tried “0,5” as you would write it in swedish locale, but thet would give me a “Invalid formula in data validation settings.” error.

I have even tried a desperate (1/2).toString with no luck.

What should I do?

I don’t find this problem.

Which version of Aspose.Excel are you using? Have you tried the latest version at

I am using the latest version.

The strange thing is that I don’t have the problem on my development machine, only on the production server on site at the customer (which I of course have no real access to…)

I will try to find out more about the settings on the server and will get back to you if I find anything interesting.

Thank you for your time!

@axpax,
Aspose.Cells is the new product that has replaced Aspose.Excel that is no more actively developed now. Different types of data validations can be implemented like whole number data validation, list data validation, date data validation, time data validation, and text length data validation. Here is an example that demonstrates the implementation of decimal validation on a cell area.

private static void DataValidation()
{
    // For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET

    // 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.Decimal;

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

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

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

    // 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
    validation.AddArea(area);


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

For more details about the implementation of validation, refer to the following article.
Data Validation

Download the latest trial version here:
A free latest trial version of this new product can be downloaded here:
Aspose.Cells for .NET (Latest Version)

A complete runnable solution is available here for testing the product features without writing any code.