Data Management in Windows Forms Spreadsheet

9 Oct 20231 minute to read

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

Import from DataTable

Spreadsheet 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

Spreadsheet 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