DZone 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
Get the code for class HtmlClipboard() by Phillip Piper <a href=http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/474121>here</a>. 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 <a href=http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/474121>the recipe</a>.