What happens when I copy data from IE to word?

Source: Internet
Author: User

I don't know if you have noticed that it will be very slow to copy table data from IE to MS Word, but the format and style of the table will be saved, but in other browsers, such as Firefox, copying table data to MS Word, such as opera, is much faster, and the effect is the same as copying data to notepad. Is the data on the clipboard different because of different replication sources (different browsers?

Let's take a look at the effect of copying from IE to word (2003 and 2007 are similar, so it won't work:

 

If you copy a file from Firefox or opera to word, the result is as follows ):

Enter "clipbrd.exe" in the run to view the clipboard (no? Here you can download>) content (the above is ie, the following is Firefox, there is a "slightly different "):

When copying data, I noticed that the word "connect to server" was prompted in the status bar of word, so I took out Wireshark and captured the packet for analysis. (Note that in item 4, word sent an HTTP GET request, the requested content is exactly the CSS file of the webpage, "http get/INC/ftp.css HTTP/1.1 "):

 

Obviously, if it is table data, CSS must define the style, so word takes it and parses it to display the style. When it is pasted from another browser, without this step, there will naturally be no style.

As mentioned above, the data copied to the clipboard is also "slightly different", which is indeed the result of different behaviors generated when it is pasted into word. In Windows, there are two types of clipboard, one is Windows standard clipboard, and the other is Ole (Object Linking and Embedding, object link and embedded) clipboard, but in fact, although the API interface of the standard clipboard has not changed, the internal implementation has actually been implemented using the OLE data transmission mechanism. Ole supports UDT (uniform data transfer, unified data transmission), and supports clipboard cutting, copying, and pasting through drag-and-drop operations. In addition to the performance of the standard Windows clipboard, Ole clipboard also supports transferring User-Defined clipboard formats and can be bound to Ole formats (such as fonts and font sizes) when transferring data ).

Therefore, when copying data from IE, the OLE clipboard is used and the OLE format is bound, and the format source is the CSS file on the network, so word will get the CSS file. Microsoft's Word, Excel, and IE can all be called Ole document package containers. When pasted, the data in OLE format can be recognized. Other Browsers Do not use this ole format when copying files. Instead, they only use plain text when pasting files. If the data is in the OLE format, but the OLE container is pasted from time to time, such as Notepad, it will be copied as normal text. This is why some people prefer to paste the content on the webpage to notepad first, clear the format, and then copy it to word.

For more information about Ole (Object connection and embedding), UDT (Unified Data Transmission) can refer to "com essence theory" and "Visual C ++ technical insider".
For how to use the OLE clipboard for programming, refer to msdn:
Http://msdn.microsoft.com/en-us/library/6www2be1 (vs.80). aspx
Http://support.microsoft.com/kb/83659/zh-cn

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.