Copy data from Excel using JS paste to page

Source: Internet
Author: User

In Excel, select the area that you want to copy, and the text form in the Clipboard after copy is tab-delimited. To implement the "paste" function, only need to get the Clipboard text, and then according to the line feed "\ n" to get each row of data, and then split the line according to "\ T" to the corresponding cell data, assigned to the element in TD.

This process focuses on how JS accesses the contents of the Clipboard.

In IE, you can use Window.clipboarddata directly, the function window.clipboardData.getData (' Text ') can be taken. But not in Chrome or Firefox. Online and clipboard related, mostly is to explain how to put the content of the Web page into the Clipboard, how to fetch data from the Clipboard did not find a workaround.

For details, please visit my homepage:

Http://www.iyummy.com.cn/Blog/Index

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.