For current versions
Reading data from DataTable
is available by ReoGrid core, it's possible to set the DataTable
to any position on spreadsheet:
var adapter = new DataSet1TableAdapters.MyTableAdapter();
var dt = adapter.GetData();
worksheet["A1"] = dt;
For earlier versions
In earlier versions, ReoGrid cannot read data from DataTable, it is necessary to copy data into cell one by one:
// get a DataTable from database
var adapter = new DataSet1TableAdapters.MyTableAdapter();
var dt = adapter.GetData();
// iterate to copy all cells
for (int row = 0; row < dt.Rows.Count; row++)
{
for (int col = 0; col < dt.Columns.Count; col++)
{
grid[row, col] = dt.Rows[row][col];
}
}