You may simply change the cell area fields’ values accordingly for your desired column where you need to apply data validation. See the following sample code that will create cell area based on whole B column.
e.g Sample code:
.....
CellArea area = new CellArea();
area.StartRow = 0;
area.EndRow = 1048575;
area.StartColumn = 1;
area.EndColumn = 1;
I evaluated it further and found the above line is the culprit line. Actually MS Excel does not allow to enter maximum formula/value in scientific notations so it will give error, see the screenshot (sc_shot1.png (24.2 KB)
) for your reference. The above line will insert scientific notations in the maximum field. Even if you save to XLS, it will not work although you do not find any error when opening the file into MS Excel manually. Please enter correct value in numbers (and not in scientific notations), e.g validation.setFormula2("999999");
it will work fine.
Should you have any further queries or other issue, feel free to write us back.
PS. We will correct the sample code in the document soon.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.