Re: Copy from excel --> clipborad --> datagridview

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vamsikrishna20
    New Member
    • Jun 2010
    • 3

    #1

    Re: Copy from excel --> clipborad --> datagridview

    Hello,
    i am working with vs2008 (web application) and I want to copy some content from an excel sheet and and using the clipboard i want to copy the contents in a gridview

    I have tried using Clipboard.GetDa taObject() but no matter what ever i do it is always returning null so can anyone suggest me solution of how to implement this.

    regards,
    vamsi.
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Is there anything IN the clipboard object? Like did you do a copy from excel?
    Office has its own weird clipboard that might not put data into the regular clipboard until it thinks it needs it?

    EDIT:
    Calling .GetFormats(tru e) returned the following data types in my Clipboard from an excel copy:
    Code:
    		[0]	"EnhancedMetafile"
    		[1]	"MetaFilePict"
    		[2]	"System.Drawing.Bitmap"
    		[3]	"Bitmap"
    		[4]	"Biff8"
    		[5]	"Biff5"
    		[6]	"BIFF4"
    		[7]	"Biff3"
    		[8]	"Biff"
    		[9]	"SymbolicLink"
    		[10]	"Wk1"
    		[11]	"DataInterchangeFormat"
    		[12]	"XML Spreadsheet"
    		[13]	"HTML Format"
    		[14]	"System.String"
    		[15]	"UnicodeText"
    		[16]	"Text"
    		[17]	"Csv"
    		[18]	"Rich Text Format"
    		[19]	"Embed Source"
    		[20]	"Object Descriptor"
    		[21]	"Link Source"
    		[22]	"Link Source Descriptor"
    		[23]	"Link"
    		[24]	"Format129"

    Comment

    • vamsikrishna20
      New Member
      • Jun 2010
      • 3

      #3
      re: copy from excel --> clipborad --> datagridview

      thanks for the reply but are you sure that you are using a web applicaion developed in vs2008 and windows 2003 as when i am tring to fetch teh data from teh clipboard by using teh object Clipboard.GetDa taObject() it is always returning a null value so please let me know how do you want me to proceed regarding this issue.

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        Ah ha! I missed that part about the web application!
        Ok then. Well copy/paste is handled by the browser on the client side.
        It if highly unlikely that any copy/paste operation will ever make it back to the server for it to process.

        In IE, I think javascript can access that clipboard, but FF does not allow it.

        What you could MAYBE do, is provide a small textbox, that the user will PASTE the data into, and you would have javascript watch for the changed event and it would then process the data and fill in your gridview?

        Comment

        • Curtis Rutland
          Recognized Expert Specialist
          • Apr 2008
          • 3264

          #5
          Remember: all .NET code is executed on the server. So when you're doing the Clipboard.GetDa taObject(), you are accessing the Clipboard object of the server, not the client.

          Comment

          Working...