VB Code:
Public Sub WriteText(ByVal Data As String, ByVal outputPath As String)
Dim rtf As New RichTextBox
Dim StartBold As Boolean = False
Dim boldFont As New System.Drawing.Font(System.Drawing.FontFamily.GenericSerif, 12, FontStyle.Bold)
Dim normalFont As New System.Drawing.Font(System.Drawing.FontFamily.GenericSerif, 12, FontStyle.Regular)
Dim dataArray() As String = Regex.Split(Data, "(<b>|</b>)")
For Each s As String In dataArray
If s = "<b>" Then
StartBold = True
s = ""
ElseIf s = "</b>" Then
StartBold = False
s = ""
End If
If StartBold Then
rtf.AppendText(s)
rtf.Select(rtf.Text.Length - s.Length, s.Length)
rtf.SelectionFont = boldFont
Else
rtf.AppendText(s)
rtf.Select(rtf.Text.Length - s.Length, s.Length)
rtf.SelectionFont = normalFont
End If
Next
rtf.SaveFile(outputPath)
End Sub