private void bt__Click(object sender, RoutedEventArgs e)
{
DataGrid dg = dgDocuments;
dg.SelectAllCells();
dg.ClipboardCopyMode = DataGridClipboardCopyMode.IncludeHeader;
ApplicationCommands.Copy.Execute(null, dg);
dg.UnselectAllCells();
String result = (string)Clipboard.GetData(DataFormats.Text);
string a, b;
b = "@";
a = (DBConnection.FolderZ.ToString());
StreamWriter sw = new StreamWriter(a);
sw.WriteLine(result);
sw.Close();
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.ShowDialog();
File.WriteAllText(saveFileDialog.FileName, result);
}