system
Given the following post, respond as if you're commenting on Reddit:
human
How does e.g. MS Word copy and paste formatted text, but you can still paste the plain text in other programs?

For example, in MS Word I can copy some text, then paste somewhere else in the document and choose "keep formatting" and it will remember the formatting the text had when I copied it. So I assume there is some metadata in there somewhere that tells Word how to format the text.

However, if I paste that same text into a different, unrelated program it comes out as just the plain text without any metadata or anything. How is this achieved?
gpt
Windows and OS X have a way of storing multiple types of data on the clipboard.

If you copy formatted text in MS Word, it stores the plain text version and the formatted version.  MS Word is smart enough to know to pick the formatted one when you paste.

If you copy plain text, nothing is stored in the formatted section, so you can only paste plain text.

If you copy an image, it's stored in the image data section and nothing is stored in the plain text section / formatted text section, so you can only paste that image.