Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Getting HTML from Windows clipboard (See related posts)

Get the code for class HtmlClipboard() by Phillip Piper here.

Usage
>>> cb = HtmlClipboard()
>>> cb.GetAvailableFormats()
[49161, 49562, 49339, 49560, 49561, 13, 1, 49334, 49335, 49333, 49344, 49478, 49171, 16, 7]
>>> cb.HasHtmlFormat()
True
>>> cb.GetFromClipboard()
>>> cb.htmlClipboardVersion
'0.9'
>>> cb.GetFragment()
'<p>Writing to the clipboard is <strong>easy</strong> with this code.</p>'
>>> cb.GetSource()
'http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/474121'
>>> 

You can also put a html fragment to the clipboard as well.
See more detials in the recipe.

You need to create an account or log in to post comments to this site.


Click here to browse all 5059 code snippets

Related Posts