private void ExportToExcel() { gridTestScript.SelectAllCells(); gridTestScript.ClipboardCopyMode = DataGridClipboardCopyMode.IncludeHeader; ApplicationCommands.Copy.Execute(null, gridTestScript); String resultat = (string)Clipboard.GetData(DataFormats.CommaSeparatedValue); String result = (string)Clipboard.GetData(DataFormats.Text); gridTestScript.UnselectAllCells(); System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Intel\test.xls"); file.WriteLine(result.Replace(',', ' ')); file.Close(); MessageBox.Show(" Exporting DataGrid data to Excel file created"); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)