2

Closed

Cell's DataValidation

description

Cell's data validation doesn't correspond:

var wb = new XLWorkbook();
var ws = wb.Worksheets.Add("People");

ws.FirstCell().SetValue("Categories")
.CellBelow().SetValue("A")
.CellBelow().SetValue("B")
.CellBelow().SetValue("")
.CellBelow().SetValue("D");

var table = ws.RangeUsed().CreateTable();

var dv = table.DataRange.DataValidation;
dv.TextLength.GreaterThan(0);
dv.ErrorTitle = "Error";

foreach (var c in table.DataRange.Cells(c => c.HasDataValidation))
{
Console.WriteLine(String.Format("Cell({0}) = '{1}' ErrorTitle: {2}",
c.Address.ToStringRelative(),
c.GetString(),
c.DataValidation.ErrorTitle));
}

Console.ReadKey();

No files are attached

Closed Apr 3 at 4:20 AM by MDeLeon

Fixed on v0.65.0


comments

MDeLeon wrote Mar 24 at 5:24 AM

Lukasz, the data validations are copied correctly over when you insert rows/columns. Give it a try and let me know.

zherve, are you using the latest source code? (I can't reproduce it with the latest code)

Thank you guys for your patience.

zherve wrote Mar 23 at 1:50 PM

the cell's data validation is blank even when there is datavalidation errors

MDeLeon wrote Mar 21 at 5:12 AM

The formulas now shift when copied but I still need to shift the data validation formulas when you insert/delete rows/columns. If all you're doing is copying cells then this check-in should satisfy.

LukaszCzekaj wrote Mar 19 at 10:48 AM

I apologize, maybe I didn't explain the issue precise enough.
I have a cell (e.g. A2) with data validation as this: Allow: List, Source: "=IF(A1=1;DDL_LIST1;DDL_LIST2)"
If I copy this cell to B2 the data validation source remains =IF(A1=1;...
But it should be =IF(B1=1;...
As it works with regular formulas while copying them.
That's the last thing that's holding me back...

MDeLeon wrote Mar 17 at 6:07 AM

Alright, here's how it works now: If you copy a worksheet then the references will target the new sheet. If you copy a range or a cell then the reference will target the original sheet. I think this is the most natural way of handling it.

LukaszCzekaj wrote Mar 16 at 3:30 PM

I'm sorry, one small detail left.
When I copy a cell with data validation and this DV has formula in it, the cell references in DV's formula do not shift accordingly. Could you please fix this?

LukaszCzekaj wrote Mar 16 at 10:49 AM

Works flawlessly, great job. Thank you so much and have a great weekend, Manuel!

MDeLeon wrote Mar 16 at 4:48 AM

/wave hand ...these are not the bugs you're looking for...

Pick up the latest code and let me know.

LukaszCzekaj wrote Mar 13 at 11:28 AM

It's almost fixed ;)
Now I can see the dropdown icon at the right of the cell but this data validation has an empty formula and dropdown button does nothing. It doesn't expand the list because the Formula1 is not copied to the datavalidation for this cell.

MDeLeon wrote Mar 11 at 3:08 AM

Pick up the latest check-in...

LukaszCzekaj wrote Feb 24 at 2:12 PM

I've got similar problem, added new comment to my closed issue: http://closedxml.codeplex.com/workitem/7681