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

Commented Issue: ArgumentOutOfRangeException: Implementation bug in LoadFromDataTable(DataTable Table, bool PrintHeaders) [14790]

$
0
0
Hi,<br />There is a issue in implementation of LoadFromDataTable(DataTable Table, bool PrintHeaders) method while returning excel range base. in the above mentioned method there is issue at return statement<br /><br />_worksheet.Cells[_fromRow, _fromCol, row - 1, Table.Columns.Count];<br /><br />here below is a detailed description of the error:<br /><br />for example i am adding data to sheet 'X' with a data table of 2 columns X 5 Rows and the start address 'C1'.<br />my code:<br />exlWorkSheet.Cells["C1"].LoadFromDataTable(dtEventsData.,false);<br /><br />In this case as per the logic implemented in the method ' LoadFromDataTable' the values are as below while generating range.<br /><br />_fromCol =3 (from 'C1' as my start address)<br />_fromRow=1 (from 'C1' as my start address)<br />_toRow=5 (row - 1 from method logic)<br />_toCol=2 ( as you are passing Table.Columns.Count as parameter to generate ExcelRange as i have a table with 2 columns only)<br /><br />from the above values _toCol(2)<_fromCol(3) which is an impossible case for generating ExcelRange in the above case.<br /><br />I am proposing a just a minor change:<br /><br />use this code: _worksheet.Cells[_fromRow, _fromCol, row - 1, Table.Columns.Count+_fromCol];<br />Existing Code: _worksheet.Cells[_fromRow, _fromCol, row - 1, Table.Columns.Count];<br /><br />version details:<br />[assembly: AssemblyVersion("3.1.2.0")]<br />[assembly: AssemblyFileVersion("3.1.2.0")]<br /><br /><br />
Comments: Thanks for reporting it. I'll supply your fix next time I check in.

Viewing all articles
Browse latest Browse all 2262

Trending Articles



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