Why do you expect it work? You SET it to one format, the clipboard does not automagically convert between formats. So depending on your target program you need to use RTF or HTML. Chances are that HTML will also work where RTF works so in general you would be better off using HTML and not RTF as HTML would be more flexible (it would work in Word, Wordpad, Write, Open Office, Web Browser, Nearly all Email programs etc)
So convert RTF to HTML and use SetHTML and problems are solved
If you can't switch the RTF 2 HTML because the source has to be RTF (or comes from source that generates RTF) use a command line convertor (there are many here is one specific
https://sourceforge.net/projects/rtf2html/ or you can use
http://pandoc.org/ (bigger program) to convert RTF to HTML file (you will hardly notice the delay I'm sure) and use SetRTF for RTF and SetHTML for HTML - you can set various formats - incl plain text if you wish (just use a regex on the HTML file to get the plain text version, this works for me:
Code: Select all
WinClip.SetHTML(RTF-FILE)
WinClip.SetHTML(HTML-FILE)
Text:=RegExReplace(html,"iU)</*[^>]*>") ; strip HTML tags so we can paste normal text if need be
WinClip.SetText(Text)