Posted 16 October 2022, 6:11 pm EST
- Updated 16 October 2022, 8:00 pm EST
Hi Nitin,
the Version is C1.WPF.DataGrid.4 → Version : 4.0.20152.473
And I have take a look again in the datatable and it have not 30 columns but 250 columns and 180000 rows.
Here more of the source code :
// WPF:
<c1:C1DataGrid Name="Grid" Grid.Row="0" Grid.RowSpan="2 ItemsSource="{Binding DataView, IsAsync=True}"
// Model:
private IBindingListView _dataView;
public IBindingListView DataView
{
get
{
return _dataView;
}
set
{
_dataView = value;
this.FirePropertyChanged(i => i.DataView);
}
}
// ViewModel:
DataTable tbl;
// To the DataTable I load in a different place the data but that will make the example to long.
public void LoadData()
{
try
{
DataView = tbl().DefaultView;
}
catch (Exception e)
{
Log.Debug(e.ToString());
}
}
//View.xaml.cs:
private string _excelFileName = "";
private string _excelFileExtension = ".xls";
private void SaveDataToExcel()
{
var dlg = new Microsoft.Win32.SaveFileDialog
{
DefaultExt = "xlsx",
FileName = "FileName",
InitialDirectory = FileUtilities.GetDir(),
Filter = "Excel Workbook (*.xlsx)|*.xlsx|" + "Microsoft Excel (*.xls)|*.xls"
};
if (dlg.ShowDialog() == true)
{
if (Dispatcher != null)
Dispatcher.Invoke(() =>
{
_excelFileName = dlg.FileName;
_excelFileExtension = Path.GetExtension(dlg.SafeFileName).ToLower();
//SaveExcel();
switch (_excelFileExtension)
{
case ".xls":
{
try
{
if (Dispatcher != null)
Dispatcher.Invoke(() => { Grid.Save(_excelFileName, FileFormat.Xls); });
}
catch (Exception exception)
{
Console.WriteLine(exception);
throw;
}
break;
}
default:
{
try
{
if (Dispatcher != null)
Dispatcher.Invoke(() => { Grid.Save(_excelFileName, FileFormat.Xlsx); });
}
catch (Exception exception)
{
Console.WriteLine(exception);
throw;
}
break;
}
}
});
}
}