I built a Windows Forms tool using to highlight a piece of code and then copy the highlighted code onto clipboard with both HTML, RTF and plain text format. When I paste the copied code in Word or WordPad or Google Docs, it will copy with color. In notepad it should copy as plain text. This had been working until yesterday. Suddenly all text editors only paste plain text, not formatted HTML / RTF content anymore. But if I don't copy plain text format, things will be a bit better, Word, WordPad can paste highlighted code just fine. Of course, pasting doesn't work in notepad anymore.

My question is why is this behavior change suddenly? I own another laptop, same thing happened. Restart machine doesn't help.

  • 2
    If the data is successfully transferred to the clipboard, it’s the “receiving” application’s job to decide what to do with it. Windows is not involved in this decision. – Daniel B Sep 3 at 8:29
  • @DanielB the problem is that the receiving applications don't change, no updates or whatsoever, no reinstall. It was working before but all of the sudden they stopped working. I am not saying it must be Windows 10, but this behavior happens on Windows 10. And both of my laptops. – imgen Sep 6 at 3:38
  • Does this problem exist when booting in Safe mode? Can you publish your Windows Forms tool in a reusable format so we can examine what it does? – harrymc Sep 10 at 8:07
  • Could you please clarify the following sentence: Suddenly all text editors only paste plain text? My understanding problem: E.g. in WordPad, the paste button is not just a button, but contains a drop-down menu with entries Paste (equivalent to just clicking on the button) and Paste special (offering more options, among them the format you want to paste). Did you just click on the paste button, or did you also try Paste special? (Side note: It is basically the same in Word. I have no clue about Google Docs, because I have never used it). – Binarus Sep 14 at 6:19
  • it sounds like the problem is in your Windows Forms tool. sharing that code is likely the only way to troubleshoot what is happening. – FocusedWanderer Sep 15 at 19:42

Windows APIs support Both rich/HTML formatted and plain text clipboard.

A window can place more than one object on the clipboard, each representing the same information in a different clipboard format. Users need not be aware of the clipboard formats used for an object on the clipboard.

The following topics describe the clipboard formats.

Standard Clipboard Formats

The clipboard formats defined by the system are called standard clipboard formats. These clipboard formats are described in Standard Clipboard Formats.

Registered Clipboard Formats

Many applications work with data that cannot be translated into a standard clipboard format without loss of information. These applications can create their own clipboard formats. A clipboard format that is defined by an application, is called a registered clipboard format. For example, if a word-processing application copied formatted text to the clipboard using a standard text format, the formatting information would be lost. The solution would be to register a new clipboard format, such as Rich Text Format (RTF).

To register a new clipboard format, use the RegisterClipboardFormat function. This function takes the name of the format and returns an unsigned integer value that represents the registered clipboard format. To retrieve the name of the registered clipboard format, pass the unsigned integer value to the GetClipboardFormatName function.

If more than one application registers a clipboard format with exactly the same name, the clipboard format is registered only once. Both calls to the RegisterClipboardFormat function return the same value. In this way, two different applications can share data by using a registered clipboard format.

Private Clipboard Formats

An application can identify a private clipboard format by defining a value in the range CF_PRIVATEFIRST through CF_PRIVATELAST. An application can use a private clipboard format for an application-defined data format that does not need to be registered with the system. Data handles associated with private clipboard formats are not automatically freed by the system. If your windows use private clipboard formats, you can use the WM_DESTROYCLIPBOARD message to free any related resources that are no longer needed.

An application can place data handles on the clipboard by defining a private format in the range CF_GDIOBJFIRST through CF_GDIOBJLAST. When using values in this range, the data handle is not a handle to a Windows Graphics Device Interface (GDI) object, but is a handle allocated by the GlobalAlloc function with the GMEM_MOVEABLE flag. When the clipboard is emptied the system automatically deletes the object using the GlobalFree function.

Multiple Clipboard Formats

A window can place more than one clipboard object on the clipboard, each representing the same information in a different clipboard format. When placing information on the clipboard, the window should provide data in as many formats as possible. To find out how many formats are currently used on the clipboard, call the CountClipboardFormats function.

Clipboard formats that contain the most information should be placed on the clipboard first, followed by less descriptive formats. A window pasting information from the clipboard typically retrieves a clipboard object in the first format it recognizes. Because clipboard formats are enumerated in the order they are placed on the clipboard, the first recognized format is also the most descriptive.

For example, suppose a user copies styled text from a word-processing document. The window containing the document might first place data on the clipboard in a registered format, such as RTF. Subsequently, the window would place data on the clipboard in a less descriptive format, such as text (CF_TEXT).

When the content of the clipboard is pasted into another window, the window retrieves data in the most descriptive format it recognizes. If the window recognizes RTF, the corresponding data is pasted into the document. Otherwise, the text data is pasted into the document and the formatting information is lost.

Synthesized Clipboard Formats

The system implicitly converts data between certain clipboard formats: if a window requests data in a format that is not on the clipboard, the system converts an available format to the requested format. The system can convert data as indicated in the following table.


If the system provides an automatic type conversion for a particular clipboard format, there is no advantage to placing the conversion format(s) on the clipboard.

If the system provides an automatic type conversion for a particular clipboard format, and you call EnumClipboardFormats to enumerate the clipboard data formats, the system first enumerates the format that is on the clipboard, followed by the formats to which it can be converted.

When copying bitmaps, it is best to place the CF_DIB or CF_DIBV5 format on the clipboard. This is because the colors in a device-dependent bitmap (CF_BITMAP) are relative to the system palette, which may change before the bitmap is pasted. If the CF_DIB or CF_DIBV5 format is on the clipboard and a window requests the CF_BITMAP format, the system renders the device-independent bitmap (DIB) using the current palette at that time.

Source: https://docs.microsoft.com/en-us/windows/win32/dataxchg/clipboard-formats

So it depends on how the applications use Windows APIs for this. Rich word processing applications support rich format clipboard.

And as a tool I use InsideClipboard by Nirsoft (Binary rendering) and ClipClip.

| improve this answer | |

All the tools you listed will use the best format for the paste that is available in the clipboard. So I think that the problem is with your Windows Forms tool.

To debug what is happening, you could use the tool Free Clipboard Viewer, which will list all the formats available in the clipboard and their contents.

enter image description here

| improve this answer | |
  • my application was working before. I didn't change anything. It's just one day it stopped working as expected. My application will copy 3 formats to clipboard, HTML, RTF and plain text. Previously, in Wordpad, when I paste it, it will accept RTF, in Notepad it will accept plain text. All well. But suddenly one day, Wordpad will also paste as plain text and lose the format. That's why I am asking. If it is always like this, I wouldn't be asking. – imgen Sep 17 at 2:27
  • Have you verified what is found on the clipboard? Your application used Windows API that might have changed a bit. – harrymc Sep 17 at 6:11
  • I would imagine such basic api would stay compatible and don't change overnight. But anyway, I think I need to let go of this issue – imgen Oct 9 at 3:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.