Free Support Forum - aspose.com

Validation using Numeric number

hi

i need help regarding ASPOSE Excel generator Validation while dealing with numeric numbers.

I am using Dot Net 2.0 with it

The following function code i am using ...

objExcel.ExcelWorkSheet.Cells[i + 1, 13].Style.Custom = "0.0"; // Date column is in this Format

objExcel.ExcelValidationForDecimal(0, 6000, 8, 13);

The problem is when i enter in the cell as 1/2 then instead of prompting an error it evaluates and displays 0.5 in the cell.

can any one help me out with problem.

Regards

Nikhil


This message was posted using Aspose.Live 2 Forum

Hi Nikhil,

Since you are using older Aspose.Cells version 3.7.

I think you may upgrade to the lastest version 4.4.0.0 and refer to the link: http://www.aspose.com/Wiki/default.aspx/Aspose.Cells/DataFilteringAndValidation.html

to specify how to implement validations.

If you still find the problem, please give us the complete details and post your template file with sample code here. And by the way our component works in the same way as excel, Did you check to implement your task manually in MS Excel?

Thank you.

Hi

I would like to repeat my question and it is no where related to Version .

I simply need a function or method to validate a Decimal type value for a cell in ASPOSE.dll

wainting for reply

Nikhil Choudhary

Hi Nikhil,

Thanks for considering Aspose.

I am not fully aware of your need. What type of decimal validation you want to implement, I mean what is your Formula1 and Formula2 and Operator attributes. lastest Aspose.Cells works in the same way as MS Excel. Please check: http://www.aspose.com/Wiki/default.aspx/Aspose.Cells/DataFilteringAndValidation.html#Decimal

And for your info, if you enter 1/2 value into a cell and if the cell is formatted as "0.0" the value would be formatted as 0.5 obviously. You may check it MS Excel.

If you still find problems to implement Decimal validations, please create your desired validation in MS Excel and post your template excel file here. We will tell you how to mimic this result using Aspose.Cells APIs.

Thank you.

Hi

Can i have cell using ASPOSE and restrict entries to digit 0 to 9 and a deciamal , the type of cell should be text

regards

Nikhil

Hi Nikhal,

Here is the code:

Workbook workbook = new Workbook();
Worksheet ExcelWorkSheet = workbook.Worksheets[0];
Validations validations = ExcelWorkSheet.Validations;
Validation validation = validations[validations.Add()];
validation.Type = Aspose.Cells.ValidationType.Decimal;
validation.Operator = OperatorType.Between;
validation.Formula1 = "0";
validation.Formula2 = "9";
validation.ErrorMessage = "Please enter a valid integer or decimal number";
CellArea area;
area.StartRow = 0;
area.EndRow = 9;
area.StartColumn = 0;
area.EndColumn = 0;
validation.AreaList.Add(area);
workbook.Save("d:\\test\\decimal_validations.xls");
Thank you.

Hi Nikhil,

I have discussed this issue with you through MSN. So I think we can close this issue now.