Excel Worksheet data formats in Clipboard RRS feed

  • Question

  • Hello all,


    I need to distinguish Excel Worksheet object from other object types which can be copied to the Clipboard.

    I found that copied Worksheet returns 22 data formats by calling Clipboard.GetDataObject().GetFormats() function. One of them is "Format129". I haven't seen that format before with other objects in Clipboard. Does anybody know what is it? Can I use this data format to make sure that I have exactly Worksheet object in the Clipboard?


    Thanks, Mikhail

    Tuesday, July 12, 2011 2:14 PM


  • Hi Mikhail,

    As far as I know, we can't use this data format to make sure that the Worksheet object is in the Clipboard. And there does not exist the official document on MSDN introduces the format and this method. I also tried on my side by creating a VSTO Workbook project, and add the code like the follows:

            private void Sheet1_Startup(object sender, System.EventArgs e)
                object result = Clipboard.GetDataObject();
                string[] sList = Clipboard.GetDataObject().GetFormats();  

    The code threw the exception and the result variable always returns null. Office has it's own clipboard mechanisum, then we can't simply use Clipboard class to get the information.

    I think you need to use  an alternative way to distinguish the Excel worksheet object, such as record the source object you copied.

    Hope this can give you the hint and wish you a nice day.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Bruce Song Monday, August 1, 2011 5:32 AM
    Monday, July 18, 2011 3:39 AM