convert plain text to rich text

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

' hi all

' suppose i have this:
Dim strText As String = "Hello! <b>this</b> text <i>is</i> formatted"
' NOTE: i want the "this" to be bold and the "is" italic

' but when i do this:
Me.RichTextBox1.TextRTF = strText
' the the richtextbox shows a string exactly as typed above instead of
actually applying the formatting.

what am I doing wrong?
does anyone know if it's possible to get the results i'm expecting?

thx,
Zacho
 
Zachovich said:
' suppose i have this:
Dim strText As String = "Hello! <b>this</b> text <i>is</i> formatted"
' NOTE: i want the "this" to be bold and the "is" italic

' but when i do this:
Me.RichTextBox1.TextRTF = strText
' the the richtextbox shows a string exactly as typed above instead of
actually applying the formatting.

what am I doing wrong?

The string you are using has HTML tags. The richtext editor doesn't have a
clue what to do with those. RTF is a completely different format from HTML.
does anyone know if it's possible to get the results i'm expecting?

Assuming you have HTML content and need to transfer the formatting to RTF,
not easily. Of course it would be possible to convert the one into the
other, I guess - as long as the various formatting options are supported
in both worlds. Here's an RTF spec:
http://www.biblioscape.com/rtf15_spec.htm

Depending on what you want to do, a much more useful idea might be to use
an IE ActiveX control instead of the RichTextBox and just display the HTML
code as it is.


Oliver Sturm
 
Back
Top