开发者

How to paste HTML to clipboard with GTK+

开发者 https://www.devze.com 2022-12-15 12:41 出处:网络
How do I paste HTML to the clipboard so that it is recognized as HTML in applications such as Open Offic开发者_高级运维e and MS Word? It is possible when using gtkhtml or gecko if you\'ve already rend

How do I paste HTML to the clipboard so that it is recognized as HTML in applications such as Open Offic开发者_高级运维e and MS Word? It is possible when using gtkhtml or gecko if you've already rendered it, but I need a straight GTK+ solution.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消