I'm trying to write a web page that takes excel info from the clipboard. I'd like to be able to pick up the XML Spreadsheet info, rather than just the text.
Is this possible? I'd like to do it in most browsers, if not all.
Thanks
I'm trying to write a web page that takes excel info from the clipboard. I'd like to be able to pick up the XML Spreadsheet info, rather than just the text.
Is this possible? I'd like to do it in most browsers, if not all.
Thanks
If you copy from Excel directly and paste in into a textarea
it will be text-only, separated by tabs and new lines "\n". You can parse this into an array or some other format for your consumption.
I doubt you could paste it into any other type of control, so you won't be able to get the XML without uploading a file to the server and grabbing it via AJAX.
If the clipboard contains a "textified" version of the XML, which it won't by default if the user just does a select-and-copy it might work with a textarea
. You may be able to use VBA in Excel for this trick.
"Most browsers, if not all" would include all versions? Oh dear.
One should probably never say never, but I very much doubt that it's possible, I'm afraid. You're limited to the format agreed on during the negotiation between the browser and Excel as the two ends of the clipboard conversation, and there's no way to guarantee that every browser will stipulate XML as the reception method of choice, especially when that format is only supported by later versions of Excel. Cross-application copy-and-paste is hard.
If you must have XML, then my suggestion is that you stipulate that your users save their workbooks so, and upload the files. Probably better to accept the test alternative, which should work in just about any browser that can handle a <textarea>
.