title: Export DataTable to Excel using programmatically created DevExpress GridView
body: <p>I'm trying to export a DataTable to Excel using a programmatically created DevExpress GridControl. The code I have exports the GridView columns, but without any populated data rows. Here is the sample code (tblErrors is a DataTable parameter passed to the method):</p>
  
  <pre><code>GridControl control = new GridControl();                
  GridView view = new GridView();
  control.ViewCollection.Add(view);
  control.MainView = view;
  foreach (DataColumn tCol in tblErrors.Columns)
  {
      GridColumn gCol = new GridColumn();
      gCol.Name = "col" + tCol.ColumnName;
      gCol.FieldName = tCol.ColumnName;
      gCol.UnboundType = DevExpress.Data.UnboundColumnType.Bound;
      view.Columns.Add(gCol);
      gCol.Visible = true;
  }
  control.DataSource = tblErrors;
  control.Visible = true;
  view.ExportToXlsx(String.Format(@"{0}\{1} Error Report.xlsx", Environment.GetFolderPath(Environment.SpecialFolder.Desktop), DateTime.Today.ToString("yyyy-MM-dd")));
  </code></pre>
  
  <p>Any ideas as to what I'm missing?</p>