EPPlus.Core icon indicating copy to clipboard operation
EPPlus.Core copied to clipboard

Bug: LoadFromDataReader throws an invalid row number error

Open chris2131 opened this issue 7 years ago • 0 comments

The LoadFromDataReader will throw an invalid row number error if you try to load an empty table without headers. If you load the empty table with headers then the load will process successfully.

The issue is located in ExcelRangeBase.cs, Line number:1839

return _worksheet.Cells[_fromRow, _fromCol, row - 1, _fromCol + fieldCount - 1];

should be changed to

return _worksheet.Cells[_fromRow, _fromCol, (row <= 1 ? 1 : row - 1), _fromCol + fieldCount - 1];

chris2131 avatar Mar 28 '18 01:03 chris2131