Data Management in WPF Spreadsheet (SfSpreadsheet)

7 May 20211 minute to read

This section explains about how to import and export the DataTable in SfSpreadsheet.

Import from DataTable

SfSpreadsheet provides support to import the data. The following list of data can be imported into the worksheet

  • Data Table
  • Data Column
  • Data View
  • Business Objects
  • Array

To import the data from a data table, you can use ImportDataTable
method

spreadsheet.ActiveSheet.ImportDataTable(data_table, true, 1, 1);
spreadsheet.ActiveGrid.InvalidateCells();

For more details regarding importing of data, please refer the XlsIO UG

Export to DataTable

SfSpreadsheet provides support to export the data. To Export the data from a data table, you can use ExportDataTable
method

IWorksheet sheet = spreadsheet.Workbook.Worksheets[0];
IRange range = sheet.Range["A1:K50"];
DataTable data_table = sheet.ExportDataTable(range, ExcelExportDataTableOptions.ColumnNames);

For more details regarding exporting of data, please refer the XlsIO UG