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

Created Unassigned: .LoadFromCollection Throws OutOfRange Exception if collection is empty [14971]

$
0
0
Example:
```
using (ExcelPackage pck = new ExcelPackage())
{
ExcelWorksheet ws = pck.Workbook.Worksheets.Add("EmptyCollectionBug");
List<string> aList = new List<string>();
aList.Add("Test");

ws.Cells["K8"].LoadFromCollection<string>(aList.Where(i => i != "Test"));
}

```

My fix:
ExcelRangeBase.cs, line 2016, Add:
```
if (Collection.Count() < 1)
return null;
```
Likely a better way to do this, but it gets the job done. Obviously code can check for 0 count collections rather than lib, but it saved me writing a lot more code.

Viewing all articles
Browse latest Browse all 2262

Trending Articles



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