CellsExportDataTable Method (Int32, Int32, Int32, Int32)

Exports data in the Cells collection to a DataTable object.

Namespace:  Aspose.Cells
Assembly:  Aspose.Cells (in Aspose.Cells.dll) Version: 20.9.0.0 (20.9)
Syntax
public DataTable ExportDataTable(
	int firstRow,
	int firstColumn,
	int totalRows,
	int totalColumns
)

Parameters

firstRow
Type: SystemInt32
The row number of the first cell to export out.
firstColumn
Type: SystemInt32
The column number of the first cell to export out.
totalRows
Type: SystemInt32
Number of rows to be imported.
totalColumns
Type: SystemInt32
Number of columns to be imported.

Return Value

Type: DataTable
Exported DataTable object.
Remarks
If you use this method to export a block of data, please be sure that the data in a column should be the same data type. Otherwise, use the ExportDataTableAsString(Int32, Int32, Int32, Int32) method instead.
Examples
[C#]


string designerFile = MapPath("Designer") + "\\List.xls";
Workbook excel = new Workbook(designerFile);
Worksheet sheet = excel.Worksheets[0];
DataTable dt = sheet.Cells.ExportDataTable(6, 1, 69, 4);
this.DataGrid1.DataSource = dt;
this.DataGrid1.DataBind();

[Visual Basic]


Dim designerFile As String = MapPath("Designer") + "\List.xls"
Dim excel As excel = New excel(designerFile)
Dim sheet As Worksheet = excel.Worksheets(0)
Dim dt As DataTable = sheet.Cells.ExportDataTable(6, 1, 69, 4)
Me.DataGrid1.DataSource = dt
Me.DataGrid1.DataBind()
See Also