I want to support copy/paste functionality of Excel data from the windows clipboard onto a 3 column HTML table. So, the number of rows will need to vary according to the data. This will minimize the amount of effort the client has to put into moving the data into the website. It also keeps me from having to use the office interop to parse Excel data (clunky and error prone).
How can I build support for this? Do I need some kind of javascript to intercept the clipboard and create the table dynamically with jQuery?
Bonus:
What does the data look like on the clipboard, simple delimited data? Does it differ from Excel 2007 to 2010?
Assuming you want them to paste into their browser window, you can’t access the clipboard directly. I would probably supply a <textarea> field, and let them paste directly into this. From there, the javascript or server-side code can find the tab characters and newline characters, and load it into the html table. I’d suggest using the javascript split() method on regular expression patterns \t and [\n\r\f] (tabs and newline characters, respectively).