You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 9, 2020. It is now read-only.
Ran into this while trying to reuse and modify templates to retain data validation.
If data validation exists on column C (3), and ws.InsertColumn(3,1) Column C still has the validation while 4 does not.
Not certain if this is specific to using cross-worksheet validation (I have another sheet that just contains ranges to be referenced)
Trying to use the following code
MoveDataValidation(ws, 'C', 'D');
private static void MoveDataValidation(ExcelWorksheet ws, char fromCol, char toCol)
{
var to = $"{toCol}:{toCol}";
var source = fromCol + "2";
var validation = ws.Cells[source].DataValidation as IExcelDataValidationList;
//Copy, errors
var toValidation = ws.DataValidations.AddListValidation(to);
}
is giving me indication that there is a data validation collision with existing data, and validation is similarly null, so I'm not certain where the problem exists, as it appears that it is being successfully moved, but is not retained on save.
Interrogating the cells shows that it has all the expected values without attempting to move data validation, but the output file has them on the position of the inserted cell
In an attempt to work around this, I have added the inserted cell to my template as a hidden field, and now the data validation is correct in one case, but every other data validation has been shifted right once.
The text was updated successfully, but these errors were encountered:
Prinsn
changed the title
Worksheet.InsertColumn doesn't shift DataValidation
Worksheet.InsertColumn interaction with Worksheet.DeleteColumn unclear with respect to DataValidation
Jan 3, 2020
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Ran into this while trying to reuse and modify templates to retain data validation.
If data validation exists on column C (3), and
ws.InsertColumn(3,1)
Column C still has the validation while 4 does not.Not certain if this is specific to using cross-worksheet validation (I have another sheet that just contains ranges to be referenced)
Trying to use the following code
is giving me indication that there is a data validation collision with existing data, and
validation
is similarly null, so I'm not certain where the problem exists, as it appears that it is being successfully moved, but is not retained on save.full context of use
Interrogating the cells shows that it has all the expected values without attempting to move data validation, but the output file has them on the position of the inserted cell
In an attempt to work around this, I have added the inserted cell to my template as a hidden field, and now the data validation is correct in one case, but every other data validation has been shifted right once.
The text was updated successfully, but these errors were encountered: