Quantcast
Channel: EPPlus Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 2262

Commented Unassigned: Validation lists to long [14907]

$
0
0
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

Viewing all articles
Browse latest Browse all 2262

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>