Syncfusion.XlsIO.Base
Example 


DataColumn with desired data.
TRUE if column name must be imported. FALSE - Not imported.
First row from where the data should be imported.
First column from where the data should be imported.

ImportDataColumn Method

Imports data from a System.Data.DataColumn into a worksheet.
Syntax
'Declaration
 
Function ImportDataColumn( _
   ByVal dataColumn As DataColumn, _
   ByVal isFieldNameShown As Boolean, _
   ByVal firstRow As Integer, _
   ByVal firstColumn As Integer _
) As Integer
'Usage
 
Dim instance As IWorksheet
Dim dataColumn As DataColumn
Dim isFieldNameShown As Boolean
Dim firstRow As Integer
Dim firstColumn As Integer
Dim value As Integer
 
value = instance.ImportDataColumn(dataColumn, isFieldNameShown, firstRow, firstColumn)

Parameters

dataColumn
DataColumn with desired data.
isFieldNameShown
TRUE if column name must be imported. FALSE - Not imported.
firstRow
First row from where the data should be imported.
firstColumn
First column from where the data should be imported.

Return Value

Number of imported rows.
Remarks
This method is supported in ASP.NET Core, Xamarin, and UWP platforms from .NET Standard 2.0 onward. To know more about ImportDataColumn refer this link
Example
The following code illustrates how to Imports data from a System.Data.DataColumn into a worksheet with the specified row and column.
using Syncfusion.XlsIO;
using System.Data;
             
class Example
{
  static void Main()
  {
     ExcelEngine excelEngine = new ExcelEngine();
     IApplication application = excelEngine.Excel;
     application.DefaultVersion = ExcelVersion.Excel2013;
     IWorkbook workbook = application.Workbooks.Create(1);
     IWorksheet worksheet = workbook.Worksheets[0];
     DataTable table = SampleDataTable();
     DataColumn column = table.Columns[2];
     worksheet.ImportDataColumn(column, true, 1, 1);
     workbook.SaveAs("ImportFromDC.xlsx");
     workbook.Close();
     excelEngine.Dispose();
  } 
  
  static DataTable SampleDataTable()
  {
    // Here we create a three columns
    DataTable table = new DataTable();
    table.Columns.Add("ID", typeof(int));
    table.Columns.Add("Item", typeof(string));
    table.Columns.Add("Name", typeof(string));
            
    // Here we add four DataRows
    table.Rows.Add(1, "Soap", "David");
    table.Rows.Add(2, "Paste", "Sam");
    table.Rows.Add(3, "Cream", "Christoff");
    table.Rows.Add(4, "Powder", "Janet");
    return table;
  }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 16.4460.0.40

See Also