Importing Data from a DataTable to Grid

Contents
[ ]

Example

To import the contents of a data table using Aspose.Cells.GridDesktop control:

  1. Add Aspose.Cells.GridDesktop control to a form.
  2. Create a DataTable object that contains the data to be imported.
  3. Get the reference of a desired worksheet.
  4. Import the data table contents to the worksheet.
  5. Set the column headers of the worksheet according to column names of the data table.
  6. Set the width of the columns, if desired/
  7. Display the worksheet.

In the example given below, we have created a DataTable object and filled it with some data fetched from a database table named Products. Finally, we have imported data from that DataTable object to a desired worksheet using Aspose.Cells.GridDesktop.