How do I paste HTML to the clipboard so that it is recognized as HTML in applications such as Open Office and MS Word? It is possible when using gtkhtml or gecko if you've already rendered it, but I need a straight GTK+ solution.
Asked
Active
Viewed 657 times
1 Answers
4
You call gtk_clipboard_set_with_data
or gtk_clipboard_set_with_owner
, passing a GtkTargetEntry
with "text/html"
as the value for the target
field.
It's good practice to also provide "UTF8_STRING"
and "STRING"
targets for applications that don't support HTML.
Here's an example of some code that does this: GEdit HTML clipboard plugin.

daf
- 5,085
- 4
- 31
- 34
-
That last link to "GEdit HTML clipboard plugin" seems to be broken. – Craig McQueen Aug 06 '14 at 01:18
-
And ""text/plain;charset=utf-8" – Lothar Aug 11 '18 at 23:47