CellsImportDataTable Method (DataTable, Boolean, Int32, Int32, Int32, Int32)

Note: This API is now obsolete.

Imports a DataTable into a worksheet.

Namespace:  Aspose.Cells
Assembly:  Aspose.Cells (in Aspose.Cells.dll) Version: 21.5.0.0 (21.5)
Syntax
[ObsoleteAttribute("Use Cells.ImportData(DataTable,int,int,ImportTableOptions) method, instead.")]
public int ImportDataTable(
	DataTable dataTable,
	bool isFieldNameShown,
	int firstRow,
	int firstColumn,
	int totalRows,
	int totalColumns
)

Parameters

dataTable
Type: System.DataDataTable
The DataTable object to be imported.
isFieldNameShown
Type: SystemBoolean
Indicates whether the field name of the datatable will be imported to the first row. Default is true.
firstRow
Type: SystemInt32
The row number of the first cell to import in.
firstColumn
Type: SystemInt32
The column number of the first cell to import in.
totalRows
Type: SystemInt32
Number of rows to be imported.
totalColumns
Type: SystemInt32
Number of columns to be imported.

Return Value

Type: Int32
Total number of rows imported
Remarks
NOTE: This member is now obsolete. Instead, please use Cells.ImportData(DataTable,int,int,ImportTableOptions) method, instead. This property will be removed 12 months later since December 2018. Aspose apologizes for any inconvenience you may have experienced.
Examples
[C#]

DataTable dt = new DataTable("Employee");
dt.Columns.Add("Employee_ID",typeof(Int32));
dt.Columns.Add("Employee_Name",typeof(string));
dt.Columns.Add("Gender",typeof(string));
DataRow dr = dt.NewRow();
dr[0] = 1;
dr[1] = "John Smith";
dr[2] = "Male";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[0] = 2;
dr[1] = "Mary Miller";
dr[2] = "Female";
dt.Rows.Add(dr);
cells.ImportDataTable(dt, true, 12, 12, 10, 10);

[Visual Basic]

Dim dt As DataTable =  New DataTable("Employee") 
dt.Columns.Add("Employee_ID",Type.GetType(Int32))
dt.Columns.Add("Employee_Name",Type.GetType(String))
dt.Columns.Add("Gender",Type.GetType(String))
Dim dr As DataRow =  dt.NewRow() 
dr(0) = 1
dr(1) = "John Smith"
dr(2) = "Male"
dt.Rows.Add(dr)
dr = dt.NewRow()
dr(0) = 2
dr(1) = "Mary Miller"
dr(2) = "Female"
dt.Rows.Add(dr)
cells.ImportDataTable(dt, True, 12, 12, 10, 10)
See Also