none
Clipboard DataFormat RRS feed

  • Question

  • Hi,

    How can I verify if the clipboard data is copied from which source (Power point/ Excel/ Word/ outlook)?
    I have tried DataFormats  (System.Windows.DataFormats) but from there we can only determine if its HTML/RTF not exactly what I wanted.

    Is there any way that I can retrieve this information?

    thanks.
    Tuesday, February 23, 2010 11:00 AM

Answers

  • I think the OP asked to find the application from which data has been copied.
    As in, I select a paragraph in a Word document, how do I find the clipboard contains text from a Word document.

    In which case, I think the answer is: you can't. Why would you need to?
    • Marked as answer by Harry Zhu Monday, March 1, 2010 2:37 AM
    Tuesday, February 23, 2010 2:02 PM
  • Thanks for the reply..
    Got answer in below thread -
    http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/87e68a6d-fec8-4ec8-acb4-7e263522ba08
    Tuesday, March 2, 2010 11:49 AM

All replies

  • Well, I found a code snippet on how to retrieve the name of files on the clipboard...if the file ends in .ppt it is power point, .xls would be excel, and so on and so forth.

                object fromClipboard;
                IDataObject fileData = Clipboard.GetDataObject();
                if (fileData.GetDataPresent(DataFormats.FileDrop, true))
                {
                    //it returning array of filenames present inside clipboard
                    fromClipboard = fileData.GetData(DataFormats.FileDrop, true);
    
                    foreach (string sourceFileName in (Array)fromClipboard)
                        MessageBox.Show(sourceFileName);
                }
                else
                    MessageBox.Show(this, "File not present in clipboard");
    Tuesday, February 23, 2010 1:15 PM
  • I think the OP asked to find the application from which data has been copied.
    As in, I select a paragraph in a Word document, how do I find the clipboard contains text from a Word document.

    In which case, I think the answer is: you can't. Why would you need to?
    • Marked as answer by Harry Zhu Monday, March 1, 2010 2:37 AM
    Tuesday, February 23, 2010 2:02 PM
  • Thanks for the reply..
    Got answer in below thread -
    http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/87e68a6d-fec8-4ec8-acb4-7e263522ba08
    Tuesday, March 2, 2010 11:49 AM