'DeclarationPublic Class DataTableImportOptions Inherits ImportOptions
'UsageDim instance As DataTableImportOptions
public class DataTableImportOptions : ImportOptions
'DeclarationPublic Class DataTableImportOptions Inherits ImportOptions
'UsageDim instance As DataTableImportOptions
public class DataTableImportOptions : ImportOptions
var workbook = Workbook.Create("test.xlsx" ); var worksheet = workbook.Worksheets[ 0 ]; // Define a dataTable, the import options(show specific ColumnNames) and call the ImportData function. var dataTable = new DataTable( "Employees" ); dataTable.Columns.Add( "Name", typeof( string ) ); dataTable.Columns.Add( "Position", typeof( string ) ); dataTable.Columns.Add( "Experience", typeof( double ) ); dataTable.Columns.Add( "Salary", typeof( int ) ); dataTable.Rows.Add( "Jenny Melchuck", "Project Manager", 11.5d, 77000 ); dataTable.Rows.Add( "Cindy Gartner", "Medical Assistant", 1.3d, 56000 ); dataTable.Rows.Add( "Carl Jones", "Web Designer", 4d, 66000 ); dataTable.Rows.Add( "Anna Karlweiss", "Account Executive", 7.8d, 51000 ); dataTable.Rows.Add( "Julia Robertson", "Marketing Coordinator", 17.6d, 65000 ); var dataTableImportOptions = new DataTableImportOptions() { DestinationTopLeftAddress = "B5", ColumnNames = new string[] { "Name", "Experience", "Position" }, IsColumnNamesShown = true }; worksheet.ImportData( dataTable, dataTableImportOptions ); workbook.Save();
System.Object
Xceed.Workbooks.NET.ImportOptions
Xceed.Workbooks.NET.DataTableImportOptions
| Name | Description | |
|---|---|---|
![]() | DataTableImportOptions Constructor |
| Name | Description | |
|---|---|---|
![]() | ColumnNames | Gets or sets the names of the data table’s columns. |
![]() | DestinationColumnId | Gets or sets the Id of the Column in which the first data item will be imported. (Inherited from Xceed.Workbooks.NET.ImportOptions) |
![]() | DestinationRowId | Gets or sets the Id of the Row in which the first data item will be imported. (Inherited from Xceed.Workbooks.NET.ImportOptions) |
![]() | DestinationTopLeftAddress | Gets or sets the address of the Cell in which the first data item will be imported. (Inherited from Xceed.Workbooks.NET.ImportOptions) |
![]() | IsColumnNamesShown | Gets or sets if the data table’s ColumnNames will be shown or not. |
![]() | IsLinearDataVertical | Gets or sets if the imported linear data (like a List<string>, Array<int>, MyProduct[], ...) will be displayed vertically in the Worksheet. (Inherited from Xceed.Workbooks.NET.ImportOptions) |
.NET: net5.0, net5.0-windows, net6.0, net6.0-macos, net6.0-windows, net7.0, net7.0-macos, net7.0-windows, net8.0, net8.0-browser, net8.0-macos, net8.0-windows, net9.0, net9.0-browser, net9.0-macos, net9.0-windows, net10.0, net10.0-browser, net10.0-macos, net10.0-windows.
.NET Framework: net40, net403, net45, net451, net452, net46, net461, net462, net463, net47, net471, net472, net48, net481.