Click here to Skip to main content
15,897,273 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have created empty excel with headers using EPPLUS library. Now my requirement is when content writer fill the data, the price column should be entered in decimal format else it should pop an error

What I have tried:

wsSheet1.Column(1).Style.Numberformat.Format = "#,##0.000";
Posted
Updated 7-Jul-17 3:53am

1 solution

Something like this:
var decimalValidation = worksheet.DataValidations.AddDecimalValidation("A:A");
decimalValidation.ShowErrorMessage = true;
deciamlValidation.ErrorStyle = ExcelDataValidationWarningStyle.stop;
decimalValidation.ErrorTitle = "The value you entered is not valid";
decimalValidation.Error = "This cell must be a valid positive number.";
decimalValidation.Operator = ExcelDataValidationOperator.greaterThanOrEqual;
decimalValidation.Formula.Value = 0D;

c# - How do I apply Excel data validation for text length to a column with EPPlus? - Stack Overflow[^]
EPPlus/EPPlus/DataValidation at master · pruiz/EPPlus · GitHub[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900