This project has moved and is read-only. For the latest updates, please go here.

dataValidations

Feb 3, 2011 at 4:11 PM

Hi,

great project, just tried it and it works just great, but I'm really missing to manipulate "dataValidations" on the sheet. Is this something that is coming?

Feb 3, 2011 at 4:27 PM
Edited Feb 4, 2011 at 4:13 AM

That doesn't look too hard to implement, I'll work on it tonight.

Update: It's easy enough but it'll take longer than I thought. I can't work on it this weekend so it'll probably be ready next week.

Feb 4, 2011 at 8:58 AM

Wow, that's really great!!!

Is it possible to make a donation to your project? If it is, I will talk to my boss to see if it is possible!

best regards J

Feb 4, 2011 at 5:00 PM

No problem, I would take it as an incentive to work on this feature. Just send me a PM and we'll work it out.

Thanks for the help.

Feb 12, 2011 at 7:13 AM

I'm almost done with the data validation. The main parts are in place but I still need to polish the rough edges.

In its simples form you'll be able to set the data validation like this:

ws.Range("A1:B2").DataValidation.WholeNumber.Between(1, 5);

Of course, you'll also have more options like:

            var dataValidation = ws.Range("A1:B2").DataValidation;
            dataValidation.WholeNumber.Between(1, 5);
            dataValidation.ErrorStyle = XLErrorStyle.Warning;
            dataValidation.ErrorTitle = "Number out of range";
            dataValidation.ErrorMessage = "Please enter a number between 1 and 5";

Feb 14, 2011 at 6:26 AM

Added data validation on v0.45, please see the Data Validation example in the documentation page.

Thanks for the feedback.

Feb 23, 2011 at 5:16 PM

It works very nice!

I just wonder if it is possible to generate validations that are used on multiple ranges, like this:

<dataValidations count="1"><dataValidation type="list" allowBlank="1" showInputMessage="1" showErrorMessage="1" sqref="B2 C3"><formula1>$A$1:$A$2</formula1></dataValidation></dataValidations>

Where B2 and C3 is using the the same validation without having a range spanning B2:C3 or having multiple dataValidation-tags.

Possibly with ws.Ranges(...).DataValidation(...)?

The above xml is from excel 2007 where you copy a validation from one cell to another.

BR/Jonas

Feb 23, 2011 at 5:31 PM

I didn't even know you could do that. I'll put it in...

Feb 23, 2011 at 5:33 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.