This project has moved. For the latest updates, please go here.

ExcelRangeBase.LoadFromDataTable throws exception when Table.Rows.Count = 0 and PrintHeaders = False.

Dec 15, 2014 at 9:06 AM
Hi , I am using EPPlus 4.0.1.1 .

I have a problem in using the method: ExcelRangeBase.LoadFromDataTable(DataTable Table, Boolean PrintHeaders, TableStyles TableStyle).

When Table.Rows.Count = 0 and PrintHeaders = False, it throws below exception:


System.ArgumentException was catched:

  HResult=-2147024809
  Message=Row out of range
  Source=EPPlus
  StackTrace:
       at OfficeOpenXml.ExcelRange.ValidateRowCol(Int32 Row, Int32 Col)
       at OfficeOpenXml.ExcelRange.get_Item(Int32 FromRow, Int32 FromCol, Int32 ToRow, Int32 ToCol)
       at OfficeOpenXml.ExcelRangeBase.LoadFromDataTable(DataTable Table, Boolean PrintHeaders)
       at OfficeOpenXml.ExcelRangeBase.LoadFromDataTable(DataTable Table, Boolean PrintHeaders, TableStyles TableStyle)
Could you please confirm that?

Thanks.