XlsWorksheet
InsertDataTable Method (DataTable, Boolean, Int32, Int32, Int32, Int32, Boolean)
|
Imports data from a DataTable into worksheet.
Examples
The following code illustrates how to Imports data from a DataTable into a worksheet with specified range along with preserve type:
<para>
table.Columns.Add("Item", typeof(string));
table.Columns.Add("Name", typeof(string));</para><para>table.Rows.Add(1, "Soap", "David");
table.Rows.Add(2, "Paste", "Sam");
table.Rows.Add(3, "Cream", "Christoff");</para><para>
Namespace:
Spire.Xls.Core.Spreadsheet
Assembly:
Spire.XLS (in Spire.XLS.dll) Version: 15.4.0.0 (15.4.0.5046)
Syntax
public int InsertDataTable(
DataTable dataTable,
bool columnHeaders,
int firstRow,
int firstColumn,
int maxRows,
int maxColumns,
bool transTypes
)
Public Function InsertDataTable (
dataTable As DataTable,
columnHeaders As Boolean,
firstRow As Integer,
firstColumn As Integer,
maxRows As Integer,
maxColumns As Integer,
transTypes As Boolean
) As Integer
public:
virtual int InsertDataTable(
DataTable^ dataTable,
bool columnHeaders,
int firstRow,
int firstColumn,
int maxRows,
int maxColumns,
bool transTypes
) sealed
abstract InsertDataTable :
dataTable : DataTable *
columnHeaders : bool *
firstRow : int *
firstColumn : int *
maxRows : int *
maxColumns : int *
transTypes : bool -> int
override InsertDataTable :
dataTable : DataTable *
columnHeaders : bool *
firstRow : int *
firstColumn : int *
maxRows : int *
maxColumns : int *
transTypes : bool -> int
Parameters
-
dataTable
-
Type:
System.Data
DataTable
Datatable
-
columnHeaders
-
Type:
System
Boolean
Indicates whether to import field names.
-
firstRow
-
Type:
System
Int32
The row number of the first cell to import in.
-
firstColumn
-
Type:
System
Int32
The column number of the first cell to import in.
-
maxRows
-
Type:
System
Int32
Maximum number of rows to import
-
maxColumns
-
Type:
System
Int32
Maximum number of columns to import
-
transTypes
-
Type:
System
Boolean
Indicates if preserve types when insert data into worksheet
Return Value
Type:
Int32
Implements
IWorksheet
InsertDataTable(DataTable, Boolean, Int32, Int32, Int32, Int32, Boolean)
See Also