public AccountSheetView(Account account) { InitializeComponent(); this.account = account; Header.Content = account.CreateHeader(); FillData(); }
private void Button_Click(object sender, RoutedEventArgs e) { Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog(); dlg.FileName = "Document"; // Default file name dlg.DefaultExt = ".csv"; // Default file extension dlg.Filter = "CSV documents (.csv)|*.csv"; // Filter files by extension if (dlg.ShowDialog().HasValue) { using (System.IO.StreamWriter writer = new System.IO.StreamWriter(dlg.FileName)) { writer.WriteLine(account.CreateHeader()); writer.WriteLine(); foreach (DataRow r in data.Rows) { string st = $"{r[0]};{r[1]};{r[2]};{r[3]};{r[4]}"; writer.WriteLine(st); } } } }