Sometimes you want to copy tabular data, and paste it differently depending on the target. For instance, you want CSV when you paste in your text editor, and HTML when you paste it in an email.
Fortunately, some nice fellow has created a helper class to handle all that for you. And it’s even available on GitHub!
To sum it up, the
Clipboard class has a SetDataObject method. A DataObject can get multiple contents (with different DataFormats) through multiple calls of the
SetData(string, object) method.
So basically, you should create a DataObject, then call SetData once with the HTML, and once with text. The trick is that the HTML needs special formatting to work.