Syncfusion.XlsIO.Base
Example 


T is a generic type argument. The type argument for this particular class can be any type recognized by the compiler and it must have a parameterless constructor.
Row of the first cell should be exported.
Column of the first cell should be exported.
Upto lastRow of data want to be export.
Upto lastColumn of data want to be export.

ExportData<T> Method (IWorksheet)

Exports worksheet data into the List of Business Objects.
Syntax
'Declaration
 
Function ExportData(Of T As {New})( _
   ByVal firstRow As Integer, _
   ByVal firstColumn As Integer, _
   ByVal lastRow As Integer, _
   ByVal lastColumn As Integer _
) As List(Of T)
'Usage
 
Dim instance As IWorksheet
Dim firstRow As Integer
Dim firstColumn As Integer
Dim lastRow As Integer
Dim lastColumn As Integer
Dim value As List(Of T)
 
value = instance.ExportData(Of T)(firstRow, firstColumn, lastRow, lastColumn)
List<T> ExportData<T>( 
   int firstRow,
   int firstColumn,
   int lastRow,
   int lastColumn
)
where T: new()

Parameters

firstRow
Row of the first cell should be exported.
firstColumn
Column of the first cell should be exported.
lastRow
Upto lastRow of data want to be export.
lastColumn
Upto lastColumn of data want to be export.

Type Parameters

T
T is a generic type argument. The type argument for this particular class can be any type recognized by the compiler and it must have a parameterless constructor.

Return Value

List of BusinessObjects with worksheet data.
Remarks
Class property name or System.ComponentModel.DisplayNameAttribute for a property must match with any one of the cell value in firstRow parameter to bind and export data. To know more about ExportData refer this link.
Example
The following code illustrates how to exports worksheet data into a List of business objects.
using Syncfusion.XlsIO;
using System.Collections.Generic;
             
class Example
{
  static void Main()
  {
    ExcelEngine engine = new ExcelEngine();
    IApplication application = engine.Excel;
    application.DefaultVersion = ExcelVersion.Excel2016;
    IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
    IWorksheet worksheet = workbook.Worksheets[0];
             
    // Export the matching data and Get the list of business objects
    List<Report> businessObjects= worksheet.ExportData<Report>(1, 1, 40, 3);
  
    workbook.Close();
    engine.Dispose();
  }
}
public class Report   
{
  public string SalesPerson { get; set; }
  public string SalesJanJun { get; set; }
  public string SalesJulDec { get; set; }
            
  public Report()
  {
  
  }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 16.3460.0.29

See Also