Validation list can overflow and produced excel file is corrupted, excel then removes this validation after this warning :
**We found a problem with some content in ...**
Problem is that all data from validation lists is longer than 255 bytes (including comma separators for every item), i saw in the source that library guards this case for ExcelFormula and I feel that in this case exception should be raised. For me it's really a minor issue because with this restriction constant validation lists are almost unusable, I am now using range from hidden column as list validation source.
Here is the example that recreates the coruppted excel file :
``` C#
class Program
{
static void Main(string[] args)
{
var pack = new ExcelPackage();
var ws = pack.Workbook.Worksheets.Add("sheet1");
var val = ws.DataValidations.AddListValidation("A1");
val.Formula.Values.Add("Here we have to add long text");
val.Formula.Values.Add("All list values combined have to have more then 255 chars");
val.Formula.Values.Add("more text 1 more text more text more text");
val.Formula.Values.Add("more text 2 more text more text more text");
val.Formula.Values.Add("more text 3 more text more text more text");
val.Formula.Values.Add("more text 4 more text more text more text");
/// comment this line below and excel file will be OK
val.Formula.Values.Add("123");
pack.SaveAs(new FileInfo("err.xlsx"));
}
}
```
btw. GREAT library, thanks !
Comments: Fixed in changeset 54790cf6910f
**We found a problem with some content in ...**
Problem is that all data from validation lists is longer than 255 bytes (including comma separators for every item), i saw in the source that library guards this case for ExcelFormula and I feel that in this case exception should be raised. For me it's really a minor issue because with this restriction constant validation lists are almost unusable, I am now using range from hidden column as list validation source.
Here is the example that recreates the coruppted excel file :
``` C#
class Program
{
static void Main(string[] args)
{
var pack = new ExcelPackage();
var ws = pack.Workbook.Worksheets.Add("sheet1");
var val = ws.DataValidations.AddListValidation("A1");
val.Formula.Values.Add("Here we have to add long text");
val.Formula.Values.Add("All list values combined have to have more then 255 chars");
val.Formula.Values.Add("more text 1 more text more text more text");
val.Formula.Values.Add("more text 2 more text more text more text");
val.Formula.Values.Add("more text 3 more text more text more text");
val.Formula.Values.Add("more text 4 more text more text more text");
/// comment this line below and excel file will be OK
val.Formula.Values.Add("123");
pack.SaveAs(new FileInfo("err.xlsx"));
}
}
```
btw. GREAT library, thanks !
Comments: Fixed in changeset 54790cf6910f