Answered using System.Windows.Forms.ClipBoard

Hi everybody,

I try to transform these 2 lines of code to ABL, but have problems with the "DataFormats". Can anybody please help ?

Clipboard.SetData(DataFormats.Rtf, rtfString);
lcHTML = Clipboard.GetData(DataFormats.Html);

TIA, Wolf
 

Osborne

Active Member
Does this work?:
Code:
System.Windows.Forms.Clipboard:SetData(System.Windows.Forms.DataFormats:Rtf, rtfString).
lcHTML = System.Windows.Forms.Clipboard:GetData(System.Windows.Forms.DataFormats:Html).
 
Thanks Osborne !

SetData works fine, the RTF-text is saved to the clipboard, but GetData returns nothing.

Read something about Clipboard auto conversion, but I have no idea where to turn it on. Maybe you have a solution for this as well ?

Wolf
 

Osborne

Active Member
Not really sure about converting as there does not appear to be a method for that:
As HTML is actually text does using System.Windows.Forms.Clipboard:GetText instead work?:
Code:
lcHTML = System.Windows.Forms.Clipboard:GetText(System.Windows.Forms.TextDataFormat:Html).
 
GetText returns only the text, not the formatting.
Maybe converting RTF to HTML doesnt work at all using the clipboard. I have an other solution, but it is slow:
- save the contents of a RichTextBox to a file
- open this file with word
- and save it as HTML

works, but it is slow

Thanks anyway, Wolf
 

Osborne

Active Member
It does appear to be the case and your solution looks to be the option as this one is similar:
Apart from specialist third party .NET solutions there does not appear to be a natural way to convert RTF to HTML.
 
Top