Skip to content Skip to sidebar Skip to footer

Can Not Round Trip Html Format To Clipboard

I want to write Html format, but I can not even get a simple MSDN example of it to work. http://msdn.microsoft.com/en-us/library/tbfb3z56.aspx Does this console app, a clipboard ro

Solution 1:

When you copy data from a browser onto the clipboard, it puts the same data onto the clipboard in multiple formats, including both text and HTML. So you can read the data back out in either text or HTML format. However, when you call SetText here, you are ONLY passing in HTML format, so when you use the regular GetText, there is no text version on the clipboard and you get null back.

You can put multiple formats onto the clipboard at once (i.e., both text and HTML) using IDataObject, but you have to do the translation between formats yourself before you put the data on the clipboard. There's an example of how to use IDataObject here.

Solution 2:

I can reproduce that it doesn't work... the var text2 = Clipboard.GetText(); returns "" each time...

(edit) A quick search yields this, which seems on topic.

Post a Comment for "Can Not Round Trip Html Format To Clipboard"