[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 677
  • Last Modified:

How can I copy from an html file to the clipboard in Python in formatted text?

I'm writting a Word document and I'd like to paste a formatted code-snippets directly from clipboard.

At this moment I am able to write these snippets into an .html file to the harddisk. My goal is to extend my Python script and load this .html file on the clipboard in "formatted text" to directly paste at Microsoft Word.

Does anyone knows any way to do this in Python?

Thanks in advance.

Sherab
0
ShaddyKo
Asked:
ShaddyKo
1 Solution
 
ShaddyKoAuthor Commented:
Well, I've found a solution for this.

http://code.activestate.com/recipes/474121-getting-html-from-the-windows-clipboard/

It's work pretty well... if anyone wants more information about the clipboard just take a look here:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms649013(v=vs.85).aspx

Download de pywin32 module and with win32clipboard you can do everything.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now