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); }
public void DumpWFClipboardTest() { TestContext.WriteLine($"ContainsAudio: {WFClipboard.ContainsAudio()}"); TestContext.WriteLine($"ContainsData: {WFClipboard.ContainsData(DataFormats.StringFormat)}"); TestContext.WriteLine($"ContainsFileDropList: {WFClipboard.ContainsFileDropList()}"); TestContext.WriteLine($"ContainsImage: {WFClipboard.ContainsImage()}"); TestContext.WriteLine($"ContainsText: {WFClipboard.ContainsText()}"); TestContext.WriteLine($"GetAudioStream: {WFClipboard.GetAudioStream()}"); TestContext.WriteLine($"GetData: {WFClipboard.GetData(DataFormats.StringFormat)}"); TestContext.WriteLine($"GetDataObject: {WFClipboard.GetDataObject()}"); TestContext.WriteLine($"GetFileDropList: {string.Join("\n", WFClipboard.GetFileDropList().Cast<string>())}"); TestContext.WriteLine($"GetImage: {WFClipboard.GetImage()}"); TestContext.WriteLine($"GetText: {WFClipboard.GetText()}"); }
public override object GetData(TransferDataType type) { if (type == null) { throw new ArgumentNullException("type"); } if (!IsTypeAvailable(type)) { return(null); } return(WindowsClipboard.GetData(type.ToSwf())); }
//Экспортв MS Word private void bt_Eport_Word_Click(object sender, RoutedEventArgs e) { DataGrid dg = dgClient; dg.SelectAllCells(); dg.ClipboardCopyMode = DataGridClipboardCopyMode.IncludeHeader; ApplicationCommands.Copy.Execute(null, dg); dg.UnselectAllCells(); String result = (string)Clipboard.GetData(DataFormats.Text); try { StreamWriter sw = new StreamWriter("export.doc"); sw.WriteLine(result); sw.Close(); Process.Start("export.doc"); } catch (Exception ex) { } }
public static object GetData(string format) { return(ClipboardProxy.GetData(format)); }